Use a javascript based syntax highlighter.

This commit is contained in:
Chris Eppstein 2010-11-15 14:41:45 -08:00
parent 897f307051
commit 3699065086
19 changed files with 672 additions and 376 deletions

View File

@ -27,7 +27,7 @@ end
compile '/examples/*/' do compile '/examples/*/' do
filter :haml, :ugly => true filter :haml, :ugly => true
filter :highlight if ENV['SYNTAX'] filter :highlight
layout 'example' layout 'example'
end end
@ -43,7 +43,7 @@ end
compile '/reference/*/' do compile '/reference/*/' do
filter :haml, :ugly => true filter :haml, :ugly => true
filter :highlight if ENV['SYNTAX'] filter :highlight
layout item[:layout] || 'main' layout item[:layout] || 'main'
end end

View File

@ -0,0 +1,17 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d<c.9;d++)i[c[d]]=a}2 o(c){1 a=r.H("J"),d=3;a.K=c;a.M="L/t";a.G="t";a.u=a.v=2(){6(!d&&(!8.7||8.7=="F"||8.7=="z")){d=q;e[c]=q;a:{4(1 p y e)6(e[p]==3)B a;j&&5.C(k)}a.u=a.v=x;a.D.O(a)}};r.N.R(a)}1 f=Q,l=h.P(),i={},e={},j=3,k=x,b;5.T=2(c){k=c;j=q};4(b=0;b<f.9;b++){1 m=f[b].w?f[b]:f[b].S(/\\s+/),g=m.w();n(m,g)}4(b=0;b<l.9;b++)6(g=i[l[b].E.A]){e[g]=3;o(g)}}})();',56,56,'|var|function|false|for|SyntaxHighlighter|if|readyState|this|length|||||||||||||||||true|document||javascript|onload|onreadystatechange|pop|null|in|complete|brush|break|highlight|parentNode|params|loaded|language|createElement|autoloader|script|src|text|type|body|removeChild|findElements|arguments|appendChild|split|all'.split('|'),0,{}))

View File

