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