xref: /vim-8.2.3635/runtime/syntax/docbk.vim (revision 36e294c0)
1" Vim syntax file
2" Language:	DocBook
3" Maintainer:	Devin Weaver <[email protected]>
4" Last Updated By: Shlomi Fish
5" URL:		http://tritarget.com/pub/vim/syntax/docbk.vim
6" Last Change:	2012 Nov 28
7" Version:	1.2 (and modified after that)
8" Thanks to Johannes Zellner <[email protected]> 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
18if version < 600
19  syntax clear
20elseif exists("b:current_syntax")
21  finish
22endif
23
24" Auto detect added by Bram Moolenaar
25if !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
31endif
32
33if !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
39end
40
41if 'xml' == b:docbk_type
42    doau Syntax xml
43    syn cluster xmlTagHook add=docbkKeyword
44    syn cluster xmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite
45    syn case match
46elseif 'sgml' == b:docbk_type
47    doau Syntax sgml
48    syn cluster sgmlTagHook add=docbkKeyword
49    syn cluster sgmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite
50    syn case ignore
51endif
52
53syn keyword docbkKeyword abbrev abstract accel acronym address contained
54syn keyword docbkKeyword affiliation alt anchor answer appendix contained
55syn keyword docbkKeyword application area areaset areaspec arg contained
56syn keyword docbkKeyword article artpagenums attribution audiodata contained
57syn keyword docbkKeyword audioobject author authorgroup contained
58syn keyword docbkKeyword authorinitials bibliocoverage bibliodiv contained
59syn keyword docbkKeyword biblioentry bibliography biblioid contained
60syn keyword docbkKeyword bibliolist bibliomisc bibliomixed contained
61syn keyword docbkKeyword bibliomset biblioref bibliorelation contained
62syn keyword docbkKeyword biblioset bibliosource blockquote book contained
63syn keyword docbkKeyword bridgehead callout calloutlist caption contained
64syn keyword docbkKeyword caution chapter citation citebiblioid contained
65syn keyword docbkKeyword citerefentry citetitle city classname contained
66syn keyword docbkKeyword classsynopsis classsynopsisinfo cmdsynopsis contained
67syn keyword docbkKeyword co code col colgroup collab colophon contained
68syn keyword docbkKeyword colspec command computeroutput confdates contained
69syn keyword docbkKeyword confgroup confnum confsponsor conftitle contained
70syn keyword docbkKeyword constant constructorsynopsis contractnum contained
71syn keyword docbkKeyword contractsponsor contrib copyright coref contained
72syn keyword docbkKeyword country database date dedication contained
73syn keyword docbkKeyword destructorsynopsis edition editor email contained
74syn keyword docbkKeyword emphasis entry entrytbl envar epigraph contained
75syn keyword docbkKeyword equation errorcode errorname errortext contained
76syn keyword docbkKeyword errortype example exceptionname fax contained
77syn keyword docbkKeyword fieldsynopsis figure filename firstname contained
78syn keyword docbkKeyword firstterm footnote footnoteref contained
79syn keyword docbkKeyword foreignphrase formalpara funcdef funcparams contained
80syn keyword docbkKeyword funcprototype funcsynopsis funcsynopsisinfo contained
81syn keyword docbkKeyword function glossary glossdef glossdiv contained
82syn keyword docbkKeyword glossentry glosslist glosssee glossseealso contained
83syn keyword docbkKeyword glossterm group guibutton guiicon guilabel contained
84syn keyword docbkKeyword guimenu guimenuitem guisubmenu hardware contained
85syn keyword docbkKeyword holder honorific imagedata imageobject contained
86syn keyword docbkKeyword imageobjectco important index indexdiv contained
87syn keyword docbkKeyword indexentry indexterm informalequation contained
88syn keyword docbkKeyword informalexample informalfigure contained
89syn keyword docbkKeyword informaltable initializer inlineequation contained
90syn keyword docbkKeyword inlinemediaobject interfacename issuenum contained
91syn keyword docbkKeyword itemizedlist itermset jobtitle keycap contained
92syn keyword docbkKeyword keycode keycombo keysym keyword keywordset contained
93syn keyword docbkKeyword label legalnotice lineage lineannotation contained
94syn keyword docbkKeyword link listitem literal literallayout contained
95syn keyword docbkKeyword manvolnum markup mathphrase mediaobject contained
96syn keyword docbkKeyword member menuchoice methodname methodparam contained
97syn keyword docbkKeyword methodsynopsis modifier mousebutton msg contained
98syn keyword docbkKeyword msgaud msgentry msgexplan msginfo msglevel contained
99syn keyword docbkKeyword msgmain msgorig msgrel msgset msgsub contained
100syn keyword docbkKeyword msgtext note olink ooclass ooexception contained
101syn keyword docbkKeyword oointerface option optional orderedlist contained
102syn keyword docbkKeyword orgdiv orgname otheraddr othercredit contained
103syn keyword docbkKeyword othername package pagenums para paramdef contained
104syn keyword docbkKeyword parameter part partintro personblurb contained
105syn keyword docbkKeyword personname phone phrase pob postcode contained
106syn keyword docbkKeyword preface primary primaryie printhistory contained
107syn keyword docbkKeyword procedure productname productnumber contained
108syn keyword docbkKeyword programlisting programlistingco prompt contained
109syn keyword docbkKeyword property pubdate publisher publishername contained
110syn keyword docbkKeyword qandadiv qandaentry qandaset question quote contained
111syn keyword docbkKeyword refclass refdescriptor refentry contained
112syn keyword docbkKeyword refentrytitle reference refmeta refmiscinfo contained
113syn keyword docbkKeyword refname refnamediv refpurpose refsect1 contained
114syn keyword docbkKeyword refsect2 refsect3 refsection refsynopsisdiv contained
115syn keyword docbkKeyword releaseinfo remark replaceable returnvalue contained
116syn keyword docbkKeyword revdescription revhistory revision contained
117syn keyword docbkKeyword revnumber revremark row sbr screen screenco contained
118syn keyword docbkKeyword screenshot secondary secondaryie sect1 contained
119syn keyword docbkKeyword sect2 sect3 sect4 sect5 section see seealso contained
120syn keyword docbkKeyword seealsoie seeie seg seglistitem contained
121syn keyword docbkKeyword segmentedlist segtitle seriesvolnums set contained
122syn keyword docbkKeyword setindex shortaffil shortcut sidebar contained
123syn keyword docbkKeyword simpara simplelist simplemsgentry contained
124syn keyword docbkKeyword simplesect spanspec state step contained
125syn keyword docbkKeyword stepalternatives street subject subjectset contained
126syn keyword docbkKeyword subjectterm subscript substeps subtitle contained
127syn keyword docbkKeyword superscript surname symbol synopfragment contained
128syn keyword docbkKeyword synopfragmentref synopsis systemitem table contained
129syn keyword docbkKeyword task taskprerequisites taskrelated contained
130syn keyword docbkKeyword tasksummary tbody td term termdef tertiary contained
131syn keyword docbkKeyword tertiaryie textdata textobject tfoot tgroup contained
132syn keyword docbkKeyword th thead tip title titleabbrev toc tocentry contained
133syn keyword docbkKeyword token tr trademark type uri userinput contained
134syn keyword docbkKeyword varargs variablelist varlistentry varname contained
135syn keyword docbkKeyword videodata videoobject void volumenum contained
136syn keyword docbkKeyword warning wordasword xref year contained
137
138if 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
159else
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
167endif
168
169" Add special emphasis on some regions. Thanks to Rory Hunter <[email protected]> for these ideas.
170syn region docbkRegion start="<emphasis>"lc=10 end="</emphasis>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
171syn region docbkTitle  start="<title>"lc=7     end="</title>"me=e-8	contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
172syn region docbkRemark start="<remark>"lc=8    end="</remark>"me=e-9	contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
173syn region docbkRemark start="<comment>"lc=9  end="</comment>"me=e-10	contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
174syn 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
179if 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
196endif
197
198let b:current_syntax = "docbk"
199
200" vim: ts=8
201