diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2009-12-05 08:54:13 +1300 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2009-12-05 08:54:13 +1300 |
commit | 7b38a061a40f5e391b9d85465b652cb29cd21f93 (patch) | |
tree | 2550316aebb0ab56942db8b4730e0cd62e1bed9c /vim | |
parent | 64f982f7f726c6a22eac16ad95542f0ea5251323 (diff) | |
download | asciidoc-7b38a061a40f5e391b9d85465b652cb29cd21f93.tar.gz |
Vim syntax highlighter: Fixed some broken bit viz. lists highlighting,
plus a few other improvements.
Diffstat (limited to 'vim')
-rw-r--r-- | vim/syntax/asciidoc.vim | 138 |
1 files changed, 68 insertions, 70 deletions
diff --git a/vim/syntax/asciidoc.vim b/vim/syntax/asciidoc.vim index 6e83280..c30a6ee 100644 --- a/vim/syntax/asciidoc.vim +++ b/vim/syntax/asciidoc.vim @@ -17,7 +17,7 @@ syn sync fromstart syn sync linebreaks=1 " Run :help syn-priority to review syntax matching priority. -syn keyword asciidocToDo TODO FIXME CHECK TEST XXX ZZZ +syn keyword asciidocToDo TODO FIXME CHECK TEST XXX ZZZ DEPRECATED syn match asciidocBackslash /\\/ syn region asciidocIdMarker start=/^\$Id:\s/ end=/\s\$$/ syn match asciidocCallout /\\\@<!<\d\{1,2}>/ @@ -26,24 +26,19 @@ syn match asciidocLineBreak /[ \t]+$/ syn match asciidocRuler /^'\{3,}$/ syn match asciidocPagebreak /^<\{3,}$/ syn match asciidocEntityRef /\\\@<!&[#a-zA-Z]\S\{-};/ -" asciidocLiteralParagraph is broken by: -" - Preceding attribute lists. -" - Indented lists (accept those with single '-', '*' or '.' bullet -" characters). -syn region asciidocLiteralParagraph start=/^\n[ \t]\+\(\([^-*.] \)\|\(\S\S\)\)/ end=/\(^+\?\s*$\)\@=/ +syn region asciidocLiteralParagraph start=/^\s\+\S\+/ end=/\(^+\?\s*$\)\@=/ syn match asciidocURL /\\\@<!\<\(http\|https\|ftp\|file\|irc\):\/\/[^| \t]*\(\w\|\/\)/ -syn match asciidocEmail /\\\@<!\(\<\|<\)\w\(\w\|[.-]\)*@\(\w\|[.-]\)*\w>\?[0-9A-Za-z_]\@!/ +syn match asciidocEmail /[\\.:]\@<!\(\<\|<\)\w\(\w\|[.-]\)*@\(\w\|[.-]\)*\w>\?[0-9A-Za-z_]\@!/ syn match asciidocAttributeRef /\\\@<!{\w\(\w\|-\)*\([=!@#$%?:].*\)\?}/ -syn match asciidocAdmonition /^\u\{3,15}:\(\s\+.*\)\@=/ -" As a damage control measure quoted patterns always terminate at a blank +" As a damage control measure quoted patterns always terminate at a blank " line (see 'Limitations' above). syn match asciidocQuotedSubscript /\\\@<!\~\S\_.\{-}\(\~\|\n\s*\n\)/ syn match asciidocQuotedSuperscript /\\\@<!\^\S\_.\{-}\(\^\|\n\s*\n\)/ syn match asciidocQuotedMonospaced /\(^\|[| \t([.,=\]]\)\@<=+\([ )\n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(+\([| \t)[\],.?!;:=]\|$\)\@=\)/ syn match asciidocQuotedMonospaced2 /\(^\|[| \t([.,=\]]\)\@<=`\([ )\n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(`\([| \t)[\],.?!;:=]\|$\)\@=\)/ -syn match asciidocQuotedUnconstrainedMonospaced /\\\@<!++\S\_.\{-}\(++\|\n\s*\n\)/ +syn match asciidocQuotedUnconstrainedMonospaced /[\\+]\@<!++\S\_.\{-}\(++\|\n\s*\n\)/ syn match asciidocQuotedEmphasized /\(^\|[| \t([.,=\]]\)\@<=_\([ )\n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(_\([| \t)[\],.?!;:=]\|$\)\@=\)/ syn match asciidocQuotedEmphasized2 /\(^\|[| \t([.,=\]]\)\@<='\([ )\n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\('\([| \t)[\],.?!;:=]\|$\)\@=\)/ @@ -60,23 +55,21 @@ syn match asciidocQuotedDoubleQuoted /\(^\|[| \t([.,=]\)\@<=``\([ )\n\t]\)\@!\(. syn match asciidocDoubleDollarPassthrough /\\\@<!\(^\|[^0-9a-zA-Z$]\)\@<=\$\$..\{-}\(\$\$\([^0-9a-zA-Z$]\|$\)\@=\|^$\)/ syn match asciidocTriplePlusPassthrough /\\\@<!\(^\|[^0-9a-zA-Z$]\)\@<=+++..\{-}\(+++\([^0-9a-zA-Z$]\|$\)\@=\|^$\)/ -syn match asciidocListBullet /^\s*\zs\(-\|\*\{1,5}\)\ze\s/ -syn match asciidocListNumber /^\s*\zs\(\(\d\+\.\)\|\.\{1,5}\|\(\a\.\)\|\([ivxIVX]\+)\)\)\ze\s\+/ +syn match asciidocAdmonition /^\u\{3,15}:\(\s\+.*\)\@=/ syn region asciidocTable_OLD start=/^\([`.']\d*[-~_]*\)\+[-~_]\+\d*$/ end=/^$/ syn match asciidocBlockTitle /^\.[^. \t].*[^-~_]$/ contains=asciidocQuoted.*,asciidocAttributeRef -syn match asciidocOneLineTitle /^=\{1,5}\s\+\S.*$/ contains=asciidocQuoted.*,asciidocAttributeRef - syn match asciidocTitleUnderline /[-=~^+]\{2,}$/ transparent contained contains=NONE -syn match asciidocTwoLineTitle /^[^. +/].*[^.:]\n[-=~^+]\{2,}$/ contains=asciidocQuoted.*,asciidocAttributeRef,asciidocTitleUnderline +syn match asciidocOneLineTitle /^=\{1,5}\s\+\S.*$/ contains=asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash +syn match asciidocTwoLineTitle /^[^. +/].*[^.]\n[-=~^+]\{2,}$/ contains=asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash,asciidocTitleUnderline syn match asciidocAttributeList /^\[[^[ \t].*\]$/ syn match asciidocQuoteBlockDelimiter /^_\{4,}$/ syn match asciidocExampleBlockDelimiter /^=\{4,}$/ syn match asciidocSidebarDelimiter /^*\{4,}$/ -"See http://vimdoc.sourceforge.net/htmldoc/usr_44.html for excluding region -"contents from highlighting. +" See http://vimdoc.sourceforge.net/htmldoc/usr_44.html for excluding region +" contents from highlighting. syn match asciidocTablePrefix /\(\S\@<!\(\([0-9.]\+\)\([*+]\)\)\?\([<\^>.]\{,3}\)\?\([a-z]\)\?\)\?|/ containedin=asciidocTableBlock contained syn region asciidocTableBlock matchgroup=asciidocTableDelimiter start=/^|=\{3,}$/ end=/^|=\{3,}$/ keepend contains=ALL syn match asciidocTablePrefix /\(\S\@<!\(\([0-9.]\+\)\([*+]\)\)\?\([<\^>.]\{,3}\)\?\([a-z]\)\?\)\?!/ containedin=asciidocTableBlock contained @@ -84,9 +77,10 @@ syn region asciidocTableBlock2 matchgroup=asciidocTableDelimiter2 start=/^!=\{3, syn match asciidocListContinuation /^+$/ syn region asciidocLiteralBlock start=/^\.\{4,}$/ end=/^\.\{4,}$/ contains=asciidocCallout keepend -syn region asciidocOpenBlock start=/^-\{4,}$/ end=/^-\{4,}$/ contains=asciidocCallout keepend +syn region asciidocListingBlock start=/^-\{4,}$/ end=/^-\{4,}$/ contains=asciidocCallout keepend syn region asciidocCommentBlock start="^/\{4,}$" end="^/\{4,}$" contains=asciidocToDo syn region asciidocPassthroughBlock start="^+\{4,}$" end="^+\{4,}$" + " Allowing leading \w characters in the filter delimiter is to accomodate " the pre version 8.2.7 syntax and may be removed in future releases. syn region asciidocFilterBlock start=/^\w*\~\{4,}$/ end=/^\w*\~\{4,}$/ @@ -100,73 +94,77 @@ syn region asciidocMacroAttributes matchgroup=asciidocAttributeMacro start=/\({\ syn match asciidocCommentLine "^//\([^/].*\|\)$" contains=asciidocToDo -syn region asciidocLabel start=/^\s*/ end=/\(:\{2,4}\|;;\)$/ oneline contains=asciidocQuoted.*,asciidocMacroAttributes keepend -"DEPRECATED: Horizontal label. -syn region asciidocHLabel start=/^\s*/ end=/\(::\|;;\)\(\s\+\|\\$\)/ oneline contains=asciidocQuoted.*,asciidocMacroAttributes keepend - syn region asciidocAttributeEntry start=/^:\w/ end=/:\(\s\|$\)/ oneline -highlight link asciidocMacroAttributes Label -highlight link asciidocIdMarker Special -highlight link asciidocDoubleDollarPassthrough Special -highlight link asciidocTriplePlusPassthrough Special -highlight link asciidocQuotedSubscript Type -highlight link asciidocQuotedSuperscript Type -highlight link asciidocOneLineTitle Title -highlight link asciidocTwoLineTitle Title -highlight link asciidocBlockTitle Title -highlight link asciidocRefMacro Macro -highlight link asciidocIndexTerm Macro -highlight link asciidocMacro Macro -highlight link asciidocAttributeMacro Macro +" Lists. +syn match asciidocListBullet /^\s*\zs\(-\|\*\{1,5}\)\ze\s/ +syn match asciidocListNumber /^\s*\zs\(\(\d\+\.\)\|\.\{1,5}\|\(\a\.\)\|\([ivxIVX]\+)\)\)\ze\s\+/ +syn region asciidocListLabel start=/^\s*/ end=/\(:\{2,4}\|;;\)$/ oneline contains=asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash keepend +" DEPRECATED: Horizontal label. +syn region asciidocHLabel start=/^\s*/ end=/\(::\|;;\)\(\s\+\|\\$\)/ oneline contains=asciidocQuoted.*,asciidocMacroAttributes keepend +" Starts with any of the above. +syn region asciidocList start=/^\s*\(-\|\*\{1,5}\)\s/ start=/^\s*\(\(\d\+\.\)\|\.\{1,5}\|\(\a\.\)\|\([ivxIVX]\+)\)\)\s\+/ start=/.\+\(:\{2,4}\|;;\)$/ end=/\(^[=*]\{4,}$\)\@=/ end=/\(^+\?\s*$\)\@=/ contains=asciidocList.\+,asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash,asciidocCommentLine,asciidocAttributeList + +highlight link asciidocAdmonition Special highlight link asciidocAnchorMacro Macro +highlight link asciidocAttributeEntry Special +highlight link asciidocAttributeList Special +highlight link asciidocAttributeMacro Macro +highlight link asciidocAttributeRef Special +highlight link asciidocBackslash Special +highlight link asciidocBlockTitle Title +highlight link asciidocCallout Label +highlight link asciidocCommentBlock Comment +highlight link asciidocCommentLine Comment +highlight link asciidocDoubleDollarPassthrough Special highlight link asciidocEmail Macro -highlight link asciidocListBullet Label -highlight link asciidocListNumber Label -highlight link asciidocLabel Label +highlight link asciidocEntityRef Special +highlight link asciidocExampleBlockDelimiter Type +highlight link asciidocFilterBlock Type highlight link asciidocHLabel Label -highlight link asciidocTable_OLD Type -highlight link asciidocTableDelimiter Label -highlight link asciidocTableBlock NONE -highlight link asciidocTablePrefix Label -highlight link asciidocTableDelimiter2 Label -highlight link asciidocTableBlock2 NONE -highlight link asciidocTablePrefix2 Label +highlight link asciidocIdMarker Special +highlight link asciidocIndexTerm Macro +highlight link asciidocLineBreak Special highlight link asciidocListBlockDelimiter Label +highlight link asciidocListBullet Label highlight link asciidocListContinuation Label -highlight link asciidocLiteralParagraph Identifier -highlight link asciidocQuoteBlockDelimiter Type -highlight link asciidocExampleBlockDelimiter Type -highlight link asciidocSidebarDelimiter Type +highlight link asciidocListingBlock Identifier +highlight link asciidocListLabel Label +highlight link asciidocListNumber Label highlight link asciidocLiteralBlock Identifier -highlight link asciidocOpenBlock Identifier +highlight link asciidocLiteralParagraph Identifier +highlight link asciidocMacroAttributes Label +highlight link asciidocMacro Macro +highlight link asciidocOneLineTitle Title +highlight link asciidocPagebreak Type highlight link asciidocPassthroughBlock Identifier -highlight link asciidocCommentBlock Comment -highlight link asciidocFilterBlock Type +highlight link asciidocQuoteBlockDelimiter Type highlight link asciidocQuotedBold Special -highlight link asciidocQuotedUnconstrainedBold Special -highlight link asciidocQuotedEmphasized Type +highlight link asciidocQuotedDoubleQuoted Label highlight link asciidocQuotedEmphasized2 Type -highlight link asciidocQuotedUnconstrainedEmphasized Type -highlight link asciidocQuotedMonospaced Identifier +highlight link asciidocQuotedEmphasized Type highlight link asciidocQuotedMonospaced2 Identifier -highlight link asciidocQuotedUnconstrainedMonospaced Identifier +highlight link asciidocQuotedMonospaced Identifier highlight link asciidocQuotedSingleQuoted Label -highlight link asciidocQuotedDoubleQuoted Label -highlight link asciidocToDo Todo -highlight link asciidocCommentLine Comment -highlight link asciidocAdmonition Special -highlight link asciidocAttributeRef Special -highlight link asciidocAttributeList Special -highlight link asciidocAttributeEntry Special -highlight link asciidocBackslash Special -highlight link asciidocEntityRef Special -highlight link asciidocCallout Label -highlight link asciidocLineBreak Special +highlight link asciidocQuotedSubscript Type +highlight link asciidocQuotedSuperscript Type +highlight link asciidocQuotedUnconstrainedBold Special +highlight link asciidocQuotedUnconstrainedEmphasized Type +highlight link asciidocQuotedUnconstrainedMonospaced Identifier +highlight link asciidocRefMacro Macro highlight link asciidocRuler Type -highlight link asciidocPagebreak Type +highlight link asciidocSidebarDelimiter Type +highlight link asciidocTableBlock2 NONE +highlight link asciidocTableBlock NONE +highlight link asciidocTableDelimiter2 Label +highlight link asciidocTableDelimiter Label +highlight link asciidocTable_OLD Type +highlight link asciidocTablePrefix2 Label +highlight link asciidocTablePrefix Label +highlight link asciidocToDo Todo +highlight link asciidocTriplePlusPassthrough Special +highlight link asciidocTwoLineTitle Title highlight link asciidocURL Macro - let b:current_syntax = "asciidoc" " vim: wrap et sw=2 sts=2: |