Skip to content

Commit

Permalink
p3x-robot sunday release 2018-5-15 13:00:40
Browse files Browse the repository at this point in the history
  • Loading branch information
p3x-robot committed May 15, 2018
1 parent 11258f5 commit bb59dd6
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
Binary file removed public/img/ajax-loader.gif
Binary file not shown.
19 changes: 19 additions & 0 deletions public/js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
1 change: 1 addition & 0 deletions public/js/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Controller/BlobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '.+')
Expand Down
14 changes: 12 additions & 2 deletions src/Util/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Repository
'el' => 'erlang',
'go' => 'go',
'groovy' => 'groovy',
'hbs' => 'handlebars',
'hs' => 'haskell',
'lhs' => 'haskell',
'jsp' => 'application/x-jsp',
Expand All @@ -35,23 +36,28 @@ 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',
'py' => 'python',
'rb' => 'ruby',
'rst' => 'rst',
'r' => 'r',
'lock' => 'javascript',
'sh' => 'shell',
'ss' => 'scheme',
'scala' => 'text/x-scala',
Expand Down Expand Up @@ -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 {
Expand Down
20 changes: 16 additions & 4 deletions twig/file.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
{% block content %}
{% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}

{% if fileType != 'image' and fileType != 'markdown' %}
<div class="pull-left">

<div class="pull-left">
{% if (fileType != 'image' and fileType != 'markdown') or enforceCodemirror %}
<div id="p3x-gitlist-file-small" style="display: none;">
<button id="p3x-gitlist-file-small-button" class="btn btn-sm btn-primary">Parse code</button>
</div>
Expand All @@ -17,9 +18,20 @@
<button id="p3x-gitlist-file-button-scroll" class="btn btn-sm btn-primary">Scroll mode</button>
<button id="p3x-gitlist-file-button-full" class="btn btn-sm btn-primary">Full height</button>
</div>
</div>
{% endif %}

{% if fileType == 'markdown' %}

{% if enforceCodemirror %}
<a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}" class="btn btn-primary btn-sm"><span class="fa fa-code"></span> Markdown rendered</a>
{% else %}
<a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}?codemirror=1" class="btn btn-primary btn-sm"><span class="fa fa-code"></span> Markdown code</a>
{% endif %}


{% endif %}
</div>

<div class="btn-group pull-right">
<a href="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}" class="btn btn-primary btn-sm"><span class="fa fa-file-text-o"></span> Raw</a>
<a href="{{ path('blame', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}" class="btn btn-primary btn-sm"><span class="fa fa-bullhorn"></span> Blame</a>
Expand All @@ -32,7 +44,7 @@
{% if fileType == 'image' %}
<div class="text-center"><img src="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}" alt="{{ file }}" class="image-blob" /></div>

{% elseif fileType == 'markdown' %}
{% elseif fileType == 'markdown' and enforceCodemirror != true %}
<div class="md-view"><div id="md-content">{{ blob }}</div></div>

{% else %}
Expand Down

0 comments on commit bb59dd6

Please sign in to comment.