@ -0,0 +1,91 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
function getKeywordsCSS(str)
{
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
};
function getValuesCSS(str)
{
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
};
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
{ regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes
{ regex: /!important/g, css: 'color3' }, // !important
{ regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
{ regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
];
this.forHtmlScript({
left: /(&lt;|<)\s*style.*?(&gt;|>)/gi,
right: /(&lt;|<)\/\s*style\s*(&gt;|>)/gi
});
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['css'];
SyntaxHighlighter.brushes.CSS = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

View File

@ -0,0 +1,94 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
function getKeywordsCSS(str)
{
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
};
function getValuesCSS(str)
{
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
};
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double '+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
var statements = '!important !default';
var preprocessor = '@import @extend @debug @warn @if @for @while @mixin @include';
var r = SyntaxHighlighter.regexLib;
this.regexList = [
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: r.singleLineCComments, css: 'comments' }, // singleline comments
{ regex: r.doubleQuotedString, css: 'string' }, // double quoted strings
{ regex: r.singleQuotedString, css: 'string' }, // single quoted strings
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
{ regex: /\b(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)\b/g, css: 'value' }, // sizes
{ regex: /\$\w+/g, css: 'variable' }, // variables
{ regex: new RegExp(this.getKeywords(statements), 'g'), css: 'color3' }, // statements
{ regex: new RegExp(this.getKeywords(preprocessor), 'g'), css: 'preprocessor' }, // preprocessor
{ regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
{ regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
];
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['sass', 'scss'];
SyntaxHighlighter.brushes.Sass = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

View File

@ -0,0 +1,91 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
function getKeywordsSCSS(str)
{
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
};
function getValuesSCSS(str)
{
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
};
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
{ regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes
{ regex: /!important/g, css: 'color3' }, // !important
{ regex: new RegExp(getKeywordsSCSS(keywords), 'gm'), css: 'keyword' }, // keywords
{ regex: new RegExp(getValuesSCSS(values), 'g'), css: 'value' }, // values
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
];
this.forHtmlScript({
left: /(&lt;|<)\s*style.*?(&gt;|>)/gi,
right: /(&lt;|<)\/\s*style\s*(&gt;|>)/gi
});
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['scss'];
SyntaxHighlighter.brushes.SCSS = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

17
doc-src/assets/javascripts/shCore.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
@import "syntax/coderay";
@import "syntax/pygments";

View File

@ -280,7 +280,6 @@ aside[role="sidebar"] + article
@import examples @import examples
@import sidebar @import sidebar
@import specifics @import specifics
@import syntax
/* @group OVERRIDES by page /* @group OVERRIDES by page

View File

@ -1,211 +0,0 @@
.CodeRay {
.debug {
color: white !important;
background: blue !important; }
.af {
color: #0000cc; }
.an {
color: #000077; }
.at {
color: #ff0088; }
.av {
color: #770000; }
.aw {
color: #cc0000; }
.bi {
color: #550099;
font-weight: bold; }
.c {
color: #888888; }
.ch {
color: #0044dd;
.k {
color: #0044dd; }
.dl {
color: #003399; } }
.cl {
color: #bb0066;
font-weight: bold; }
.cm {
color: #aa0088;
font-weight: bold; }
.co {
color: #003366;
font-weight: bold; }
.cr {
color: #00aa00; }
.cv {
color: #336699; }
.de {
color: #bb00bb; }
.df {
color: #009999;
font-weight: bold; }
.di {
color: #008888;
font-weight: bold; }
.dl {
color: black; }
.do {
color: #997700; }
.dt {
color: #3344bb; }
.ds {
color: #dd4422;
font-weight: bold; }
.e {
color: #666666;
font-weight: bold; }
.en {
color: #880000;
font-weight: bold; }
.er {
color: red;
background-color: #ffaaaa; }
.ex {
color: #cc0000;
font-weight: bold; }
.fl {
color: #6600ee;
font-weight: bold; }
.fu {
color: #0066bb;
font-weight: bold; }
.gv {
color: #dd7700;
font-weight: bold; }
.hx {
color: #005588;
font-weight: bold; }
.i {
color: #0000dd;
font-weight: bold; }
.ic {
color: #bb4444;
font-weight: bold; }
.il {
background: #dddddd;
color: black;
.il {
background: #cccccc;
.il {
background: #bbbbbb; } }
.idl {
background: #dddddd;
font-weight: bold;
color: #666666; } }
.idl {
background-color: #bbbbbb;
font-weight: bold;
color: #666666; }
.im {
color: red; }
.in {
color: #bb22bb;
font-weight: bold; }
.iv {
color: #3333bb; }
.la {
color: #997700;
font-weight: bold; }
.lv {
color: #996633; }
.oc {
color: #4400ee;
font-weight: bold; }
.of {
color: black;
font-weight: bold; }
.pc {
color: #003388;
font-weight: bold; }
.pd {
color: #336699;
font-weight: bold; }
.pp {
color: #557799; }
.ps {
color: #0000cc;
font-weight: bold; }
.pt {
color: #007744;
font-weight: bold; }
.r, .kw {
color: #008800;
font-weight: bold; }
.ke {
color: #880088;
.dl {
color: #660066; }
.ch {
color: #8800ff; } }
.vl {
color: #008888; }
.rx {
background-color: #fff0ff;
.k {
color: #880088; }
.dl {
color: #440044; }
.mod {
color: #cc22cc; }
.fu {
color: #440044;
font-weight: bold; } }
.s {
background-color: #fff0f0;
color: #dd2200;
.s {
background-color: #ffe0e0;
.s {
background-color: #ffd0d0; } }
.ch {
color: #bb00bb; }
.dl {
color: #771100; } }
.sh {
background-color: #f0fff0;
color: #22bb22;
.dl {
color: #116611; } }
.sy {
color: #aa6600;
.k {
color: #aa6600; }
.dl {
color: #663300; } }
.ta {
color: #007700; }
.tf {
color: #007700;
font-weight: bold; }
.ts {
color: #dd7700;
font-weight: bold; }
.ty {
color: #333399;
font-weight: bold; }
.v {
color: #003366; }
.xt {
color: #444444; }
.ins {
background: #aaffaa; }
.del {
background: #ffaaaa; }
.chg {
color: #aaaaff;
background: #000077; }
.head {
color: #ff88ff;
background: #550055; }
.ins .ins {
color: #008800;
font-weight: bold; }
.del .del {
color: #880000;
font-weight: bold; }
.chg .chg {
color: #6666ff; }
.head .head {
color: #ff44ff; } }

View File

@ -1,151 +0,0 @@
.highlight {
.hll {
background-color: #ffffcc; }
.c {
color: #606060;
font-style: italic; }
.err {
color: #f00000;
background-color: #f0a0a0; }
.k {
color: #208090;
font-weight: bold; }
.o {
color: #303030; }
.cm {
color: #606060;
font-style: italic; }
.cp {
color: #507090; }
.c1 {
color: #606060;
font-style: italic; }
.cs {
color: #c00000;
font-weight: bold;
font-style: italic; }
.gd {
color: #a00000; }
.ge {
font-style: italic; }
.gr {
color: red; }
.gh {
color: navy;
font-weight: bold; }
.gi {
color: #00a000; }
.go {
color: gray; }
.gp {
color: #c65d09;
font-weight: bold; }
.gs {
font-weight: bold; }
.gu {
color: purple;
font-weight: bold; }
.gt {
color: #0040d0; }
.kc, .kd, .kn {
color: #208090;
font-weight: bold; }
.kp {
color: #0080f0;
font-weight: bold; }
.kr {
color: #208090;
font-weight: bold; }
.kt {
color: #6060f0;
font-weight: bold; }
.m {
color: #6000e0;
font-weight: bold; }
.s {
background-color: #e0e0ff; }
.na {
color: #000070; }
.nb {
color: #007020; }
.nc {
color: #e090e0;
font-weight: bold; }
.no {
color: #50e0d0;
font-weight: bold; }
.nd {
color: #505050;
font-weight: bold; }
.ni {
color: maroon; }
.ne {
color: #f00000;
font-weight: bold; }
.nf {
color: #50e0d0;
font-weight: bold; }
.nl {
color: #907000;
font-weight: bold; }
.nn {
color: #0e84b5;
font-weight: bold; }
.nt {
color: #007000; }
.nv {
color: #003060; }
.ow {
color: black;
font-weight: bold; }
.w {
color: #bbbbbb; }
.mf {
color: #6000e0;
font-weight: bold; }
.mh {
color: #005080;
font-weight: bold; }
.mi {
color: #6060f0;
font-weight: bold; }
.mo {
color: #4000e0;
font-weight: bold; }
.sb {
background-color: #e0e0ff; }
.sc {
color: #8080f0; }
.sd {
color: #d04020; }
.s2 {
background-color: #e0e0ff; }
.se {
color: #606060;
font-weight: bold;
background-color: #e0e0ff; }
.sh {
background-color: #e0e0ff; }
.si {
background-color: #e0e0e0; }
.sx {
color: #f08080;
background-color: #e0e0ff; }
.sr {
color: black;
background-color: #e0e0ff; }
.s1 {
background-color: #e0e0ff; }
.ss {
color: #f0c080; }
.bp {
color: #007020; }
.vc {
color: #c0c0f0; }
.vg {
color: #f08040; }
.vi {
color: #a0a0f0; }
.il {
color: #6060f0;
font-weight: bold; } }

View File

@ -0,0 +1,120 @@
$background: white !default;
$line_alt1_background: $background !default;
$line_alt2_background: $background !default;
$line_highlighted_background: #e0e0e0 !default;
$line_highlighted_number: black !default;
$gutter_text: #afafaf !default;
$gutter_border_color: #6ce26c !default;
$gutter_border: 3px solid $gutter_border_color !default;
$toolbar_collapsed_a: #00f !default;
$toolbar_collapsed_a_hover: #f00 !default;
$toolbar_collapsed_background: #fff !default;
$toolbar_collapsed_border: 1px solid $gutter_border_color !default;
$toolbar_a: #fff !default;
$toolbar_a_hover: #000 !default;
$toolbar_background: $gutter_border_color !default;
$toolbar_border: none !default;
$code_plain: black !default;
$code_comments: #008200 !default;
$code_string: blue !default;
$code_keyword: #006699 !default;
$code_preprocessor: gray !default;
$code_variable: #aa7700 !default;
$code_value: #009900 !default;
$code_functions: #ff1493 !default;
$code_constants: #0066cc !default;
$code_script: $code_keyword !default;
$code_script_background: none !default;
$code_color1: gray !default;
$code_color2: #ff1493 !default;
$code_color3: red !default;
$caption_color: $code_plain !default;
// Interface elements.
.syntaxhighlighter {
background-color: $background !important;
// Highlighed line number
.line {
&.alt1 { background-color: $line_alt1_background !important; }
&.alt2 { background-color: $line_alt2_background !important; }
// Highlighed line
&.highlighted {
&.alt1, &.alt2 { background-color: $line_highlighted_background !important; }
&.number { color: $line_highlighted_number !important; }
}
}
table {
caption {
color: $caption_color !important;
}
}
// Add border to the lines
.gutter {
color: $gutter_text !important;
.line {
border-right: $gutter_border !important;
&.highlighted {
background-color: $gutter_border_color !important;
color: $background !important;
}
}
}
&.printing .line .content { border: none !important; }
&.collapsed {
overflow: visible !important;
.toolbar {
color: $toolbar_collapsed_a !important;
background: $toolbar_collapsed_background !important;
border: $toolbar_collapsed_border !important;
a {
color: $toolbar_collapsed_a !important;
&:hover { color: $toolbar_collapsed_a_hover !important; }
}
}
}
.toolbar {
color: $toolbar_a !important;
background: $toolbar_background !important;
border: $toolbar_border !important;
a {
color: $toolbar_a !important;
&:hover { color: $toolbar_a_hover !important; }
}
}
// Actual syntax highlighter colors.
.plain, .plain a { color: $code_plain !important; }
.comments, .comments a { color: $code_comments !important; }
.string, .string a { color: $code_string !important; }
.keyword { color: $code_keyword !important; }
.preprocessor { color: $code_preprocessor !important; }
.variable { color: $code_variable !important; }
.value { color: $code_value !important; }
.functions { color: $code_functions !important; }
.constants { color: $code_constants !important; }
.script {
font-weight: bold !important;
color: $code_script !important;
background-color: $code_script_background !important;
}
.color1, .color1 a { color: $code_color1 !important; }
.color2, .color2 a { color: $code_color2 !important; }
.color3, .color3 a { color: $code_color3 !important; }
}

View File

@ -0,0 +1,216 @@
@mixin round_corners_custom($top, $right, $bottom, $left) {
-moz-border-radius: $top $right $bottom $left !important;
-webkit-border-radius: $top $right $bottom $left !important;
}
@mixin round_corners($radius) {
@include round_corners_custom($radius, $radius, $radius, $radius);
}
.syntaxhighlighter {
a,
div,
code,
table,
table td,
table tr,
table tbody,
table thead,
table caption,
textarea {
@include round_corners(0);
background: none !important;
border: 0 !important;
bottom: auto !important;
float: none !important;
height: auto !important;
left: auto !important;
line-height: 1.1em !important;
margin: 0 !important;
outline: 0 !important;
overflow: visible !important;
padding: 0 !important;
position: static !important;
right: auto !important;
text-align: left !important;
top: auto !important;
vertical-align: baseline !important;
width: auto !important;
box-sizing: content-box !important;
font: {
family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
weight: normal !important;
style: normal !important;
size: 1em !important;
}
min: {
// For IE8, FF & WebKit
height: inherit !important;
// For IE7
height: auto !important;
}
}
}
.syntaxhighlighter {
width: 100% !important;
margin: 1em 0 1em 0 !important;
position: relative !important;
overflow: auto !important;
font-size: 1em !important;
&.source { overflow: hidden !important; }
// set up bold and italic
.bold { font-weight: bold !important; }
.italic { font-style: italic !important; }
.line { white-space: pre !important; }
// main table and columns
table {
width: 100% !important;
caption {
text-align: left !important;
padding: .5em 0 0.5em 1em !important;
}
td.code {
width: 100% !important;
.container {
position: relative !important;
textarea {
box-sizing: border-box !important;
position: absolute !important;
left: 0 !important;
top: 0 !important;
width: 100% !important;
height: 100% !important;
border: none !important;
background: white !important;
padding-left: 1em !important;
overflow: hidden !important;
white-space: pre !important;
}
}
}
// middle spacing between line numbers and lines
td.gutter .line {
text-align: right !important;
padding: 0 0.5em 0 1em !important;
}
td.code .line {
padding: 0 1em !important;
}
}
&.nogutter {
td.code {
.container textarea, .line { padding-left: 0em !important; }
}
}
&.show { display: block !important; }
// Adjust some properties when collapsed
&.collapsed {
table { display: none !important; }
.toolbar {
padding: 0.1em 0.8em 0em 0.8em !important;
font-size: 1em !important;
position: static !important;
width: auto !important;
height: auto !important;
span {
display: inline !important;
margin-right: 1em !important;
a {
padding: 0 !important;
display: none !important;
&.expandSource { display: inline !important; }
}
}
}
}
// Styles for the toolbar
.toolbar {
position: absolute !important;
right: 1px !important;
top: 1px !important;
width: 11px !important;
height: 11px !important;
font-size: 10px !important;
z-index: 10 !important;
span.title { display: inline !important; }
a {
display: block !important;
text-align: center !important;
text-decoration: none !important;
padding-top: 1px !important;
&.expandSource { display: none !important; }
}
}
&.ie {
font-size: .9em !important;
padding: 1px 0 1px 0 !important;
.toolbar {
line-height: 8px !important;
a {
padding-top: 0px !important;
}
}
}
// Print view.
// Colors are based on the default theme without background.
&.printing {
.line.alt1 .content,
.line.alt2 .content,
.line.highlighted .number,
.line.highlighted.alt1 .content,
.line.highlighted.alt2 .content { background: none !important; }
// Gutter line numbers
.line {
.number { color: #bbbbbb !important; }
// Add border to the lines
.content { color: black !important; }
}
// Toolbar when visible
.toolbar { display: none !important; }
a { text-decoration: none !important; }
.plain, .plain a { color: black !important; }
.comments, .comments a { color: #008200 !important; }
.string, .string a { color: blue !important; }
.keyword {
color: #006699 !important;
font-weight: bold !important;
}
.preprocessor { color: gray !important; }
.variable { color: #aa7700 !important; }
.value { color: #009900 !important; }
.functions { color: #ff1493 !important; }
.constants { color: #0066cc !important; }
.script { font-weight: bold !important; }
.color1, .color1 a { color: gray !important; }
.color2, .color2 a { color: #ff1493 !important; }
.color3, .color3 a { color: red !important; }
.break, .break a { color: black !important; }
}
}

View File

@ -0,0 +1,2 @@
@import "shCore.scss";
@import "shThemeDefault.scss";

View File

@ -0,0 +1,7 @@
// Default Syntax Highlighter theme.
@import "_theme_template.scss";
.syntaxhighlighter {
.keyword { font-weight: bold !important; }
}

View File

@ -9,6 +9,8 @@
#{@item[:title]} | Compass Documentation #{@item[:title]} | Compass Documentation
<!--[if !IE 6]><!--> <!--[if !IE 6]><!-->
%link{:charset => "utf-8", :href => "/docs/stylesheets/screen.css", :rel => "stylesheet", :type => "text/css"} %link{:charset => "utf-8", :href => "/docs/stylesheets/screen.css", :rel => "stylesheet", :type => "text/css"}
%link{:href => "/docs/stylesheets/syntax/shCore.css", :rel => "stylesheet", :type => "text/css"}
%link{:href => "/docs/stylesheets/syntax/shThemeDefault.css", :rel => "stylesheet", :type => "text/css"}
<!--<![endif]--> <!--<![endif]-->
/[if gte IE 7] /[if gte IE 7]
%link{:charset => "utf-8", :href => "/docs/stylesheets/ie.css", :rel => "stylesheet", :type => "text/css"} %link{:charset => "utf-8", :href => "/docs/stylesheets/ie.css", :rel => "stylesheet", :type => "text/css"}

View File

@ -35,5 +35,9 @@
%footer(role="contentinfo")= render "partials/footer" %footer(role="contentinfo")= render "partials/footer"
%script(src="/docs/javascripts/jquery-1.3.2.min.js") %script(src="/docs/javascripts/jquery-1.3.2.min.js")
%script(src="/docs/javascripts/fixups.js" deferred) %script(src="/docs/javascripts/fixups.js" deferred)
%script{:src => "/docs/javascripts/shCore.js", :type => "text/javascript"}
%script{:src => "/docs/javascripts/shBrushCss.js", :type => "text/javascript"}
%script{:src => "/docs/javascripts/shBrushSass.js", :type => "text/javascript"}
%script{:src => "/docs/javascripts/shBrushScss.js", :type => "text/javascript"}
= @item[:content_for_javascripts] = @item[:content_for_javascripts]
= render "partials/analytics" = render "partials/analytics"

View File

@ -16,3 +16,6 @@
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}()); }());
</script> </script>
<script type="text/javascript">
SyntaxHighlighter.all()
</script>

View File

@ -10,8 +10,10 @@
%h3.mixin{:id=>"mixin-#{mixin.name}"} %h3.mixin{:id=>"mixin-#{mixin.name}"}
%a.permalink{:href => "#mixin-#{mixin.name}"}= mixin_signature(mixin) %a.permalink{:href => "#mixin-#{mixin.name}"}= mixin_signature(mixin)
.mixin-source{:id=>"mixin-#{mixin.name}-source"} .mixin-source{:id=>"mixin-#{mixin.name}-source"}
%pre.source-code.sass.elided-code{:id=>"mixin-#{mixin.name}-sass"}= mixin.to_sass .elided-code{:id=>"mixin-#{mixin.name}-sass"}
%pre.source-code.scss.elided-code{:id=>"mixin-#{mixin.name}-scss"}= mixin.to_scss %pre.source-code.sass= mixin.to_sass
.elided-code{:id=>"mixin-#{mixin.name}-scss"}
%pre.source-code.scss= mixin.to_scss
.source-documentation .source-documentation
= format_doc(mixin.comment) = format_doc(mixin.comment)

View File

@ -26,14 +26,9 @@ class SyntaxHighlighterFilter < Nanoc3::Filter
def run(content, params={}) def run(content, params={})
doc = Nokogiri::HTML.fragment(content) doc = Nokogiri::HTML.fragment(content)
[:html, :css, :sass, :scss].each do |format| [:css, :sass, :scss].each do |format|
doc.css("pre.source-code.#{format}, code.#{format}").each do |el| doc.css("pre.source-code.#{format}, code.#{format}").each do |el|
new_element = Nokogiri.make(highlight(el.inner_text, format)) el.set_attribute("class", "brush: #{format} "+el.attribute("class").value)
new_element.set_attribute("class", new_element.attribute("class").value+" "+el.attribute("class").value)
if id = el.attribute("id")
new_element.set_attribute("id", id)
end
el.replace new_element
end end
end end
doc.to_s doc.to_s