flexwiki.vim (5437B)
1 " Vim syntax file 2 " Language: FlexWiki, http://www.flexwiki.com/ 3 " Maintainer: George V. Reilly <george@reilly.org> 4 " Home: http://www.georgevreilly.com/vim/flexwiki/ 5 " Other Home: http://www.vim.org/scripts/script.php?script_id=1529 6 " Author: George V. Reilly 7 " Filenames: *.wiki 8 " Last Change: Wed Apr 26 11:00 PM 2006 P 9 " Version: 0.3 10 11 " Note: The horrible regexps were reverse-engineered from 12 " FlexWikiCore\EngineSource\Formatter.cs, with help from the Regex Analyzer 13 " in The Regulator, http://regulator.sourceforge.net/ .NET uses Perl-style 14 " regexes, which use a different syntax than Vim (fewer \s). 15 " The primary test case is FlexWiki\FormattingRules.wiki 16 17 " quit when a syntax file was already loaded 18 if exists("b:current_syntax") 19 finish 20 endif 21 22 " A WikiWord (unqualifiedWikiName) 23 syntax match flexwikiWord /\%(_\?\([A-Z]\{2,}[a-z0-9]\+[A-Za-z0-9]*\)\|\([A-Z][a-z0-9]\+[A-Za-z0-9]*[A-Z]\+[A-Za-z0-9]*\)\)/ 24 " A [bracketed wiki word] 25 syntax match flexwikiWord /\[[[:alnum:]\s]\+\]/ 26 27 " text: "this is a link (optional tooltip)":http://www.microsoft.com 28 " TODO: check URL syntax against RFC 29 syntax match flexwikiLink `\("[^"(]\+\((\([^)]\+\))\)\?":\)\?\(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):\(\(\(//\)\|\(\\\\\)\)\+[A-Za-z0-9:#@%/;$~_?+-=.&\-\\\\]*\)` 30 31 " text: *strong* 32 syntax match flexwikiBold /\(^\|\W\)\zs\*\([^ ].\{-}\)\*/ 33 " '''bold''' 34 syntax match flexwikiBold /'''\([^'].\{-}\)'''/ 35 36 " text: _emphasis_ 37 syntax match flexwikiItalic /\(^\|\W\)\zs_\([^ ].\{-}\)_/ 38 " ''italic'' 39 syntax match flexwikiItalic /''\([^'].\{-}\)''/ 40 41 " ``deemphasis`` 42 syntax match flexwikiDeEmphasis /``\([^`].\{-}\)``/ 43 44 " text: @code@ 45 syntax match flexwikiCode /\(^\|\s\|(\|\[\)\zs@\([^@]\+\)@/ 46 47 " text: -deleted text- 48 syntax match flexwikiDelText /\(^\|\s\+\)\zs-\([^ <a ]\|[^ <img ]\|[^ -].*\)-/ 49 50 " text: +inserted text+ 51 syntax match flexwikiInsText /\(^\|\W\)\zs+\([^ ].\{-}\)+/ 52 53 " text: ^superscript^ 54 syntax match flexwikiSuperScript /\(^\|\W\)\zs^\([^ ].\{-}\)^/ 55 56 " text: ~subscript~ 57 syntax match flexwikiSubScript /\(^\|\W\)\zs\~\([^ ].\{-}\)\~/ 58 59 " text: ??citation?? 60 syntax match flexwikiCitation /\(^\|\W\)\zs??\([^ ].\{-}\)??/ 61 62 " Emoticons: must come after the Textilisms, as later rules take precedence 63 " over earlier ones. This match is an approximation for the ~70 distinct 64 " patterns that FlexWiki knows. 65 syntax match flexwikiEmoticons /\((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/ 66 67 " Aggregate all the regular text highlighting into flexwikiText 68 syntax cluster flexwikiText contains=flexwikiItalic,flexwikiBold,flexwikiCode,flexwikiDeEmphasis,flexwikiDelText,flexwikiInsText,flexwikiSuperScript,flexwikiSubScript,flexwikiCitation,flexwikiLink,flexwikiWord,flexwikiEmoticons 69 70 " single-line WikiProperties 71 syntax match flexwikiSingleLineProperty /^:\?[A-Z_][_a-zA-Z0-9]\+:/ 72 73 " TODO: multi-line WikiProperties 74 75 " Header levels, 1-6 76 syntax match flexwikiH1 /^!.*$/ 77 syntax match flexwikiH2 /^!!.*$/ 78 syntax match flexwikiH3 /^!!!.*$/ 79 syntax match flexwikiH4 /^!!!!.*$/ 80 syntax match flexwikiH5 /^!!!!!.*$/ 81 syntax match flexwikiH6 /^!!!!!!.*$/ 82 83 " <hr>, horizontal rule 84 syntax match flexwikiHR /^----.*$/ 85 86 " Formatting can be turned off by ""enclosing it in pairs of double quotes"" 87 syntax match flexwikiEscape /"".\{-}""/ 88 89 " Tables. Each line starts and ends with '||'; each cell is separated by '||' 90 syntax match flexwikiTable /||/ 91 92 " Bulleted list items start with one or tabs, followed by whitespace, then '*' 93 " Numeric list items start with one or tabs, followed by whitespace, then '1.' 94 " Eight spaces at the beginning of the line is equivalent to the leading tab. 95 syntax match flexwikiList /^\(\t\| \{8}\)\s*\(\*\|1\.\).*$/ contains=@flexwikiText 96 97 " Treat all other lines that start with spaces as PRE-formatted text. 98 syntax match flexwikiPre /^[ \t]\+[^ \t*1].*$/ 99 100 101 " Link FlexWiki syntax items to colors 102 hi def link flexwikiH1 Title 103 hi def link flexwikiH2 flexwikiH1 104 hi def link flexwikiH3 flexwikiH2 105 hi def link flexwikiH4 flexwikiH3 106 hi def link flexwikiH5 flexwikiH4 107 hi def link flexwikiH6 flexwikiH5 108 hi def link flexwikiHR flexwikiH6 109 110 hi def flexwikiBold term=bold cterm=bold gui=bold 111 hi def flexwikiItalic term=italic cterm=italic gui=italic 112 113 hi def link flexwikiCode Statement 114 hi def link flexwikiWord Underlined 115 116 hi def link flexwikiEscape Todo 117 hi def link flexwikiPre PreProc 118 hi def link flexwikiLink Underlined 119 hi def link flexwikiList Type 120 hi def link flexwikiTable Type 121 hi def link flexwikiEmoticons Constant 122 hi def link flexwikiDelText Comment 123 hi def link flexwikiDeEmphasis Comment 124 hi def link flexwikiInsText Constant 125 hi def link flexwikiSuperScript Constant 126 hi def link flexwikiSubScript Constant 127 hi def link flexwikiCitation Constant 128 129 hi def link flexwikiSingleLineProperty Identifier 130 131 let b:current_syntax="FlexWiki" 132 133 " vim:tw=0: