You are on page 1of 3

/**

* Code Syntax Highlighter.


* Version 1.5.2
* Copyright (C) 2004-2008 Alex Gorbatchev
* http://www.dreamprojections.com/syntaxhighlighter/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
dp.sh.Brushes.CSS = function()
{
var keywords = 'ascent azimuth background-attachment background-color b
ackground-image background-position ' +
'background-repeat background baseline b
box 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 bor
der-bottom-style border-left-style border-top-width border-right-width ' +
'border-bottom-width border-left-width b
order-width border 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-a
djust font-family font-size font-stretch font-style font-variant font-weight fon
t ' +
'height letter-spacing line-height liststyle-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 or
phans ' +
'outline-color outline-style outline-wid
th outline overflow padding-top padding-right padding-bottom padding-left paddin
g page ' +
'page-break-after page-break-before page
-break-inside pause pause-after pause-before pitch pitch-range play-during posit
ion ' +
'quotes richness size slope src speak-he
ader speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
'table-layout text-align 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 condens
ed '+

'continuous counter counters crop cross


crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted
double '+
'embed embossed e-resize expanded extracondensed extra-expanded fantasy far-left far-right fast faster fixed format fuc
hsia '+
'gray green groove handheld hebrew help
hidden hide high higher icon inline-table inline inset inside invert italic '+
'justify landscape large larger left-sid
e left leftwards level lighter lime line-through list-item local loud lower-alph
a '+
'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-o
pen-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quo
te outset '+
'outside overline pointer portrait pre p
rint projection purple red relative repeat repeat-x repeat-y rgb ridge right rig
ht-side '+
'rightwards rtl run-in screen scroll sem
i-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-resiz
e '+
'table-caption table-cell table-column t
able-column-group table-footer-group table-header-group table-row table-row-grou
p teal '+
'text-bottom text-top thick thin top tra
nsparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase u
pper-latin '+
'upper-roman url visible wait white wide
r w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xxsmall yellow';
var fonts =
'[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]
elvetica [sS]ans-serif [sS]erif';

css:
css:
css:
css:
css:
css:
css:
css:
css:

this.regexList = [
{ regex: dp.sh.RegexLib.MultiLineCComments,
'comment' },
// multiline comments
{ regex: dp.sh.RegexLib.DoubleQuotedString,
'string' },
// double quoted strings
{ regex: dp.sh.RegexLib.SingleQuotedString,
'string' },
// single quoted strings
{ regex: new RegExp('\\#[a-zA-Z0-9]{3,6}', 'g'),
'value' },
// html colors
{ regex: new RegExp('(-?\\d+)(\.\\d+)?(px|em|pt|\:|\%|)', 'g'),
'value' },
// sizes
{ regex: new RegExp('!important', 'g'),
'important' },
// !important
{ regex: new RegExp(this.GetKeywordsCSS(keywords), 'gm'),
'keyword' },
// keywords
{ regex: new RegExp(this.GetValuesCSS(values), 'g'),
'value' },
// values
{ regex: new RegExp(this.GetValuesCSS(fonts), 'g'),
'value' }
// fonts
];
this.CssClass = 'dp-css';

this.Style =

'.dp-css .value { color: black; }' +


'.dp-css .important { color: red; }';

};
dp.sh.Highlighter.prototype.GetKeywordsCSS = function(str)
{
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)'
) + '(?=:)\\b';
};
dp.sh.Highlighter.prototype.GetValuesCSS = function(str)
{
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
};
dp.sh.Brushes.CSS.prototype
dp.sh.Brushes.CSS.Aliases

= new dp.sh.Highlighter();
= ['css'];

You might also like