Mercurial > vim
annotate runtime/syntax/flexwiki.vim @ 23601:3b600f015796
Added tag v8.2.2342 for changeset f4347a61ed384b233df4cdb99230d2fd3f2852ea
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 13 Jan 2021 20:15:05 +0100 |
parents | 43efa4f5a8ea |
children | d46f974fd69e |
rev | line source |
---|---|
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 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
846
diff
changeset
|
17 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
846
diff
changeset
|
18 if exists("b:current_syntax") |
846 | 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 WikiPropertys | |
71 syntax match flexwikiSingleLineProperty /^:\?[A-Z_][_a-zA-Z0-9]\+:/ | |
72 | |
73 " TODO: multi-line WikiPropertys | |
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: |