Files
luos/gulliver/js/highlight/core/languages/www.js

186 lines
8.0 KiB
JavaScript
Raw Normal View History

2010-12-02 23:34:41 +00:00
var XML_COMMENT = {
className: 'comment',
begin: '<!--', end: '-->'
};
var XML_ATTR = {
className: 'attribute',
begin: ' [a-zA-Z]+=', end: '^',
contains: ['value']
};
var XML_VALUE = {
className: 'value',
begin: '"', end: '"'
};
LANGUAGES.xml = {
defaultMode: {
contains: ['pi', 'comment', 'cdata', 'tag']
},
case_insensitive: true,
modes: [
{
className: 'pi',
begin: '<\\?', end: '\\?>',
relevance: 10
},
XML_COMMENT,
{
className: 'cdata',
begin: '<\\!\\[CDATA\\[', end: '\\]\\]>'
},
{
className: 'tag',
begin: '</?', end: '>',
contains: ['title', 'tag_internal'],
relevance: 1.5
},
{
className: 'title',
begin: '[A-Za-z]+', end: '^',
relevance: 0
},
{
className: 'tag_internal',
begin: '^', endsWithParent: true,
contains: ['attribute'],
relevance: 0,
illegal: '[\\+\\.]'
},
XML_ATTR,
XML_VALUE
]
};//xml
var HTML_TAGS = {'code': 1, 'kbd': 1, 'font': 1, 'noscript': 1, 'style': 1, 'img': 1, 'title': 1, 'menu': 1, 'tt': 1, 'tr': 1, 'param': 1, 'li': 1, 'tfoot': 1, 'th': 1, 'input': 1, 'td': 1, 'dl': 1, 'blockquote': 1, 'fieldset': 1, 'big': 1, 'dd': 1, 'abbr': 1, 'optgroup': 1, 'dt': 1, 'button': 1, 'isindex': 1, 'p': 1, 'small': 1, 'div': 1, 'dir': 1, 'em': 1, 'frame': 1, 'meta': 1, 'sub': 1, 'bdo': 1, 'label': 1, 'acronym': 1, 'sup': 1, 'body': 1, 'xml': 1, 'basefont': 1, 'base': 1, 'br': 1, 'address': 1, 'strong': 1, 'legend': 1, 'ol': 1, 'script': 1, 'caption': 1, 's': 1, 'col': 1, 'h2': 1, 'h3': 1, 'h1': 1, 'h6': 1, 'h4': 1, 'h5': 1, 'table': 1, 'select': 1, 'noframes': 1, 'span': 1, 'area': 1, 'dfn': 1, 'strike': 1, 'cite': 1, 'thead': 1, 'head': 1, 'option': 1, 'form': 1, 'hr': 1, 'var': 1, 'link': 1, 'b': 1, 'colgroup': 1, 'ul': 1, 'applet': 1, 'del': 1, 'iframe': 1, 'pre': 1, 'frameset': 1, 'ins': 1, 'tbody': 1, 'html': 1, 'samp': 1, 'map': 1, 'object': 1, 'a': 1, 'xmlns': 1, 'center': 1, 'textarea': 1, 'i': 1, 'q': 1, 'u': 1};
var HTML_DOCTYPE = {
className: 'doctype',
begin: '<!DOCTYPE', end: '>',
relevance: 10
};
var HTML_ATTR = {
className: 'attribute',
begin: ' [a-zA-Z]+', end: '^'
};
var HTML_VALUE = {
className: 'value',
begin: '[a-zA-Z0-9]+', end: '^'
};
LANGUAGES.html = {
defaultMode: {
contains: ['tag', 'comment', 'doctype']
},
case_insensitive: true,
modes: [
XML_COMMENT,
HTML_DOCTYPE,
{
className: 'tag',
lexems: [IDENT_RE],
keywords: HTML_TAGS,
begin: '<[A-Za-z/]', end: '>',
contains: ['attribute'],
illegal: '[\\+\\.]'
},
XML_ATTR,
HTML_ATTR,
XML_VALUE,
HTML_VALUE
]
};//html
LANGUAGES.css = {
defaultMode: {
contains: ['id', 'class', 'attr_selector', 'rules', 'comment'],
keywords: HTML_TAGS,
lexems: [IDENT_RE],
illegal: '='
},
case_insensitive: true,
modes: [
{
className: 'id',
begin: '\\#[A-Za-z0-9_-]+', end: '^'
},
{
className: 'class',
begin: '\\.[A-Za-z0-9_-]+', end: '^',
relevance: 0
},
{
className: 'attr_selector',
begin: '\\[', end: '\\]',
illegal: '$'
},
{
className: 'rules',
begin: '{', end: '}',
lexems: ['[A-Za-z-]+'],
keywords: {'play-during': 1, 'counter-reset': 1, 'counter-increment': 1, 'min-height': 1, 'quotes': 1, 'border-top': 1, 'pitch': 1, 'font': 1, 'pause': 1, 'list-style-image': 1, 'border-width': 1, 'cue': 1, 'outline-width': 1, 'border-left': 1, 'elevation': 1, 'richness': 1, 'speech-rate': 1, 'border-bottom': 1, 'border-spacing': 1, 'background': 1, 'list-style-type': 1, 'text-align': 1, 'page-break-inside': 1, 'orphans': 1, 'page-break-before': 1, 'text-transform': 1, 'line-height': 1, 'padding-left': 1, 'font-size': 1, 'right': 1, 'word-spacing': 1, 'padding-top': 1, 'outline-style': 1, 'bottom': 1, 'content': 1, 'border-right-style': 1, 'padding-right': 1, 'border-left-style': 1, 'voice-family': 1, 'background-color': 1, 'border-bottom-color': 1, 'outline-color': 1, 'unicode-bidi': 1, 'max-width': 1, 'font-family': 1, 'caption-side': 1, 'border-right-width': 1, 'pause-before': 1, 'border-top-style': 1, 'color': 1, 'border-collapse': 1, 'border-bottom-width': 1, 'float': 1, 'height': 1, 'max-height': 1, 'margin-right': 1, 'border-top-width': 1, 'speak': 1, 'speak-header': 1, 'top': 1, 'cue-before': 1, 'min-width': 1, 'width': 1, 'font-variant': 1, 'border-top-color': 1, 'background-position': 1, 'empty-cells': 1, 'direction': 1, 'border-right': 1, 'visibility': 1, 'padding': 1, 'border-style': 1, 'background-attachment': 1, 'overflow': 1, 'border-bottom-style': 1, 'cursor': 1, 'margin': 1, 'display': 1, 'border-left-width': 1, 'letter-spacing': 1, 'vertical-align': 1, 'clip': 1, 'border-color': 1, 'list-style': 1, 'padding-bottom': 1, 'pause-after': 1, 'speak-numeral': 1, 'margin-left': 1, 'widows': 1, 'border': 1, 'font-style': 1, 'border-left-color': 1, 'pitch-range': 1, 'background-repeat': 1, 'table-layout': 1, 'margin-bottom': 1, 'speak-punctuation': 1, 'font-weight': 1, 'border-right-color': 1, 'page-break-after': 1, 'position': 1, 'white-space': 1, 'text-indent': 1, 'background-image': 1, 'volume': 1, 'stress': 1, 'outline': 1, 'clear': 1, 'z-index': 1, 'text-decoration': 1, 'margin-top': 1, 'azimuth': 1, 'cue-after': 1, 'left': 1, 'list-style-position': 1},
contains: ['comment', 'value']
},
C_BLOCK_COMMENT_MODE,
{
className: 'value',
begin: ':', end: ';', endsWithParent: true,
excludeBegin: true, excludeEnd: true
}
]
};//css
LANGUAGES.django = {
defaultMode: {
contains: ['tag', 'comment', 'doctype', 'template_comment', 'template_tag', 'variable']
},
case_insensitive: true,
modes: [
XML_COMMENT,
HTML_DOCTYPE,
{
className: 'tag',
lexems: [IDENT_RE],
keywords: HTML_TAGS,
begin: '<[A-Za-z/]', end: '>',
contains: ['attribute', 'template_comment', 'template_tag', 'variable']
},
XML_ATTR,
HTML_ATTR,
{
className: 'value',
begin: '"', end: '"',
contains: ['template_comment', 'template_tag', 'variable']
},
HTML_VALUE,
{
className: 'template_comment',
begin: '\\{\\%\\s*comment\\s*\\%\\}', end: '\\{\\%\\s*endcomment\\s*\\%\\}'
},
{
className: 'template_comment',
begin: '\\{#', end: '#\\}'
},
{
className: 'template_tag',
begin: '\\{\\%', end: '\\%\\}',
lexems: [IDENT_RE],
keywords: {'comment': 1, 'endcomment': 1, 'load': 1, 'templatetag': 1, 'ifchanged': 1, 'endifchanged': 1, 'if': 1, 'endif': 1, 'firstof': 1, 'for': 1, 'endfor': 1, 'in': 1, 'ifnotequal': 1, 'endifnotequal': 1, 'widthratio': 1, 'extends': 1, 'include': 1, 'spaceless': 1, 'endspaceless': 1, 'regroup': 1, 'by': 1, 'as': 1, 'ifequal': 1, 'endifequal': 1, 'ssi': 1, 'now': 1, 'with': 1, 'cycle': 1, 'url': 1, 'filter': 1, 'endfilter': 1, 'debug': 1, 'block': 1, 'endblock': 1, 'else': 1},
contains: ['filter']
},
{
className: 'variable',
begin: '\\{\\{', end: '\\}\\}',
contains: ['filter']
},
{
className: 'filter',
begin: '\\|[A-Za-z]+\\:?', end: '^', excludeEnd: true,
lexems: [IDENT_RE],
keywords: {'truncatewords': 1, 'removetags': 1, 'linebreaksbr': 1, 'yesno': 1, 'get_digit': 1, 'timesince': 1, 'random': 1, 'striptags': 1, 'filesizeformat': 1, 'escape': 1, 'linebreaks': 1, 'length_is': 1, 'ljust': 1, 'rjust': 1, 'cut': 1, 'urlize': 1, 'fix_ampersands': 1, 'title': 1, 'floatformat': 1, 'capfirst': 1, 'pprint': 1, 'divisibleby': 1, 'add': 1, 'make_list': 1, 'unordered_list': 1, 'urlencode': 1, 'timeuntil': 1, 'urlizetrunc': 1, 'wordcount': 1, 'stringformat': 1, 'linenumbers': 1, 'slice': 1, 'date': 1, 'dictsort': 1, 'dictsortreversed': 1, 'default_if_none': 1, 'pluralize': 1, 'lower': 1, 'join': 1, 'center': 1, 'default': 1, 'truncatewords_html': 1, 'upper': 1, 'length': 1, 'phone2numeric': 1, 'wordwrap': 1, 'time': 1, 'addslashes': 1, 'slugify': 1, 'first': 1},
contains: ['argument']
},
{
className: 'argument',
begin: '"', end: '"'
}
]
};//django