Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: DocBook |
| 3 | " Maintainer: Devin Weaver <vim@tritarget.com> |
| 4 | " URL: http://tritarget.com/pub/vim/syntax/docbk.vim |
| 5 | " Last Change: 2002 Sep 04 |
| 6 | " Version: $Revision$ |
| 7 | " 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 |
| 17 | if version < 600 |
| 18 | syntax clear |
| 19 | elseif exists("b:current_syntax") |
| 20 | finish |
| 21 | endif |
| 22 | |
| 23 | " Auto detect added by Bram Moolenaar |
| 24 | if !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 |
| 30 | endif |
| 31 | if 'xml' == b:docbk_type |
| 32 | doau FileType xml |
| 33 | syn cluster xmlTagHook add=docbkKeyword |
| 34 | syn cluster xmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite |
| 35 | syn case match |
| 36 | elseif 'sgml' == b:docbk_type |
| 37 | doau FileType sgml |
| 38 | syn cluster sgmlTagHook add=docbkKeyword |
| 39 | syn cluster sgmlRegionHook add=docbkRegion,docbkTitle,docbkRemark,docbkCite |
| 40 | syn case ignore |
| 41 | endif |
| 42 | |
| 43 | " <comment> has been removed and replace with <remark> in DocBook 4.0 |
| 44 | " <comment> kept for backwards compatability. |
| 45 | syn keyword docbkKeyword abbrev abstract accel ackno acronym action contained |
| 46 | syn keyword docbkKeyword address affiliation alt anchor answer appendix contained |
| 47 | syn keyword docbkKeyword application area areaset areaspec arg artheader contained |
| 48 | syn keyword docbkKeyword article articleinfo artpagenums attribution audiodata contained |
| 49 | syn keyword docbkKeyword audioobject author authorblurb authorgroup contained |
| 50 | syn keyword docbkKeyword authorinitials beginpage bibliodiv biblioentry contained |
| 51 | syn keyword docbkKeyword bibliography bibliomisc bibliomixed bibliomset contained |
| 52 | syn keyword docbkKeyword biblioset blockquote book bookbiblio bookinfo contained |
| 53 | syn keyword docbkKeyword bridgehead callout calloutlist caption caution contained |
| 54 | syn keyword docbkKeyword chapter citation citerefentry citetitle city contained |
| 55 | syn keyword docbkKeyword classname cmdsynopsis co collab collabname contained |
| 56 | syn keyword docbkKeyword colophon colspec command comment computeroutput contained |
| 57 | syn keyword docbkKeyword confdates confgroup confnum confsponsor conftitle contained |
| 58 | syn keyword docbkKeyword constant contractnum contractsponsor contrib contained |
| 59 | syn keyword docbkKeyword copyright corpauthor corpname country database contained |
| 60 | syn keyword docbkKeyword date dedication docinfo edition editor email contained |
| 61 | syn keyword docbkKeyword emphasis entry entrytbl envar epigraph equation contained |
| 62 | syn keyword docbkKeyword errorcode errorname errortype example fax figure contained |
| 63 | syn keyword docbkKeyword filename firstname firstterm footnote footnoteref contained |
| 64 | syn keyword docbkKeyword foreignphrase formalpara funcdef funcparams contained |
| 65 | syn keyword docbkKeyword funcprototype funcsynopsis funcsynopsisinfo contained |
| 66 | syn keyword docbkKeyword function glossary glossdef glossdiv glossentry contained |
| 67 | syn keyword docbkKeyword glosslist glosssee glossseealso glossterm graphic contained |
| 68 | syn keyword docbkKeyword graphicco group guibutton guiicon guilabel contained |
| 69 | syn keyword docbkKeyword guimenu guimenuitem guisubmenu hardware contained |
| 70 | syn keyword docbkKeyword highlights holder honorific imagedata imageobject contained |
| 71 | syn keyword docbkKeyword imageobjectco important index indexdiv indexentry contained |
| 72 | syn keyword docbkKeyword indexterm informalequation informalexample contained |
| 73 | syn keyword docbkKeyword informalfigure informaltable inlineequation contained |
| 74 | syn keyword docbkKeyword inlinegraphic inlinemediaobject interface contained |
| 75 | syn keyword docbkKeyword interfacedefinition invpartnumber isbn issn contained |
| 76 | syn keyword docbkKeyword issuenum itemizedlist itermset jobtitle keycap contained |
| 77 | syn keyword docbkKeyword keycode keycombo keysym keyword keywordset label contained |
| 78 | syn keyword docbkKeyword legalnotice lineage lineannotation link listitem contained |
| 79 | syn keyword docbkKeyword literal literallayout lot lotentry manvolnum contained |
| 80 | syn keyword docbkKeyword markup medialabel mediaobject mediaobjectco contained |
| 81 | syn keyword docbkKeyword member menuchoice modespec mousebutton msg msgaud contained |
| 82 | syn keyword docbkKeyword msgentry msgexplan msginfo msglevel msgmain contained |
| 83 | syn keyword docbkKeyword msgorig msgrel msgset msgsub msgtext note contained |
| 84 | syn keyword docbkKeyword objectinfo olink option optional orderedlist contained |
| 85 | syn keyword docbkKeyword orgdiv orgname otheraddr othercredit othername contained |
| 86 | syn keyword docbkKeyword pagenums para paramdef parameter part partintro contained |
| 87 | syn keyword docbkKeyword phone phrase pob postcode preface primary contained |
| 88 | syn keyword docbkKeyword primaryie printhistory procedure productname contained |
| 89 | syn keyword docbkKeyword productnumber programlisting programlistingco contained |
| 90 | syn keyword docbkKeyword prompt property pubdate publisher publishername contained |
| 91 | syn keyword docbkKeyword pubsnumber qandadiv qandaentry qandaset question contained |
| 92 | syn keyword docbkKeyword quote refclass refdescriptor refentry contained |
| 93 | syn keyword docbkKeyword refentrytitle reference refmeta refmiscinfo contained |
| 94 | syn keyword docbkKeyword refname refnamediv refpurpose refsect1 contained |
| 95 | syn keyword docbkKeyword refsect1info refsect2 refsect2info refsect3 contained |
| 96 | syn keyword docbkKeyword refsect3info refsynopsisdiv refsynopsisdivinfo contained |
| 97 | syn keyword docbkKeyword releaseinfo remark replaceable returnvalue revhistory contained |
| 98 | syn keyword docbkKeyword revision revnumber revremark row sbr screen contained |
| 99 | syn keyword docbkKeyword screenco screeninfo screenshot secondary contained |
| 100 | syn keyword docbkKeyword secondaryie sect1 sect1info sect2 sect2info sect3 contained |
| 101 | syn keyword docbkKeyword sect3info sect4 sect4info sect5 sect5info section contained |
| 102 | syn keyword docbkKeyword sectioninfo see seealso seealsoie seeie seg contained |
| 103 | syn keyword docbkKeyword seglistitem segmentedlist segtitle seriesinfo contained |
| 104 | syn keyword docbkKeyword seriesvolnums set setindex setinfo sgmltag contained |
| 105 | syn keyword docbkKeyword shortaffil shortcut sidebar simpara simplelist contained |
| 106 | syn keyword docbkKeyword simplesect spanspec state step street structfield contained |
| 107 | syn keyword docbkKeyword structname subject subjectset subjectterm contained |
| 108 | syn keyword docbkKeyword subscript substeps subtitle superscript surname contained |
| 109 | syn keyword docbkKeyword symbol synopfragment synopfragmentref synopsis contained |
| 110 | syn keyword docbkKeyword systemitem table tbody term tertiary tertiaryie contained |
| 111 | syn keyword docbkKeyword textobject tfoot tgroup thead tip title contained |
| 112 | syn keyword docbkKeyword titleabbrev toc tocback tocchap tocentry tocfront contained |
| 113 | syn keyword docbkKeyword toclevel1 toclevel2 toclevel3 toclevel4 toclevel5 contained |
| 114 | syn keyword docbkKeyword tocpart token trademark type ulink userinput contained |
| 115 | syn keyword docbkKeyword varargs variablelist varlistentry varname contained |
| 116 | syn keyword docbkKeyword videodata videoobject void volumenum warning contained |
| 117 | syn 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. |
| 120 | syn region docbkRegion start="<emphasis>"lc=10 end="</emphasis>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend |
| 121 | syn region docbkTitle start="<title>"lc=7 end="</title>"me=e-8 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend |
| 122 | syn region docbkRemark start="<remark>"lc=8 end="</remark>"me=e-9 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend |
| 123 | syn region docbkRemark start="<comment>"lc=9 end="</comment>"me=e-10 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend |
| 124 | syn 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 |
| 129 | if 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 |
| 146 | endif |
| 147 | |
| 148 | let b:current_syntax = "docbk" |
| 149 | |
| 150 | " vim: ts=8 |