From 088c9ebdcd4e93ddf1bd3edb1bf260a557c34ec4 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sat, 9 May 2015 12:30:33 +0200 Subject: [PATCH] Default type --- app/locales/en.yml | 3 ++- app/locales/fr.yml | 5 +++-- src/Gist/Controller/Controller.php | 2 +- src/Gist/Controller/EditController.php | 2 +- src/Gist/Form/CreateGistForm.php | 3 ++- src/Gist/Model/Gist.php | 9 +++++++++ 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/locales/en.yml b/app/locales/en.yml index da26832..870b3b8 100644 --- a/app/locales/en.yml +++ b/app/locales/en.yml @@ -38,7 +38,8 @@ form: type: label: 'Language: %value%' choice: - xml: 'HTML/XML' + html: 'HTML' + xml: 'XML' css: 'CSS' javascript: 'JAVASCRIPT' php: 'PHP' diff --git a/app/locales/fr.yml b/app/locales/fr.yml index a856fa0..4d6d58c 100644 --- a/app/locales/fr.yml +++ b/app/locales/fr.yml @@ -18,7 +18,7 @@ gist: history: 'Révision(s)' raw: 'RAW' download: 'Télécharger' - fork: 'Clôner' + clone: 'Clôner' date: format: 'd/m/Y H\hi s\s' @@ -38,7 +38,8 @@ form: type: label: 'Langage : %value%' choice: - xml: 'HTML/XML' + html: 'HTML' + xml: 'XML' css: 'CSS' javascript: 'JAVASCRIPT' php: 'PHP' diff --git a/src/Gist/Controller/Controller.php b/src/Gist/Controller/Controller.php index 101c1ae..8e8c485 100644 --- a/src/Gist/Controller/Controller.php +++ b/src/Gist/Controller/Controller.php @@ -40,7 +40,7 @@ class Controller 'history' => $history, 'commit' => $commit, 'raw_content' => $content, - 'content' => $app['gist']->highlight($gist->getType(), $content), + 'content' => $app['gist']->highlight($gist->getGeshiType(), $content), ); } diff --git a/src/Gist/Controller/EditController.php b/src/Gist/Controller/EditController.php index b023be0..d90116f 100644 --- a/src/Gist/Controller/EditController.php +++ b/src/Gist/Controller/EditController.php @@ -19,7 +19,7 @@ class EditController extends Controller public function createAction(Request $request, Application $app) { $data = array( - 'type' => 'xml', + 'type' => 'html', 'cipher' => 'no', ); diff --git a/src/Gist/Form/CreateGistForm.php b/src/Gist/Form/CreateGistForm.php index 1bf58eb..046c9bb 100644 --- a/src/Gist/Form/CreateGistForm.php +++ b/src/Gist/Form/CreateGistForm.php @@ -71,11 +71,12 @@ class CreateGistForm extends AbstractForm protected function getTypes() { $types = array( - 'xml' => '', + 'html' => '', 'css' => '', 'javascript' => '', 'php' => '', 'sql' => '', + 'xml' => '', 'yaml'=> '', 'perl' => '', 'c' => '', diff --git a/src/Gist/Model/Gist.php b/src/Gist/Model/Gist.php index 4870d2e..31fa5d9 100644 --- a/src/Gist/Model/Gist.php +++ b/src/Gist/Model/Gist.php @@ -26,6 +26,15 @@ class Gist extends BaseGist $this->setFile(uniqid()); } + public function getGeshiType() + { + $data = array( + 'html' => 'xml', + ); + + return str_replace(array_keys($data), array_values($data), $this->getType()); + } + public function getTypeAsExtension() { $data = array(