Syntax highlighter: replace CodeRay with Rouge (#24681).

Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17532 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2018-09-29 06:57:40 +00:00
parent bd2ee802c0
commit eb1e6d8c26
10 changed files with 141 additions and 166 deletions

View File

@@ -453,10 +453,10 @@ jsToolBar.prototype.resizeDragStop = function(event) {
/* Code highlighting menu */
jsToolBar.prototype.precodeMenu = function(fn){
var codeRayLanguages = ["c", "clojure", "cpp", "css", "delphi", "diff", "erb", "go", "groovy", "haml", "html", "java", "javascript", "json", "lua", "php", "python", "ruby", "sass", "sql", "taskpaper", "text", "xml", "yaml"];
var hlLanguages = ["c", "clojure", "cpp", "css", "diff", "erb", "go", "groovy", "haml", "html", "java", "javascript", "json", "lua", "pascal", "php", "python", "ruby", "sass", "sql", "text", "xml", "yaml"];
var menu = $("<ul style='position:absolute;'></ul>");
for (var i = 0; i < codeRayLanguages.length; i++) {
$("<li></li>").text(codeRayLanguages[i]).appendTo(menu).mousedown(function(){
for (var i = 0; i < hlLanguages.length; i++) {
$("<li></li>").text(hlLanguages[i]).appendTo(menu).mousedown(function(){
fn($(this).text());
});
}

View File

@@ -1407,102 +1407,77 @@ img.filecontent.image {background-image: url(../images/transparent.png);}
.ui-datepicker-title select {width:70px !important; margin-top:-2px !important; margin-right:4px !important;}
/************* CodeRay styles *************/
.syntaxhl div {display: inline;}
.syntaxhl .code pre { overflow: auto }
.syntaxhl .annotation { color:#007 }
.syntaxhl .attribute-name { color:#b48 }
.syntaxhl .attribute-value { color:#700 }
.syntaxhl .binary { color:#549 }
.syntaxhl .binary .char { color:#325 }
.syntaxhl .binary .delimiter { color:#325 }
.syntaxhl .char { color:#D20 }
.syntaxhl .char .content { color:#D20 }
.syntaxhl .char .delimiter { color:#710 }
.syntaxhl .class { color:#B06; font-weight:bold }
.syntaxhl .class-variable { color:#369 }
.syntaxhl .color { color:#0A0 }
.syntaxhl .comment { color:#777 }
.syntaxhl .comment .char { color:#444 }
.syntaxhl .comment .delimiter { color:#444 }
.syntaxhl .constant { color:#036; font-weight:bold }
.syntaxhl .decorator { color:#B0B }
.syntaxhl .definition { color:#099; font-weight:bold }
.syntaxhl .delimiter { color:black }
.syntaxhl .directive { color:#088; font-weight:bold }
.syntaxhl .docstring { color:#D42; }
.syntaxhl .doctype { color:#34b }
.syntaxhl .done { text-decoration: line-through; color: gray }
.syntaxhl .entity { color:#800; font-weight:bold }
.syntaxhl .error { color:#F00; background-color:#FAA }
.syntaxhl .escape { color:#666 }
.syntaxhl .exception { color:#C00; font-weight:bold }
.syntaxhl .float { color:#60E }
.syntaxhl .function { color:#06B; font-weight:bold }
.syntaxhl .function .delimiter { color:#059 }
.syntaxhl .function .content { color:#037 }
.syntaxhl .global-variable { color:#d70 }
.syntaxhl .hex { color:#02b }
.syntaxhl .id { color:#33D; font-weight:bold }
.syntaxhl .include { color:#B44; font-weight:bold }
.syntaxhl .inline { background-color: hsla(0,0%,0%,0.07); color: black }
.syntaxhl .inline-delimiter { font-weight: bold; color: #666 }
.syntaxhl .instance-variable { color:#33B }
.syntaxhl .integer { color:#00D }
.syntaxhl .imaginary { color:#f00 }
.syntaxhl .important { color:#D00 }
.syntaxhl .key { color: #606 }
.syntaxhl .key .char { color: #60f }
.syntaxhl .key .delimiter { color: #404 }
.syntaxhl .keyword { color:#080; font-weight:bold }
.syntaxhl .label { color:#970; font-weight:bold }
.syntaxhl .local-variable { color:#950 }
.syntaxhl .map .content { color:#808 }
.syntaxhl .map .delimiter { color:#40A}
.syntaxhl .map { background-color:hsla(200,100%,50%,0.06); }
.syntaxhl .namespace { color:#707; font-weight:bold }
.syntaxhl .octal { color:#40E }
.syntaxhl .operator { }
.syntaxhl .predefined { color:#369; font-weight:bold }
.syntaxhl .predefined-constant { color:#069 }
.syntaxhl .predefined-type { color:#0a8; font-weight:bold }
.syntaxhl .preprocessor { color:#579 }
.syntaxhl .pseudo-class { color:#00C; font-weight:bold }
.syntaxhl .regexp { background-color:hsla(300,100%,50%,0.06); }
.syntaxhl .regexp .content { color:#808 }
.syntaxhl .regexp .delimiter { color:#404 }
.syntaxhl .regexp .modifier { color:#C2C }
.syntaxhl .reserved { color:#080; font-weight:bold }
.syntaxhl .shell { background-color:hsla(120,100%,50%,0.06); }
.syntaxhl .shell .content { color:#2B2 }
.syntaxhl .shell .delimiter { color:#161 }
.syntaxhl .string { background-color:hsla(0,100%,50%,0.05); }
.syntaxhl .string .char { color: #b0b }
.syntaxhl .string .content { color: #D20 }
.syntaxhl .string .delimiter { color: #710 }
.syntaxhl .string .modifier { color: #E40 }
.syntaxhl .symbol { color:#A60 }
.syntaxhl .symbol .content { color:#A60 }
.syntaxhl .symbol .delimiter { color:#740 }
.syntaxhl .tag { color:#070; font-weight:bold }
.syntaxhl .type { color:#339; font-weight:bold }
.syntaxhl .value { color: #088 }
.syntaxhl .variable { color:#037 }
.syntaxhl .insert { background: hsla(120,100%,50%,0.12) }
.syntaxhl .delete { background: hsla(0,100%,50%,0.12) }
.syntaxhl .change { color: #bbf; background: #007 }
.syntaxhl .head { color: #f8f; background: #505 }
.syntaxhl .head .filename { color: white; }
.syntaxhl .delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; }
.syntaxhl .insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; }
.syntaxhl .insert .insert { color: #0c0; background:transparent; font-weight:bold }
.syntaxhl .delete .delete { color: #c00; background:transparent; font-weight:bold }
.syntaxhl .change .change { color: #88f }
.syntaxhl .head .head { color: #f4f }
/************* Rouge styles *************/
/* generated by: pygmentize -f html -a .syntaxhl -S colorful */
.syntaxhl .hll { background-color: #ffffcc }
.syntaxhl { background: #fafafa; }
.syntaxhl .c { color: #888888 } /* Comment */
.syntaxhl .err { color: #FF0000; background-color: #FFAAAA } /* Error */
.syntaxhl .k { color: #008800; font-weight: bold } /* Keyword */
.syntaxhl .o { color: #333333 } /* Operator */
.syntaxhl .ch { color: #888888 } /* Comment.Hashbang */
.syntaxhl .cm { color: #888888 } /* Comment.Multiline */
.syntaxhl .cp { color: #557799 } /* Comment.Preproc */
.syntaxhl .cpf { color: #888888 } /* Comment.PreprocFile */
.syntaxhl .c1 { color: #888888 } /* Comment.Single */
.syntaxhl .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
.syntaxhl .gd { color: #A00000 } /* Generic.Deleted */
.syntaxhl .ge { font-style: italic } /* Generic.Emph */
.syntaxhl .gr { color: #FF0000 } /* Generic.Error */
.syntaxhl .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.syntaxhl .gi { color: #00A000 } /* Generic.Inserted */
.syntaxhl .go { color: #888888 } /* Generic.Output */
.syntaxhl .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.syntaxhl .gs { font-weight: bold } /* Generic.Strong */
.syntaxhl .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.syntaxhl .gt { color: #0044DD } /* Generic.Traceback */
.syntaxhl .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.syntaxhl .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.syntaxhl .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.syntaxhl .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */
.syntaxhl .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.syntaxhl .kt { color: #333399; font-weight: bold } /* Keyword.Type */
.syntaxhl .m { color: #6600EE; font-weight: bold } /* Literal.Number */
.syntaxhl .s { background-color: #fff0f0 } /* Literal.String */
.syntaxhl .na { color: #0000CC } /* Name.Attribute */
.syntaxhl .nb { color: #007020 } /* Name.Builtin */
.syntaxhl .nc { color: #BB0066; font-weight: bold } /* Name.Class */
.syntaxhl .no { color: #003366; font-weight: bold } /* Name.Constant */
.syntaxhl .nd { color: #555555; font-weight: bold } /* Name.Decorator */
.syntaxhl .ni { color: #880000; font-weight: bold } /* Name.Entity */
.syntaxhl .ne { color: #FF0000; font-weight: bold } /* Name.Exception */
.syntaxhl .nf { color: #0066BB; font-weight: bold } /* Name.Function */
.syntaxhl .nl { color: #997700; font-weight: bold } /* Name.Label */
.syntaxhl .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
.syntaxhl .nt { color: #007700 } /* Name.Tag */
.syntaxhl .nv { color: #996633 } /* Name.Variable */
.syntaxhl .ow { color: #000000; font-weight: bold } /* Operator.Word */
.syntaxhl .w { color: #bbbbbb } /* Text.Whitespace */
.syntaxhl .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */
.syntaxhl .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */
.syntaxhl .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */
.syntaxhl .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.syntaxhl .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */
.syntaxhl .sa { background-color: #fff0f0 } /* Literal.String.Affix */
.syntaxhl .sb { background-color: #fff0f0 } /* Literal.String.Backtick */
.syntaxhl .sc { color: #0044DD } /* Literal.String.Char */
.syntaxhl .dl { background-color: #fff0f0 } /* Literal.String.Delimiter */
.syntaxhl .sd { color: #DD4422 } /* Literal.String.Doc */
.syntaxhl .s2 { background-color: #fff0f0 } /* Literal.String.Double */
.syntaxhl .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
.syntaxhl .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */
.syntaxhl .si { background-color: #eeeeee } /* Literal.String.Interpol */
.syntaxhl .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */
.syntaxhl .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
.syntaxhl .s1 { background-color: #fff0f0 } /* Literal.String.Single */
.syntaxhl .ss { color: #AA6600 } /* Literal.String.Symbol */
.syntaxhl .bp { color: #007020 } /* Name.Builtin.Pseudo */
.syntaxhl .fm { color: #0066BB; font-weight: bold } /* Name.Function.Magic */
.syntaxhl .vc { color: #336699 } /* Name.Variable.Class */
.syntaxhl .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */
.syntaxhl .vi { color: #3333BB } /* Name.Variable.Instance */
.syntaxhl .vm { color: #996633 } /* Name.Variable.Magic */
.syntaxhl .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/***** Media print specific styles *****/
@media print {

View File

@@ -373,9 +373,6 @@ td.username img.gravatar {margin:0 0 0 0.5em; }
/* Custom JQuery styles */
.ui-datepicker-title select {margin-left:4px !important; margin-right:0 !important;}
/************* CodeRay styles *************/
.syntaxhl .line-numbers {margin:0px 0px 0px 5px;}
/***** Media print specific styles *****/
@media print {
}