blob: 73c1cb475114b886750ee62e094342492f616c64 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: DocBook
3" Maintainer: Devin Weaver <vim@tritarget.com>
4" URL: http://tritarget.com/pub/vim/syntax/docbk.vim
Bram Moolenaar5c736222010-01-06 20:54:52 +01005" Last Change: $Date: 2005/06/23 22:31:01 $
6" Version: $Revision: 1.2 $
Bram Moolenaar071d4272004-06-13 20:20:40 +00007" Thanks to Johannes Zellner <johannes@zellner.org> for the default to XML
8" suggestion.
9
10" REFERENCES:
11" http://docbook.org/
12" http://www.open-oasis.org/docbook/
13"
14
15" For version 5.x: Clear all syntax items
16" For version 6.x: Quit when a syntax file was already loaded
17if version < 600
18 syntax clear
19elseif exists("b:current_syntax")
20 finish
21endif
22
23" Auto detect added by Bram Moolenaar
24if !exists('b:docbk_type')
25 if expand('%:e') == "sgml"
26 let b:docbk_type = 'sgml'
27 else
28 let b:docbk_type = 'xml'
29 endif
30endif
31if 'xml' == b:docbk_type
Bram Moolenaar47cc7522005-06-23 22:31:01 +000032 doau Syntax xml
Bram Moolenaar071d4272004-06-13 20:20:40 +000033 syn cluster xmlTagHook add=docbkKeyword
34 syn cluster xmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite
35 syn case match
36elseif 'sgml' == b:docbk_type
Bram Moolenaar47cc7522005-06-23 22:31:01 +000037 doau Syntax sgml
Bram Moolenaar071d4272004-06-13 20:20:40 +000038 syn cluster sgmlTagHook add=docbkKeyword
39 syn cluster sgmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite
40 syn case ignore
41endif
42
43" <comment> has been removed and replace with <remark> in DocBook 4.0
44" <comment> kept for backwards compatability.
45syn keyword docbkKeyword abbrev abstract accel ackno acronym action contained
46syn keyword docbkKeyword address affiliation alt anchor answer appendix contained
47syn keyword docbkKeyword application area areaset areaspec arg artheader contained
48syn keyword docbkKeyword article articleinfo artpagenums attribution audiodata contained
49syn keyword docbkKeyword audioobject author authorblurb authorgroup contained
50syn keyword docbkKeyword authorinitials beginpage bibliodiv biblioentry contained
51syn keyword docbkKeyword bibliography bibliomisc bibliomixed bibliomset contained
52syn keyword docbkKeyword biblioset blockquote book bookbiblio bookinfo contained
53syn keyword docbkKeyword bridgehead callout calloutlist caption caution contained
54syn keyword docbkKeyword chapter citation citerefentry citetitle city contained
55syn keyword docbkKeyword classname cmdsynopsis co collab collabname contained
56syn keyword docbkKeyword colophon colspec command comment computeroutput contained
57syn keyword docbkKeyword confdates confgroup confnum confsponsor conftitle contained
58syn keyword docbkKeyword constant contractnum contractsponsor contrib contained
59syn keyword docbkKeyword copyright corpauthor corpname country database contained
60syn keyword docbkKeyword date dedication docinfo edition editor email contained
61syn keyword docbkKeyword emphasis entry entrytbl envar epigraph equation contained
62syn keyword docbkKeyword errorcode errorname errortype example fax figure contained
63syn keyword docbkKeyword filename firstname firstterm footnote footnoteref contained
64syn keyword docbkKeyword foreignphrase formalpara funcdef funcparams contained
65syn keyword docbkKeyword funcprototype funcsynopsis funcsynopsisinfo contained
66syn keyword docbkKeyword function glossary glossdef glossdiv glossentry contained
67syn keyword docbkKeyword glosslist glosssee glossseealso glossterm graphic contained
68syn keyword docbkKeyword graphicco group guibutton guiicon guilabel contained
69syn keyword docbkKeyword guimenu guimenuitem guisubmenu hardware contained
70syn keyword docbkKeyword highlights holder honorific imagedata imageobject contained
71syn keyword docbkKeyword imageobjectco important index indexdiv indexentry contained
72syn keyword docbkKeyword indexterm informalequation informalexample contained
73syn keyword docbkKeyword informalfigure informaltable inlineequation contained
74syn keyword docbkKeyword inlinegraphic inlinemediaobject interface contained
75syn keyword docbkKeyword interfacedefinition invpartnumber isbn issn contained
76syn keyword docbkKeyword issuenum itemizedlist itermset jobtitle keycap contained
77syn keyword docbkKeyword keycode keycombo keysym keyword keywordset label contained
78syn keyword docbkKeyword legalnotice lineage lineannotation link listitem contained
79syn keyword docbkKeyword literal literallayout lot lotentry manvolnum contained
80syn keyword docbkKeyword markup medialabel mediaobject mediaobjectco contained
81syn keyword docbkKeyword member menuchoice modespec mousebutton msg msgaud contained
82syn keyword docbkKeyword msgentry msgexplan msginfo msglevel msgmain contained
83syn keyword docbkKeyword msgorig msgrel msgset msgsub msgtext note contained
84syn keyword docbkKeyword objectinfo olink option optional orderedlist contained
85syn keyword docbkKeyword orgdiv orgname otheraddr othercredit othername contained
86syn keyword docbkKeyword pagenums para paramdef parameter part partintro contained
87syn keyword docbkKeyword phone phrase pob postcode preface primary contained
88syn keyword docbkKeyword primaryie printhistory procedure productname contained
89syn keyword docbkKeyword productnumber programlisting programlistingco contained
90syn keyword docbkKeyword prompt property pubdate publisher publishername contained
91syn keyword docbkKeyword pubsnumber qandadiv qandaentry qandaset question contained
92syn keyword docbkKeyword quote refclass refdescriptor refentry contained
93syn keyword docbkKeyword refentrytitle reference refmeta refmiscinfo contained
94syn keyword docbkKeyword refname refnamediv refpurpose refsect1 contained
95syn keyword docbkKeyword refsect1info refsect2 refsect2info refsect3 contained
96syn keyword docbkKeyword refsect3info refsynopsisdiv refsynopsisdivinfo contained
97syn keyword docbkKeyword releaseinfo remark replaceable returnvalue revhistory contained
98syn keyword docbkKeyword revision revnumber revremark row sbr screen contained
99syn keyword docbkKeyword screenco screeninfo screenshot secondary contained
100syn keyword docbkKeyword secondaryie sect1 sect1info sect2 sect2info sect3 contained
101syn keyword docbkKeyword sect3info sect4 sect4info sect5 sect5info section contained
102syn keyword docbkKeyword sectioninfo see seealso seealsoie seeie seg contained
103syn keyword docbkKeyword seglistitem segmentedlist segtitle seriesinfo contained
104syn keyword docbkKeyword seriesvolnums set setindex setinfo sgmltag contained
105syn keyword docbkKeyword shortaffil shortcut sidebar simpara simplelist contained
106syn keyword docbkKeyword simplesect spanspec state step street structfield contained
107syn keyword docbkKeyword structname subject subjectset subjectterm contained
108syn keyword docbkKeyword subscript substeps subtitle superscript surname contained
109syn keyword docbkKeyword symbol synopfragment synopfragmentref synopsis contained
110syn keyword docbkKeyword systemitem table tbody term tertiary tertiaryie contained
111syn keyword docbkKeyword textobject tfoot tgroup thead tip title contained
112syn keyword docbkKeyword titleabbrev toc tocback tocchap tocentry tocfront contained
113syn keyword docbkKeyword toclevel1 toclevel2 toclevel3 toclevel4 toclevel5 contained
114syn keyword docbkKeyword tocpart token trademark type ulink userinput contained
115syn keyword docbkKeyword varargs variablelist varlistentry varname contained
116syn keyword docbkKeyword videodata videoobject void volumenum warning contained
117syn keyword docbkKeyword wordasword xref year contained
118
119" Add special emphasis on some regions. Thanks to Rory Hunter <roryh@dcs.ed.ac.uk> for these ideas.
120syn region docbkRegion start="<emphasis>"lc=10 end="</emphasis>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
121syn region docbkTitle start="<title>"lc=7 end="</title>"me=e-8 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
122syn region docbkRemark start="<remark>"lc=8 end="</remark>"me=e-9 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
123syn region docbkRemark start="<comment>"lc=9 end="</comment>"me=e-10 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
124syn region docbkCite start="<citation>"lc=10 end="</citation>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
125
126" Define the default highlighting.
127" For version 5.7 and earlier: only when not done already
128" For version 5.8 and later: only when an item doesn't have highlighting yet
129if version >= 508 || !exists("did_docbk_syn_inits")
130 if version < 508
131 let did_docbk_syn_inits = 1
132 command -nargs=+ HiLink hi link <args>
133 hi DocbkBold term=bold cterm=bold gui=bold
134 else
135 command -nargs=+ HiLink hi def link <args>
136 hi def DocbkBold term=bold cterm=bold gui=bold
137 endif
138
139 HiLink docbkKeyword Statement
140 HiLink docbkRegion DocbkBold
141 HiLink docbkTitle Title
142 HiLink docbkRemark Comment
143 HiLink docbkCite Constant
144
145 delcommand HiLink
146endif
147
148let b:current_syntax = "docbk"
149
150" vim: ts=8