7
|
1 " Vim syntax file
|
|
2 " Language: DocBook
|
|
3 " Maintainer: Devin Weaver <vim@tritarget.com>
|
3967
|
4 " Last Updated By: Shlomi Fish
|
7
|
5 " URL: http://tritarget.com/pub/vim/syntax/docbk.vim
|
3967
|
6 " Last Change: 2012 Nov 28
|
|
7 " Version: 1.2 (and modified after that)
|
7
|
8 " Thanks to Johannes Zellner <johannes@zellner.org> for the default to XML
|
|
9 " suggestion.
|
|
10
|
|
11 " REFERENCES:
|
|
12 " http://docbook.org/
|
|
13 " http://www.open-oasis.org/docbook/
|
|
14 "
|
|
15
|
|
16 " For version 5.x: Clear all syntax items
|
|
17 " For version 6.x: Quit when a syntax file was already loaded
|
|
18 if version < 600
|
|
19 syntax clear
|
|
20 elseif exists("b:current_syntax")
|
|
21 finish
|
|
22 endif
|
|
23
|
|
24 " Auto detect added by Bram Moolenaar
|
|
25 if !exists('b:docbk_type')
|
|
26 if expand('%:e') == "sgml"
|
|
27 let b:docbk_type = 'sgml'
|
|
28 else
|
|
29 let b:docbk_type = 'xml'
|
|
30 endif
|
|
31 endif
|
3967
|
32
|
|
33 if !exists('b:docbk_ver')
|
|
34 if exists('docbk_ver')
|
|
35 let b:docbk_ver = docbk_ver
|
|
36 else
|
|
37 let b:docbk_ver = 4
|
|
38 endif
|
|
39 end
|
|
40
|
7
|
41 if 'xml' == b:docbk_type
|
352
|
42 doau Syntax xml
|
7
|
43 syn cluster xmlTagHook add=docbkKeyword
|
|
44 syn cluster xmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite
|
|
45 syn case match
|
|
46 elseif 'sgml' == b:docbk_type
|
352
|
47 doau Syntax sgml
|
7
|
48 syn cluster sgmlTagHook add=docbkKeyword
|
|
49 syn cluster sgmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite
|
|
50 syn case ignore
|
|
51 endif
|
|
52
|
3967
|
53 syn keyword docbkKeyword abbrev abstract accel acronym address contained
|
|
54 syn keyword docbkKeyword affiliation alt anchor answer appendix contained
|
|
55 syn keyword docbkKeyword application area areaset areaspec arg contained
|
|
56 syn keyword docbkKeyword article artpagenums attribution audiodata contained
|
|
57 syn keyword docbkKeyword audioobject author authorgroup contained
|
|
58 syn keyword docbkKeyword authorinitials bibliocoverage bibliodiv contained
|
|
59 syn keyword docbkKeyword biblioentry bibliography biblioid contained
|
|
60 syn keyword docbkKeyword bibliolist bibliomisc bibliomixed contained
|
|
61 syn keyword docbkKeyword bibliomset biblioref bibliorelation contained
|
|
62 syn keyword docbkKeyword biblioset bibliosource blockquote book contained
|
|
63 syn keyword docbkKeyword bridgehead callout calloutlist caption contained
|
|
64 syn keyword docbkKeyword caution chapter citation citebiblioid contained
|
|
65 syn keyword docbkKeyword citerefentry citetitle city classname contained
|
|
66 syn keyword docbkKeyword classsynopsis classsynopsisinfo cmdsynopsis contained
|
|
67 syn keyword docbkKeyword co code col colgroup collab colophon contained
|
|
68 syn keyword docbkKeyword colspec command computeroutput confdates contained
|
|
69 syn keyword docbkKeyword confgroup confnum confsponsor conftitle contained
|
|
70 syn keyword docbkKeyword constant constructorsynopsis contractnum contained
|
|
71 syn keyword docbkKeyword contractsponsor contrib copyright coref contained
|
|
72 syn keyword docbkKeyword country database date dedication contained
|
|
73 syn keyword docbkKeyword destructorsynopsis edition editor email contained
|
|
74 syn keyword docbkKeyword emphasis entry entrytbl envar epigraph contained
|
|
75 syn keyword docbkKeyword equation errorcode errorname errortext contained
|
|
76 syn keyword docbkKeyword errortype example exceptionname fax contained
|
|
77 syn keyword docbkKeyword fieldsynopsis figure filename firstname contained
|
|
78 syn keyword docbkKeyword firstterm footnote footnoteref contained
|
7
|
79 syn keyword docbkKeyword foreignphrase formalpara funcdef funcparams contained
|
|
80 syn keyword docbkKeyword funcprototype funcsynopsis funcsynopsisinfo contained
|
3967
|
81 syn keyword docbkKeyword function glossary glossdef glossdiv contained
|
|
82 syn keyword docbkKeyword glossentry glosslist glosssee glossseealso contained
|
|
83 syn keyword docbkKeyword glossterm group guibutton guiicon guilabel contained
|
7
|
84 syn keyword docbkKeyword guimenu guimenuitem guisubmenu hardware contained
|
3967
|
85 syn keyword docbkKeyword holder honorific imagedata imageobject contained
|
|
86 syn keyword docbkKeyword imageobjectco important index indexdiv contained
|
|
87 syn keyword docbkKeyword indexentry indexterm informalequation contained
|
|
88 syn keyword docbkKeyword informalexample informalfigure contained
|
|
89 syn keyword docbkKeyword informaltable initializer inlineequation contained
|
|
90 syn keyword docbkKeyword inlinemediaobject interfacename issuenum contained
|
|
91 syn keyword docbkKeyword itemizedlist itermset jobtitle keycap contained
|
|
92 syn keyword docbkKeyword keycode keycombo keysym keyword keywordset contained
|
|
93 syn keyword docbkKeyword label legalnotice lineage lineannotation contained
|
|
94 syn keyword docbkKeyword link listitem literal literallayout contained
|
|
95 syn keyword docbkKeyword manvolnum markup mathphrase mediaobject contained
|
|
96 syn keyword docbkKeyword member menuchoice methodname methodparam contained
|
|
97 syn keyword docbkKeyword methodsynopsis modifier mousebutton msg contained
|
|
98 syn keyword docbkKeyword msgaud msgentry msgexplan msginfo msglevel contained
|
|
99 syn keyword docbkKeyword msgmain msgorig msgrel msgset msgsub contained
|
|
100 syn keyword docbkKeyword msgtext note olink ooclass ooexception contained
|
|
101 syn keyword docbkKeyword oointerface option optional orderedlist contained
|
|
102 syn keyword docbkKeyword orgdiv orgname otheraddr othercredit contained
|
|
103 syn keyword docbkKeyword othername package pagenums para paramdef contained
|
|
104 syn keyword docbkKeyword parameter part partintro personblurb contained
|
|
105 syn keyword docbkKeyword personname phone phrase pob postcode contained
|
|
106 syn keyword docbkKeyword preface primary primaryie printhistory contained
|
|
107 syn keyword docbkKeyword procedure productname productnumber contained
|
|
108 syn keyword docbkKeyword programlisting programlistingco prompt contained
|
|
109 syn keyword docbkKeyword property pubdate publisher publishername contained
|
|
110 syn keyword docbkKeyword qandadiv qandaentry qandaset question quote contained
|
|
111 syn keyword docbkKeyword refclass refdescriptor refentry contained
|
7
|
112 syn keyword docbkKeyword refentrytitle reference refmeta refmiscinfo contained
|
|
113 syn keyword docbkKeyword refname refnamediv refpurpose refsect1 contained
|
3967
|
114 syn keyword docbkKeyword refsect2 refsect3 refsection refsynopsisdiv contained
|
|
115 syn keyword docbkKeyword releaseinfo remark replaceable returnvalue contained
|
|
116 syn keyword docbkKeyword revdescription revhistory revision contained
|
|
117 syn keyword docbkKeyword revnumber revremark row sbr screen screenco contained
|
|
118 syn keyword docbkKeyword screenshot secondary secondaryie sect1 contained
|
|
119 syn keyword docbkKeyword sect2 sect3 sect4 sect5 section see seealso contained
|
|
120 syn keyword docbkKeyword seealsoie seeie seg seglistitem contained
|
|
121 syn keyword docbkKeyword segmentedlist segtitle seriesvolnums set contained
|
|
122 syn keyword docbkKeyword setindex shortaffil shortcut sidebar contained
|
|
123 syn keyword docbkKeyword simpara simplelist simplemsgentry contained
|
|
124 syn keyword docbkKeyword simplesect spanspec state step contained
|
|
125 syn keyword docbkKeyword stepalternatives street subject subjectset contained
|
|
126 syn keyword docbkKeyword subjectterm subscript substeps subtitle contained
|
|
127 syn keyword docbkKeyword superscript surname symbol synopfragment contained
|
|
128 syn keyword docbkKeyword synopfragmentref synopsis systemitem table contained
|
|
129 syn keyword docbkKeyword task taskprerequisites taskrelated contained
|
|
130 syn keyword docbkKeyword tasksummary tbody td term termdef tertiary contained
|
|
131 syn keyword docbkKeyword tertiaryie textdata textobject tfoot tgroup contained
|
|
132 syn keyword docbkKeyword th thead tip title titleabbrev toc tocentry contained
|
|
133 syn keyword docbkKeyword token tr trademark type uri userinput contained
|
7
|
134 syn keyword docbkKeyword varargs variablelist varlistentry varname contained
|
3967
|
135 syn keyword docbkKeyword videodata videoobject void volumenum contained
|
|
136 syn keyword docbkKeyword warning wordasword xref year contained
|
|
137
|
|
138 if b:docbk_ver == 4
|
|
139 syn keyword docbkKeyword ackno action appendixinfo articleinfo contained
|
|
140 syn keyword docbkKeyword authorblurb beginpage bibliographyinfo contained
|
|
141 syn keyword docbkKeyword blockinfo bookinfo chapterinfo contained
|
|
142 syn keyword docbkKeyword collabname corpauthor corpcredit contained
|
|
143 syn keyword docbkKeyword corpname glossaryinfo graphic graphicco contained
|
|
144 syn keyword docbkKeyword highlights indexinfo inlinegraphic contained
|
|
145 syn keyword docbkKeyword interface invpartnumber isbn issn lot contained
|
|
146 syn keyword docbkKeyword lotentry medialabel mediaobjectco contained
|
|
147 syn keyword docbkKeyword modespec objectinfo partinfo contained
|
|
148 syn keyword docbkKeyword prefaceinfo pubsnumber refentryinfo contained
|
|
149 syn keyword docbkKeyword referenceinfo refsect1info refsect2info contained
|
|
150 syn keyword docbkKeyword refsect3info refsectioninfo contained
|
|
151 syn keyword docbkKeyword refsynopsisdivinfo screeninfo sect1info contained
|
|
152 syn keyword docbkKeyword sect2info sect3info sect4info sect5info contained
|
|
153 syn keyword docbkKeyword sectioninfo setindexinfo setinfo contained
|
|
154 syn keyword docbkKeyword sgmltag sidebarinfo structfield contained
|
|
155 syn keyword docbkKeyword structname tocback tocchap tocfront contained
|
|
156 syn keyword docbkKeyword toclevel1 toclevel2 toclevel3 toclevel4 contained
|
|
157 syn keyword docbkKeyword toclevel5 tocpart ulink contained
|
|
158
|
|
159 else
|
|
160 syn keyword docbkKeyword acknowledgements annotation arc contained
|
|
161 syn keyword docbkKeyword constraint constraintdef cover contained
|
|
162 syn keyword docbkKeyword extendedlink givenname info lhs locator contained
|
|
163 syn keyword docbkKeyword multimediaparam nonterminal org person contained
|
|
164 syn keyword docbkKeyword production productionrecap contained
|
|
165 syn keyword docbkKeyword productionset rhs tag tocdiv topic contained
|
|
166
|
|
167 endif
|
7
|
168
|
|
169 " Add special emphasis on some regions. Thanks to Rory Hunter <roryh@dcs.ed.ac.uk> for these ideas.
|
|
170 syn region docbkRegion start="<emphasis>"lc=10 end="</emphasis>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
|
|
171 syn region docbkTitle start="<title>"lc=7 end="</title>"me=e-8 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
|
|
172 syn region docbkRemark start="<remark>"lc=8 end="</remark>"me=e-9 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
|
|
173 syn region docbkRemark start="<comment>"lc=9 end="</comment>"me=e-10 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
|
|
174 syn region docbkCite start="<citation>"lc=10 end="</citation>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
|
|
175
|
|
176 " Define the default highlighting.
|
|
177 " For version 5.7 and earlier: only when not done already
|
|
178 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
179 if version >= 508 || !exists("did_docbk_syn_inits")
|
|
180 if version < 508
|
|
181 let did_docbk_syn_inits = 1
|
|
182 command -nargs=+ HiLink hi link <args>
|
|
183 hi DocbkBold term=bold cterm=bold gui=bold
|
|
184 else
|
|
185 command -nargs=+ HiLink hi def link <args>
|
|
186 hi def DocbkBold term=bold cterm=bold gui=bold
|
|
187 endif
|
|
188
|
|
189 HiLink docbkKeyword Statement
|
|
190 HiLink docbkRegion DocbkBold
|
|
191 HiLink docbkTitle Title
|
|
192 HiLink docbkRemark Comment
|
|
193 HiLink docbkCite Constant
|
|
194
|
|
195 delcommand HiLink
|
|
196 endif
|
|
197
|
|
198 let b:current_syntax = "docbk"
|
|
199
|
|
200 " vim: ts=8
|