1
0
mirror of https://gitnet.fr/deblan/gist.git synced 2021-08-14 08:30:49 +02:00

Geshi removed - Prismjs added

This commit is contained in:
Simon Vieille 2017-10-15 02:07:41 +02:00
parent 43fd509d69
commit 88ce6d66db
20 changed files with 827 additions and 753 deletions

View File

@ -12,11 +12,3 @@ $app->extend('twig', function ($twig, $app) {
return $twig;
});
$app['geshi'] = $app->share(function ($app) {
$geshi = new GeSHi();
$geshi->enable_classes();
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
return $geshi;
});

View File

@ -20,5 +20,5 @@ $app['git_working_copy'] = $app->share(function ($app) {
});
$app['gist'] = $app->share(function ($app) {
return new Gist($app['gist_path'], $app['git_wrapper'], $app['git_working_copy'], $app['geshi']);
return new Gist($app['gist_path'], $app['git_wrapper'], $app['git_working_copy']);
});

View File

@ -15,8 +15,8 @@
"dependencies": {
"bootstrap": "3.3.4",
"flag-icon-css": "0.7.1",
"SyntaxHighlighter": "3.0.83",
"iframe-resizer": "2.8.6",
"jsdiff": "~2.2.2"
"jsdiff": "~2.2.2",
"Prism": "~1.8.1"
}
}

View File

@ -1,6 +1,5 @@
{
"require": {
"geshi/geshi": "dev-master",
"silex/silex": "1.3.x-dev",
"symfony/yaml": "~2.6",
"symfony/twig-bridge": "~2.6",

View File

@ -91,7 +91,6 @@ abstract class Controller
'history' => $history,
'commit' => $commit,
'raw_content' => $content,
'content' => $app['gist']->highlight($gist->getGeshiType(), $content),
);
}

View File

