846
|
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 if syntax file is already loaded
|
|
18 if version < 600
|
|
19 syntax clear
|
|
20 elseif exists("b:current_syntax")
|
|
21 finish
|
|
22 endif
|
|
23
|
|
24 " A WikiWord (unqualifiedWikiName)
|
|
25 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]*\)\)/
|
|
26 " A [bracketed wiki word]
|
|
27 syntax match flexwikiWord /\[[[:alnum:]\s]\+\]/
|
|
28
|
|
29 " text: "this is a link (optional tooltip)":http://www.microsoft.com
|
|
30 " TODO: check URL syntax against RFC
|
|
31 syntax match flexwikiLink `\("[^"(]\+\((\([^)]\+\))\)\?":\)\?\(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):\(\(\(//\)\|\(\\\\\)\)\+[A-Za-z0-9:#@%/;$~_?+-=.&\-\\\\]*\)`
|
|
32
|
|
33 " text: *strong*
|
|
34 syntax match flexwikiBold /\(^\|\W\)\zs\*\([^ ].\{-}\)\*/
|
|
35 " '''bold'''
|
|
36 syntax match flexwikiBold /'''\([^'].\{-}\)'''/
|
|
37
|
|
38 " text: _emphasis_
|
|
39 syntax match flexwikiItalic /\(^\|\W\)\zs_\([^ ].\{-}\)_/
|
|
40 " ''italic''
|
|
41 syntax match flexwikiItalic /''\([^'].\{-}\)''/
|
|
42
|
|
43 " ``deemphasis``
|
|
44 syntax match flexwikiDeEmphasis /``\([^`].\{-}\)``/
|
|
45
|
|
46 " text: @code@
|
|
47 syntax match flexwikiCode /\(^\|\s\|(\|\[\)\zs@\([^@]\+\)@/
|
|
48
|
|
49 " text: -deleted text-
|
|
50 syntax match flexwikiDelText /\(^\|\s\+\)\zs-\([^ <a ]\|[^ <img ]\|[^ -].*\)-/
|
|
51
|
|
52 " text: +inserted text+
|
|
53 syntax match flexwikiInsText /\(^\|\W\)\zs+\([^ ].\{-}\)+/
|
|
54
|
|
55 " text: ^superscript^
|
|
56 syntax match flexwikiSuperScript /\(^\|\W\)\zs^\([^ ].\{-}\)^/
|
|
57
|
|
58 " text: ~subscript~
|
|
59 syntax match flexwikiSubScript /\(^\|\W\)\zs\~\([^ ].\{-}\)\~/
|
|
60
|
|
61 " text: ??citation??
|
|
62 syntax match flexwikiCitation /\(^\|\W\)\zs??\([^ ].\{-}\)??/
|
|
63
|
|
64 " Emoticons: must come after the Textilisms, as later rules take precedence
|
|
65 " over earlier ones. This match is an approximation for the ~70 distinct
|
|
66 " patterns that FlexWiki knows.
|
|
67 syntax match flexwikiEmoticons /\((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
|
|
68
|
|
69 " Aggregate all the regular text highlighting into flexwikiText
|
|
70 syntax cluster flexwikiText contains=flexwikiItalic,flexwikiBold,flexwikiCode,flexwikiDeEmphasis,flexwikiDelText,flexwikiInsText,flexwikiSuperScript,flexwikiSubScript,flexwikiCitation,flexwikiLink,flexwikiWord,flexwikiEmoticons
|
|
71
|
|
72 " single-line WikiPropertys
|
|
73 syntax match flexwikiSingleLineProperty /^:\?[A-Z_][_a-zA-Z0-9]\+:/
|
|
74
|
|
75 " TODO: multi-line WikiPropertys
|
|
76
|
|
77 " Header levels, 1-6
|
|
78 syntax match flexwikiH1 /^!.*$/
|
|
79 syntax match flexwikiH2 /^!!.*$/
|
|
80 syntax match flexwikiH3 /^!!!.*$/
|
|
81 syntax match flexwikiH4 /^!!!!.*$/
|
|
82 syntax match flexwikiH5 /^!!!!!.*$/
|
|
83 syntax match flexwikiH6 /^!!!!!!.*$/
|
|
84
|
|
85 " <hr>, horizontal rule
|
|
86 syntax match flexwikiHR /^----.*$/
|
|
87
|
|
88 " Formatting can be turned off by ""enclosing it in pairs of double quotes""
|
|
89 syntax match flexwikiEscape /"".\{-}""/
|
|
90
|
|
91 " Tables. Each line starts and ends with '||'; each cell is separated by '||'
|
|
92 syntax match flexwikiTable /||/
|
|
93
|
|
94 " Bulleted list items start with one or tabs, followed by whitespace, then '*'
|
|
95 " Numeric list items start with one or tabs, followed by whitespace, then '1.'
|
|
96 " Eight spaces at the beginning of the line is equivalent to the leading tab.
|
|
97 syntax match flexwikiList /^\(\t\| \{8}\)\s*\(\*\|1\.\).*$/ contains=@flexwikiText
|
|
98
|
|
99 " Treat all other lines that start with spaces as PRE-formatted text.
|
|
100 syntax match flexwikiPre /^[ \t]\+[^ \t*1].*$/
|
|
101
|
|
102
|
|
103 " Link FlexWiki syntax items to colors
|
|
104 hi def link flexwikiH1 Title
|
|
105 hi def link flexwikiH2 flexwikiH1
|
|
106 hi def link flexwikiH3 flexwikiH2
|
|
107 hi def link flexwikiH4 flexwikiH3
|
|
108 hi def link flexwikiH5 flexwikiH4
|
|
109 hi def link flexwikiH6 flexwikiH5
|
|
110 hi def link flexwikiHR flexwikiH6
|
|
111
|
|
112 hi def flexwikiBold term=bold cterm=bold gui=bold
|
|
113 hi def flexwikiItalic term=italic cterm=italic gui=italic
|
|
114
|
|
115 hi def link flexwikiCode Statement
|
|
116 hi def link flexwikiWord Underlined
|
|
117
|
|
118 hi def link flexwikiEscape Todo
|
|
119 hi def link flexwikiPre PreProc
|
|
120 hi def link flexwikiLink Underlined
|
|
121 hi def link flexwikiList Type
|
|
122 hi def link flexwikiTable Type
|
|
123 hi def link flexwikiEmoticons Constant
|
|
124 hi def link flexwikiDelText Comment
|
|
125 hi def link flexwikiDeEmphasis Comment
|
|
126 hi def link flexwikiInsText Constant
|
|
127 hi def link flexwikiSuperScript Constant
|
|
128 hi def link flexwikiSubScript Constant
|
|
129 hi def link flexwikiCitation Constant
|
|
130
|
|
131 hi def link flexwikiSingleLineProperty Identifier
|
|
132
|
|
133 let b:current_syntax="FlexWiki"
|
|
134
|
|
135 " vim:tw=0:
|