diff --git a/public/img/ajax-loader.gif b/public/img/ajax-loader.gif deleted file mode 100644 index 9796fb41..00000000 Binary files a/public/img/ajax-loader.gif and /dev/null differ diff --git a/public/js/bundle.js b/public/js/bundle.js index 702aac0e..bd0b07e4 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -18,6 +18,7 @@ require('codemirror/addon/mode/simple'); require('codemirror/addon/mode/multiplex'); require('codemirror/mode/cmake/cmake'); +require('codemirror/mode/clike/clike'); require('codemirror/mode/css/css'); require('codemirror/mode/dockerfile/dockerfile'); require('codemirror/mode/go/go'); @@ -29,9 +30,27 @@ require('codemirror/mode/perl/perl'); require('codemirror/mode/php/php'); require('codemirror/mode/powershell/powershell'); require('codemirror/mode/python/python'); +require('codemirror/mode/properties/properties'); require('codemirror/mode/ruby/ruby'); require('codemirror/mode/sass/sass'); require('codemirror/mode/shell/shell'); +require('codemirror/mode/vbscript/vbscript'); +require('codemirror/mode/groovy/groovy'); +require('codemirror/mode/erlang/erlang'); +require('codemirror/mode/ecl/ecl'); +require('codemirror/mode/coffeescript/coffeescript'); +require('codemirror/mode/clojure/clojure'); +require('codemirror/mode/diff/diff'); +require('codemirror/mode/smalltalk/smalltalk'); +require('codemirror/mode/rust/rust'); +require('codemirror/mode/lua/lua'); +require('codemirror/mode/haskell/haskell'); +require('codemirror/mode/markdown/markdown'); +require('codemirror/mode/scheme/scheme'); +require('codemirror/mode/r/r'); +require('codemirror/mode/rst/rst'); +require('codemirror/mode/ntriples/ntriples'); +require('codemirror/mode/pascal/pascal'); require('codemirror/mode/sql/sql'); require('codemirror/mode/swift/swift'); require('codemirror/mode/twig/twig'); diff --git a/public/js/markdown.js b/public/js/markdown.js index 45c84f95..a521d708 100644 --- a/public/js/markdown.js +++ b/public/js/markdown.js @@ -3,6 +3,7 @@ hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml.js')); hljs.registerLanguage('css', require('highlight.js/lib/languages/css.js')); hljs.registerLanguage('cmake', require('highlight.js/lib/languages/cmake.js')); hljs.registerLanguage('dockerfile', require('highlight.js/lib/languages/dockerfile.js')); +hljs.registerLanguage('Dockerfile', require('highlight.js/lib/languages/dockerfile.js')); hljs.registerLanguage('less', require('highlight.js/lib/languages/less.js')); hljs.registerLanguage('scss', require('highlight.js/lib/languages/scss.js')); hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml.js')); diff --git a/scripts/init.sh b/scripts/init.sh index 58c8b97c..198059b6 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -11,7 +11,7 @@ mkdir -p ./git-test/ pushd ./git-test -for repo in "https://github.com/patrikx3/gitlist" "https://github.com/patrikx3/gitter" "https://github.com/patrikx3/corifeus" "https://github.com/patrikx3/corifeus-builder" "https://github.com/patrikx3/gitlist-workspace" "https://github.com/patrikx3/onenote" +for repo in "https://github.com/patrikx3/gitlist" "https://github.com/patrikx3/gitter" "https://github.com/patrikx3/corifeus" "https://github.com/patrikx3/corifeus-builder" "https://github.com/patrikx3/gitlist-workspace" "https://github.com/patrikx3/onenote" "https://github.com/patrikx3/resume-web" do git clone --bare $repo done diff --git a/src/Controller/BlobController.php b/src/Controller/BlobController.php index 4f50bef3..22f6256b 100644 --- a/src/Controller/BlobController.php +++ b/src/Controller/BlobController.php @@ -40,6 +40,7 @@ public function connect(Application $app) 'breadcrumbs' => $breadcrumbs, 'branches' => $repository->getBranches(), 'tags' => $repository->getTags(), + 'enforceCodemirror' => isset($_GET['codemirror']) )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('commitishPath', '.+') diff --git a/src/Util/Repository.php b/src/Util/Repository.php index 10d462e0..74cfb424 100644 --- a/src/Util/Repository.php +++ b/src/Util/Repository.php @@ -26,6 +26,7 @@ class Repository 'el' => 'erlang', 'go' => 'go', 'groovy' => 'groovy', + 'hbs' => 'handlebars', 'hs' => 'haskell', 'lhs' => 'haskell', 'jsp' => 'application/x-jsp', @@ -35,16 +36,20 @@ class Repository 'tpl' => 'htmlmixed', 'js' => 'javascript', 'json' => 'javascript', - 'less' => 'less', + 'jsx' => 'jsx', + 'less' => 'css', 'lua' => 'lua', 'md' => 'markdown', 'markdown' => 'markdown', - 'sql' => 'mysql', + 'sql' => 'sql', + 'swift' => 'swift', + 'twig' => 'twig', 'ml' => 'ocaml', 'mli' => 'ocaml', 'pl' => 'perl', 'pm' => 'perl', 'pas' => 'pascal', + 'ps1' => 'powershell', 'ini' => 'properties', 'cfg' => 'properties', 'nt' => 'ntriples', @@ -52,6 +57,7 @@ class Repository 'rb' => 'ruby', 'rst' => 'rst', 'r' => 'r', + 'lock' => 'javascript', 'sh' => 'shell', 'ss' => 'scheme', 'scala' => 'text/x-scala', @@ -120,6 +126,10 @@ public function __construct(Application $app) */ public function getFileType($file) { + if ($file === 'Dockerfile') { + return 'dockerfile'; + }; + if (($pos = strrpos($file, '.')) !== false) { $fileType = substr($file, $pos + 1); } else { diff --git a/twig/file.twig b/twig/file.twig index 58279333..6c19d590 100644 --- a/twig/file.twig +++ b/twig/file.twig @@ -7,8 +7,9 @@ {% block content %} {% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %} - {% if fileType != 'image' and fileType != 'markdown' %} -
+ +
+ {% if (fileType != 'image' and fileType != 'markdown') or enforceCodemirror %} @@ -17,9 +18,20 @@
-
{% endif %} + {% if fileType == 'markdown' %} + + {% if enforceCodemirror %} + Markdown rendered + {% else %} + Markdown code + {% endif %} + + + {% endif %} + +
Raw Blame @@ -32,7 +44,7 @@ {% if fileType == 'image' %}
{{ file }}
- {% elseif fileType == 'markdown' %} + {% elseif fileType == 'markdown' and enforceCodemirror != true %}
{{ blob }}
{% else %}