@ -1,15 +1,16 @@
{% extends 'base.html.twig' %}
{% block css %}
{% if gist.cipher %}
<link type="text/css" rel="Stylesheet" href="{{ web_path }}components/SyntaxHighlighter/styles/shCoreRDark.css" />
<link type="text/css" rel="Stylesheet" href="{{ web_path }}components/SyntaxHighlighter/styles/shThemeRDark.css" />
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/geshi/vibrant-ink.css" />
{% endif %}
{{ parent() }}
<link rel="stylesheet" href="{{ web_path }}components/Prism/themes/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
<style type="text/css">
#embed {
padding: 0;
@ -19,13 +20,6 @@
background: #222;
}
pre {
font-size: 14px;
padding: 5px;
margin-bottom: 0;
background: #333;
}
.panel-body {
padding: 0;
}
@ -33,11 +27,6 @@
.panel {
margin-bottom: 0;
}
pre ol {
padding-left: 0 !important;
list-style: none;
}
</style>
{% endblock %}
@ -80,11 +69,7 @@
<div class="tab-content">
<div id="view" class="tab-pane active in">
<div id="viewer">
{% if gist.cipher %}
<pre class="brush: {{ gist.type }}; syntaxhighlighter">{{ raw_content|raw }}</pre>
{% else %}
{{ content|raw }}
{% endif %}
<pre><code {% if gist.cipher %}data-cipher{% endif %} class="language-{{ gist.type }}">{{ raw_content }}</code></pre>
</div>
</div>
</div>
@ -100,37 +85,5 @@
{{ parent() }}
<script type="text/javascript" src="{{ web_path }}components/iframe-resizer/js/iframeResizer.contentWindow.min.js"></script>
{% if gist.cipher %}
<script type="text/javascript" src="{{ web_path }}components/SyntaxHighlighter/scripts/XRegExp.js"></script> <!-- XRegExp is bundled with the final shCore.js during build -->
<script type="text/javascript" src="{{ web_path }}components/SyntaxHighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="{{ web_path }}components/SyntaxHighlighter/scripts/shAutoloader.js"></script>
<script type="text/javascript">
SyntaxHighlighter.autoloader(
['applescript', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushAppleScript.js' ],
['actionscript3', 'as3', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushAS3.js' ],
['bash', 'shell', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushBash.js' ],
['coldfusion', 'cf', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushColdFusion.js' ],
['cpp', 'c', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushCpp.js' ],
['c#', 'c-sharp', 'csharp', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushCSharp.js' ],
['css', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushCss.js' ],
['delphi', 'pascal', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushDelphi.js' ],
['diff', 'patch', 'pas', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushDiff.js' ],
['erl', 'erlang', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushErlang.js' ],
['groovy', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushGroovy.js' ],
['java', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushJava.js' ],
['jfx', 'javafx', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushJavaFX.js' ],
['js', 'jscript', 'javascript', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushJScript.js' ],
['perl', 'pl', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushPerl.js' ],
['php', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushPhp.js' ],
['text', 'plain', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushPlain.js' ],
['py', 'python', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushPython.js' ],
['ruby', 'rails', 'ror', 'rb', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushRuby.js' ],
['scala', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushScala.js' ],
['sql', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushSql.js' ],
['vb', 'vbnet', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushVb.js' ],
['xml', 'xhtml', 'xslt', 'html', '{{ web_path }}components/SyntaxHighlighter/scripts/shBrushXml.js' ]
);
</script>
{% endif %}
<script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
{% endblock %}

View File

@ -1,9 +1,15 @@
{% extends 'base.html.twig' %}
{% block css %}
<link rel="stylesheet" href="{{ web_path }}app/css/geshi/vibrant-ink.css" />
{{ parent() }}
<link rel="stylesheet" href="{{ web_path }}app/css/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
{% endblock %}
{% block title %}{{ gist.title ? gist.title : 'gist.untitled'|trans }} - {{ 'gist.action.history'|trans }}{% endblock %}
@ -52,11 +58,8 @@
</p>
<div>
{% if not loop.first %}
<div class="diff" id="diff-{{ loop.index }}">
{% if not gist.cipher %}
{{ commit.diff|raw }}
{% endif %}
</div>
<pre><code class="diff language-diff" id="diff-{{ loop.index }}">{% if not gist.cipher %}{{ commit.diff }}{% endif %}</code></pre>
{% endif %}
</div>
</div>
@ -76,9 +79,9 @@
{% block js %}
{{ parent() }}
{% if gist.cipher %}
{{ include('View/cipherJs.html.twig') }}
<script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
{% if gist.cipher %}
<script src="{{ web_path }}components/jsdiff/diff.min.js"></script>
<script>
@ -115,21 +118,19 @@
var lines = value.split("\n");
for (var i = 0, l = lines.length; i < l; i++) {
if (lines[i] != '\ No newline at end of file') {
diffContent.push(sign + lines[i]);
}
}
}
diffContent = diffContent.join("\n");
var $pre = $('<pre>')
.attr('class', 'brush: diff; syntaxhighlighter')
.text(diffContent);
$('#diff-' + (u + 1).toString()).append($pre);
$('#diff-' + (u + 1).toString()).text(diffContent);
}
}
SyntaxHighlighter.all();
Prism.highlightAll();
</script>
{% endif %}
{% endblock %}

View File

@ -1,14 +1,15 @@
{% extends 'base.html.twig' %}
{% block css %}
{% if gist.cipher %}
<link type="text/css" rel="Stylesheet" href="{{ web_path }}components/SyntaxHighlighter/styles/shCoreRDark.css" />
<link type="text/css" rel="Stylesheet" href="{{ web_path }}components/SyntaxHighlighter/styles/shThemeRDark.css" />
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/geshi/vibrant-ink.css" />
{% endif %}
{{ parent() }}
<link rel="stylesheet" href="{{ web_path }}app/css/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
{% endblock %}
{% block title %}{{ gist.title ? gist.title : 'gist.untitled'|trans }} - {{ commit|slice(0, 10) }}{% endblock %}
@ -61,11 +62,7 @@
<div class="tab-content">
<div id="view" class="tab-pane active in">
<div id="viewer">
{% if gist.cipher %}
<pre class="brush: {{ gist.type }}; syntaxhighlighter">{{ raw_content|raw }}</pre>
{% else %}
{{ content|raw }}
{% endif %}
<pre><code {% if gist.cipher %}data-cipher{% endif %} class="language-{{ gist.type }}" data-dependencies="{{ gist.type }}">{{ raw_content }}</code></pre>
</div>
<p id="embed" class="pull-right">
@ -83,7 +80,5 @@
{% block js %}
{{ parent() }}
{% if gist.cipher %}
{{ include('View/cipherJs.html.twig') }}
{% endif %}
<script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
{% endblock %}

View File

@ -32,25 +32,18 @@ class Gist
*/
protected $gitWorkingCopy;
/**
* @var GeSHi
*/
protected $geshi;
/**
* __construct.
*
* @param mixed $gistPath
* @param GitWrapper $gitWrapper
* @param GitWorkingCopy $gitWorkingCopy
* @param GeSHi $geshi
*/
public function __construct($gistPath, GitWrapper $gitWrapper, GitWorkingCopy $gitWorkingCopy, GeSHi $geshi)
public function __construct($gistPath, GitWrapper $gitWrapper, GitWorkingCopy $gitWorkingCopy)
{
$this->gistPath = $gistPath;
$this->gitWrapper = $gitWrapper;
$this->gitWorkingCopy = $gitWorkingCopy;
$this->geshi = $geshi;
}
/**
@ -95,7 +88,7 @@ class Gist
$data = array(
'commit' => trim($commits[$i][1]),
'date' => new \DateTime(trim($dates[$i][1])),
'diff' => $this->highlight('diff', $diff),
'diff' => str_replace('\ No newline at end of file', '', $diff),
);
if ($gist->isCipher()) {
@ -193,20 +186,4 @@ class Gist
return count(explode("\n", $content));
}
/**
* Highlight the content.
*
* @param string $type
* @param string $content
*
* @return string
*/
public function highlight($type, $content)
{
$this->geshi->set_source($content);
$this->geshi->set_language($type);
return $this->geshi->parse_code();
}
}

View File

@ -1,146 +0,0 @@
/* @override http://localhost/mark_story2/site/css/geshi.css */
/**
* GeSHi CSS Inspired by
* TextMate Theme Dawn
*
* Copyright 2008 Mark Story
*
* This work is licensed under the Creative Commons Attribution-Share Alike 2.5 Canada License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/ca/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
* @copyright Copyright 2008, Mark Story.
* @link http://mark-story.com
* @license http://creativecommons.org/licenses/by-sa/2.5/ca/
*/
/*
* Global geshi styles
**********************/
#main pre {
line-height: 1.5em;
font-size: 10px;
white-space: normal;
padding: 0;
background: #E8EDF4;
border: 1px solid #222;
}
pre ol {
list-style: decimal;
list-style-position: outside;
padding: 0;
margin: 0;
}
#main pre ol li {
margin: 0 0 0 35px;
padding: 0;
color: #333;
clear: none;
}
pre ol li div {
color:#000;
}
/* Line highlights */
.li1 {
background: #E4E8EF;
}
/* comments */
.co1,
.coMULTI {
color:#5A526E;
}
/* methods */
.me1{
color:#000;
}
.me0 {
}
.me2 {
color:#000;
}
/* brackets */
.br0 {
color:#000;
}
/* strings */
.st0 {
color:#0B6125;
}
/* keywords */
.kw1 {
color: #794938;
}
.kw2 {
color:#A71D5D;
font-style: italic;
}
.kw3 {
color:#693A17;
}
/* numbers */
.nu0 {
color:#811F24;
}
/* vars */
.re0 {
color:#434A97;
}
/*
* CSS selectors
*****************/
/* classnames */
[lang=css] .kw2,
.css .kw2 {
color:#C24F24;
}
[lang=css] .kw1,
.css .kw1 {
color:#691C97;
}
[lang=css] .re0,
.css .re0 {
color: #C24F24;
}
.re1 {
color: #C24F24;
}
/* px values */
[lang=css] .re3,
.css .re3 {
color:#84252A;
}
/*
* Python
****************/
[lang=python] ol li div,
.python ol li div {
color: #000;
}
[lang=python] .kw2,
.python .kw2 {
font-style: normal;
}
[lang=python] .kw1 {
color: #A91D5D;
}
/*
* Javascript
****************/
[lang=javascript] .me1,
.javascript .me1 {
color: #794938;
}

View File

@ -1,131 +0,0 @@
/**
* GeSHi CSS Inspired by TextMate
* Theme Mac Classic
*
* Copyright 2008 Mark Story
*
* This work is licensed under the Creative Commons Attribution-Share Alike 2.5 Canada License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/ca/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
* @copyright Copyright 2008, Mark Story.
* @link http://mark-story.com
* @license http://creativecommons.org/licenses/by-sa/2.5/ca/
*/
/*
* Global geshi styles
**********************/
#main pre {
line-height: 1.5em;
font-size: 10px;
white-space: normal;
padding: 0;
background: #eae9e5;
border: 1px solid #c0c0c0;
}
pre ol {
list-style: decimal;
list-style-position: outside;
padding: 0;
margin: 0;
}
#main pre ol li {
margin: 0 0 0 35px;
padding: 0;
color: #000;
clear: none;
}
pre ol li div {
color:#000;
}
/* php */
pre[lang=php] ol div,
pre.php ol div {
color:#fd1435;
}
/* Line highlights */
.li1 {
background: #f2f2f2;
}
/* Line highlights */
.li1 {
background: #f2f2f2;
}
/* comments */
.co1,
.coMULTI {
color:#5c9dff;
}
/* methods */
.me1{
color:#000;
}
.me0 {
}
.me2 {
color:#000;
}
/* brackets */
.br0 {
color:#222;
}
/* strings */
.st0 {
color:#b701bb;
}
/* keywords */
.kw1 {
color: #fd1435;
}
.kw2 {
color:#6266f5;
}
.kw3 {
color:#505e80;
}
/* numbers */
.nu0 {
color:#0a0aa5;
}
/* vars */
.re0 {
color:#059532;
}
/*
* CSS selectors
*****************/
/* classnames */
[lang=css] .kw2,
.css .kw2 {
color:#0a0aa5;
}
.re1 {
color: #b701bb;
}
/* px values */
[lang=css] .re3,
.css .re3 {
color:#059532;
}
/*
* Javascript
****************/
[lang=javascript] .me1,
.javascript .me1 {
color:#505e80;
}

View File

@ -1,123 +0,0 @@
/* @override http://localhost/mark_story2/site/css/geshi.css */
/**
* GeSHi CSS Inspired by TextMate
* Theme Twilight
*
* Copyright 2008 Mark Story
*
* This work is licensed under the Creative Commons Attribution-Share Alike 2.5 Canada License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/ca/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
* @filesource
* @copyright Copyright 2008, Mark Story.
* @link http://mark-story.com
* @license http://creativecommons.org/licenses/by-sa/2.5/ca/
*/
/*
* Global geshi styles
**********************/
#main pre {
line-height: 1.5em;
font-size: 10px;
white-space: normal;
padding: 0;
background: #222223;
border: 1px solid #222;
}
pre ol {
list-style: decimal;
list-style-position: outside;
padding: 0;
margin: 0;
}
#main pre ol li {
margin: 0 0 0 35px;
padding: 0;
color: #000;
clear: none;
}
pre ol li div {
color:#f8f8f8;
}
/* Line highlights */
.li1 {
background: #202021;
}
/* comments */
.co1,
.coMULTI {
color:#5F5A60;
}
/* methods */
.me1{
color:#fff;
}
.me0 {
}
.me2 {
color:#000;
}
/* brackets */
.br0 {
color:#fff;
}
/* strings */
.st0 {
color:#8F9657;
}
/* keywords */
.kw1 {
color: #CDA869;
}
.kw2 {
color:#F9EE98;
}
.kw3 {
color:#505e80;
}
/* numbers */
.nu0 {
color:#CF6745;
}
/* vars */
.re0 {
color:#7587A6;
}
/*
* CSS selectors
*****************/
/* classnames */
[lang=css] .kw2,
.css .kw2 {
color:#F9EE7E;
}
.re1 {
color: #96703D;
}
/* px values */
[lang=css] .re3,
.css .re3 {
color:#CA7840;
}
/*
* Javascript
****************/
[lang=javascript] .me1,
.javascript .me1 {
color:#505e80;
}

View File

@ -1,148 +0,0 @@
/* @override http://localhost/mark_story2/site/css/geshi.css */
/**
* GeSHi CSS Inspired by TextMate
* Theme Vibrant Ink
*
* Copyright 2008 Mark Story
*
* This work is licensed under the Creative Commons Attribution-Share Alike 2.5 Canada License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/ca/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
* @copyright Copyright 2008, Mark Story.
* @link http://mark-story.com
* @license http://creativecommons.org/licenses/by-sa/2.5/ca/
*/
/*
* Global geshi styles
**********************/
#main pre {
line-height: 1.5em;
font-size: 10px;
white-space: normal;
padding: 0;
background: #000;
border: 1px solid #222;
}
pre ol {
list-style: decimal;
list-style-position: outside;
padding: 0;
margin: 0;
}
#main pre ol li {
margin: 0 0 0 35px;
padding: 0;
color: #fff;
clear: none;
}
pre ol li div {
/*color: #F26100;*/
color: #D2C0B4;
}
/* Line highlights */
.li1 {
background: #030303;
}
/* comments */
.co1,
.coMULTI {
color:#7830CC;
}
/* methods */
.me1{
color:#fff;
}
.me0 {
}
.me2 {
color:#000;
}
/* brackets */
.br0 {
color:#fff;
}
/* strings */
.st0 {
color:#52F700;
}
/* keywords */
.kw1 {
color: #C6C765;
}
.kw2 {
color:#FFC500;
}
.kw3 {
color:#505e80;
}
/* numbers */
.nu0 {
color:#319994;
}
/* vars */
.re0 {
color:#fff;
}
/*
* CSS selectors
*****************/
/* classnames */
[lang=css] .kw2,
.css .kw2 {
color:#fff;
}
[lang=css] .kw1,
.css .kw1 {
color:#999966;
}
[lang=css] .re0,
.css .re0 {
color: #F26100;
}
.re1 {
color: #96703D;
}
/* px values */
[lang=css] .re3,
.css .re3 {
color:#fff;
}
/*
* Python
****************/
[lang=python] ol li div,
.python ol li div {
color: #fff;
}
[lang=python] .kw1,
.python .kw1 {
color:#F26100;
}
/*
* Javascript
****************/
[lang=javascript] .me1,
.javascript .me1 {
color:#fff;
}
pre[lang=javascript] ol li div,
.javascript ol li div {
color: #fff;
}

View File

@ -0,0 +1,121 @@
/**
* okaidia theme for JavaScript, CSS and HTML
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
* @author ocodia
*/
code[class*="language-"],
pre[class*="language-"] {
color: #f8f8f2;
background: none;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
border-radius: 0.3em;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #272822;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #f8f8f2;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
color: #f92672;
}
.token.boolean,
.token.number {
color: #ae81ff;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #a6e22e;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: #f8f8f2;
}
.token.atrule,
.token.attr-value,
.token.function {
color: #e6db74;
}
.token.keyword {
color: #66d9ef;
}
.token.regex,
.token.important {
color: #fd971f;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

View File

@ -0,0 +1,148 @@
/*
Solarized Color Schemes originally by Ethan Schoonover
http://ethanschoonover.com/solarized
Ported for PrismJS by Hector Matos
Website: https://krakendev.io
Twitter Handle: https://twitter.com/allonsykraken)
*/
/*
SOLARIZED HEX
--------- -------
base03 #002b36
base02 #073642
base01 #586e75
base00 #657b83
base0 #839496
base1 #93a1a1
base2 #eee8d5
base3 #fdf6e3
yellow #b58900
orange #cb4b16
red #dc322f
magenta #d33682
violet #6c71c4
blue #268bd2
cyan #2aa198
green #859900
*/
code[class*="language-"],
pre[class*="language-"] {
color: #657b83; /* base00 */
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
background: #073642; /* base02 */
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
background: #073642; /* base02 */
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
border-radius: 0.3em;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background-color: #fdf6e3; /* base3 */
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #93a1a1; /* base1 */
}
.token.punctuation {
color: #586e75; /* base01 */
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #268bd2; /* blue */
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.url,
.token.inserted {
color: #2aa198; /* cyan */
}
.token.entity {
color: #657b83; /* base00 */
background: #eee8d5; /* base2 */
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #859900; /* green */
}
.token.function {
color: #b58900; /* yellow */
}
.token.regex,
.token.important,
.token.variable {
color: #cb4b16; /* orange */
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

467
web/app/css/prism.css Normal file
View File

@ -0,0 +1,467 @@
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+actionscript+c+aspnet+bash+cpp+csharp+css-extras+diff+perl+php+php-extras+python+sql+yaml&plugins=line-highlight+line-numbers+autolinker+previewer-base+previewer-color+previewer-gradient+previewer-easing+previewer-time+previewer-angle */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #a67f59;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
pre[data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
.line-highlight {
position: absolute;
left: 0;
right: 0;
padding: inherit 0;
margin-top: 1em; /* Same as .prisms padding-top */
background: hsla(24, 20%, 50%,.08);
background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
pointer-events: none;
line-height: inherit;
white-space: pre;
}
.line-highlight:before,
.line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%,.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
}
.line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}
pre.line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre.line-numbers > code {
position: relative;
white-space: inherit;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
pointer-events: none;
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}
.token a {
color: inherit;
}
.prism-previewer,
.prism-previewer:before,
.prism-previewer:after {
position: absolute;
pointer-events: none;
}
.prism-previewer,
.prism-previewer:after {
left: 50%;
}
.prism-previewer {
margin-top: -48px;
width: 32px;
height: 32px;
margin-left: -16px;
opacity: 0;
-webkit-transition: opacity .25s;
-o-transition: opacity .25s;
transition: opacity .25s;
}
.prism-previewer.flipped {
margin-top: 0;
margin-bottom: -48px;
}
.prism-previewer:before,
.prism-previewer:after {
content: '';
position: absolute;
pointer-events: none;
}
.prism-previewer:before {
top: -5px;
right: -5px;
left: -5px;
bottom: -5px;
border-radius: 10px;
border: 5px solid #fff;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5) inset, 0 0 10px rgba(0, 0, 0, 0.75);
}
.prism-previewer:after {
top: 100%;
width: 0;
height: 0;
margin: 5px 0 0 -7px;
border: 7px solid transparent;
border-color: rgba(255, 0, 0, 0);
border-top-color: #fff;
}
.prism-previewer.flipped:after {
top: auto;
bottom: 100%;
margin-top: 0;
margin-bottom: 5px;
border-top-color: rgba(255, 0, 0, 0);
border-bottom-color: #fff;
}
.prism-previewer.active {
opacity: 1;
}
.prism-previewer-color {
background-image: linear-gradient(45deg, #bbb 25%, transparent 25%, transparent 75%, #bbb 75%, #bbb), linear-gradient(45deg, #bbb 25%, #eee 25%, #eee 75%, #bbb 75%, #bbb);
background-size: 10px 10px;
background-position: 0 0, 5px 5px;
}
.prism-previewer-color:before {
background-color: inherit;
background-clip: padding-box;
}
.prism-previewer-gradient {
background-image: linear-gradient(45deg, #bbb 25%, transparent 25%, transparent 75%, #bbb 75%, #bbb), linear-gradient(45deg, #bbb 25%, #eee 25%, #eee 75%, #bbb 75%, #bbb);
background-size: 10px 10px;
background-position: 0 0, 5px 5px;
width: 64px;
margin-left: -32px;
}
.prism-previewer-gradient:before {
content: none;
}
.prism-previewer-gradient div {
position: absolute;
top: -5px;
left: -5px;
right: -5px;
bottom: -5px;
border-radius: 10px;
border: 5px solid #fff;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5) inset, 0 0 10px rgba(0, 0, 0, 0.75);
}
.prism-previewer-easing {
margin-top: -76px;
margin-left: -30px;
width: 60px;
height: 60px;
background: #333;
}
.prism-previewer-easing.flipped {
margin-bottom: -116px;
}
.prism-previewer-easing svg {
width: 60px;
height: 60px;
}
.prism-previewer-easing circle {
fill: hsl(200, 10%, 20%);
stroke: white;
}
.prism-previewer-easing path {
fill: none;
stroke: white;
stroke-linecap: round;
stroke-width: 4;
}
.prism-previewer-easing line {
stroke: white;
stroke-opacity: 0.5;
stroke-width: 2;
}
@-webkit-keyframes prism-previewer-time {
0% {
stroke-dasharray: 0, 500;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100, 500;
stroke-dashoffset: 0;
}
100% {
stroke-dasharray: 0, 500;
stroke-dashoffset: -100;
}
}
@-o-keyframes prism-previewer-time {
0% {
stroke-dasharray: 0, 500;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100, 500;
stroke-dashoffset: 0;
}
100% {
stroke-dasharray: 0, 500;
stroke-dashoffset: -100;
}
}
@-moz-keyframes prism-previewer-time {
0% {
stroke-dasharray: 0, 500;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100, 500;
stroke-dashoffset: 0;
}
100% {
stroke-dasharray: 0, 500;
stroke-dashoffset: -100;
}
}
@keyframes prism-previewer-time {
0% {
stroke-dasharray: 0, 500;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100, 500;
stroke-dashoffset: 0;
}
100% {
stroke-dasharray: 0, 500;
stroke-dashoffset: -100;
}
}
.prism-previewer-time:before {
border-radius: 50%;
background: #fff;
}
.prism-previewer-time:after {
margin-top: 4px;
}
.prism-previewer-time svg {
width: 32px;
height: 32px;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}
.prism-previewer-time circle {
fill: transparent;
stroke: hsl(200, 10%, 20%);
stroke-opacity: 0.9;
stroke-width: 32;
stroke-dasharray: 0, 500;
stroke-dashoffset: 0;
-webkit-animation: prism-previewer-time linear infinite 3s;
-moz-animation: prism-previewer-time linear infinite 3s;
-o-animation: prism-previewer-time linear infinite 3s;
animation: prism-previewer-time linear infinite 3s;
}
.prism-previewer-angle:before {
border-radius: 50%;
background: #fff;
}
.prism-previewer-angle:after {
margin-top: 4px;
}
.prism-previewer-angle svg {
width: 32px;
height: 32px;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}
.prism-previewer-angle[data-negative] svg {
-webkit-transform: scaleX(-1) rotate(-90deg);
-moz-transform: scaleX(-1) rotate(-90deg);
-ms-transform: scaleX(-1) rotate(-90deg);
-o-transform: scaleX(-1) rotate(-90deg);
transform: scaleX(-1) rotate(-90deg);
}
.prism-previewer-angle circle {
fill: transparent;
stroke: hsl(200, 10%, 20%);
stroke-opacity: 0.9;
stroke-width: 32;
stroke-dasharray: 0, 500;
}

View File

@ -26,54 +26,24 @@ body {
margin-right: 4px;
}
pre {
background: #222;
border: #222;
color: #ddd;
#viewer pre, #viewer code, #revisions pre, #revisions code {
background: none !important;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
pre ol {
padding-left: 50px !important;
}
pre li:hover {
background: #444;
border: 0;
}
.panel-heading .actions {
margin-top: -5px;
}
div.diff {
.diff {
display: none;
}
.de1 {
padding-left: 5px;
padding-right: 5px;
}
.li1 {
background: #333;
}
.re8 {
color: #52F700;
}
.kw3 {
color: #C6C765;
}
#viewer .syntaxhighlighter td {
vertical-align: top !important;
}
#options {
margin-bottom: 17px;
}

View File

@ -16,54 +16,24 @@
margin-right: 4px;
}
pre {
background: #222;
border: #222;
color: #ddd;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
pre ol {
padding-left: 50px !important;
}
pre li:hover {
background: #444;
pre, code {
background: none !important;
white-space: pre-wrap !important;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap !important;
white-space: -o-pre-wrap !important;
word-wrap: break-word !important;
border: 0;
}
.panel-heading .actions {
margin-top: -5px;
}
div.diff {
.diff {
display: none;
}
.de1 {
padding-left: 5px;
padding-right: 5px;
}
.li1 {
background: #333;
}
.re8 {
color: #52F700;
}
.kw3 {
color: #C6C765;
}
#viewer .syntaxhighlighter td {
vertical-align: top !important;
}
#options {
margin-bottom: 17px;
}

View File

@ -138,7 +138,7 @@ var getKey = function() {
}
var viewerEvents = function() {
var $render = $('.syntaxhighlighter');
var $render = $('#viewer code[data-cipher]');
$(document).ready(function() {
var key = getKey();
@ -163,7 +163,8 @@ var viewerEvents = function() {
});
$render.text(decrypted.toString(CryptoJS.enc.Utf8));
SyntaxHighlighter.all();
$render.attr('class', $render.data('class'));
Prism.highlightAll();
to = ' data-key="#key=' + key + '" ';
} else {

29
web/app/js/prism.js Normal file

File diff suppressed because one or more lines are too long