summaryrefslogtreecommitdiffstats
path: root/kate/data/bibtex.xml
blob: 61c734da18c9c83d67dd3d7ce7bdc7ef5ccbc502 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
	  [
	  <!ENTITY stringVariable   	"[a-zA-Z0-9\-]+">
	  <!ENTITY fieldFormat    	"[a-zA-Z0-9\-_\.]+">
	  <!ENTITY latexCmd	  	"\\([a-zA-Z@]+|[^ ])">
	  <!ENTITY refKeyFormat  	"[a-zA-Z0-9_@\\-\\:]+"> <!--taken from kile 2.0.3-->
	  ]>
<language name="BibTeX" version="1.18" kateversion="2.5" extensions="*.bib" section="Markup" mimetype="text/x-bib" casesensitive="1" author="Jeroen Wijnhout ([email protected])+Thomas Braun ([email protected])" license="LGPL">
  <highlighting>
    <list name="kw_entry">
      <item>@article</item> 
      <item>@book</item> 
      <item>@booklet</item> 
      <item>@conference</item> 
      <item>@collection</item>
      <item>@electronic</item>
      <item>@inbook</item> 
      <item>@incollection</item> 
      <item>@inproceedings</item> 
      <item>@manual</item> 
      <item>@mastersthesis</item> 
      <item>@misc</item>
      <item>@online</item>
      <item>@patent</item>
      <item>@periodical</item>
      <item>@proceedings</item>
      <item>@report</item>
      <item>@phdthesis</item>
      <item>@set</item>
      <item>@thesis</item> 
      <item>@techreport</item> 
      <item>@unpublished</item>
      <item>@www</item>
      <item>@person</item> <!--all three from the directory package-->
      <item>@company</item>
      <item>@place</item>
    </list>
    <contexts>
      <context name="Normal" attribute="Comment" lineEndContext="#stay">
        <keyword String="kw_entry" attribute="Entry" context="Entry"/>
	<StringDetect String="@string" attribute="Command" insensitive="true" context="StringCommand"/>
	<StringDetect String="@preamble" attribute="Command" insensitive="true" context="PreambleCommand"/>
	<StringDetect String="@comment" attribute="Comment" insensitive="true" context="#stay"/> <!--nothing special needed here-->
    </context>

	<context name="PreambleCommand" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#stay" >
		<DetectChar char="{" context="CurlyBracket" />
	</context>
	
	<context name="StringCommand" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#stay" >
		<DetectChar char="{" context="CurlyBracket" />
		<RegExpr String="&stringVariable;" attribute="String" context="CurlyBracket"/>
      </context>

      <context name="Entry" attribute="Normal Text" lineEndContext="#stay">
	      <DetectChar char="{"  context="#stay" beginRegion="block" />
	      <RegExpr String="&refKeyFormat;" attribute="Ref Key" context="#stay"/>
	      <DetectChar char="," context="Field"/>
	      <DetectChar char="}" attribute="Normal Text" context="#pop" endRegion="block" />
      </context>

      <context name="Field" attribute="Normal Text" lineEndContext="#stay">
	      <RegExpr String="&fieldFormat;" attribute="Field" firstNonSpace="true"/>
	      <DetectSpaces/>
	      <DetectChar char="=" context="#stay"/>
	      <DetectSpaces/>
	      <DetectChar char="{" context="CurlyBracket"/>
	      <DetectChar char="}" context="#pop" lookAhead="true"/>
	      <DetectChar char="&quot;"  attribute="Normal Text" context="QuotedText"/>
	      <DetectChar char="," context="#stay"/>
	      <DetectChar char="#" context="#stay"/> <!-- the bibtex string concatenate character -->
	      <RegExpr String="[0-9]+" context="#stay"/>
	      <RegExpr String="&stringVariable;" attribute="String" /> <!-- assume this is a variable created with @String -->
	      <DetectSpaces/>
	      <RegExpr String="." attribute="Error" context="#stay"/> <!--this rule catches all errors-->
      </context>

      <context name="CurlyBracket" attribute="Normal Text" lineEndContext="#stay">
	      <DetectChar char="{" context="CurlyBracket"/>
	      <RegExpr String="&latexCmd;" attribute="LatexCommand" context="#stay"/>
	      <RegExpr String="}$" context="#pop#pop"/>
	      <DetectChar char="}" context="#pop"/>
      </context>

      <context name="QuotedText" attribute="String" lineEndContext="#stay">
	      <DetectChar char="&quot;" attribute="Normal Text" context="#pop"/>
	      <RegExpr String="&latexCmd;" attribute="LatexCommand" context="#stay"/>
      </context>

    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Entry" defStyleNum="dsKeyword" color="#0000ff" spellChecking="false"/>
      <itemData name="Command" defStyleNum="dsFunction" spellChecking="false"/>
      <itemData name="Field" defStyleNum="dsDataType" spellChecking="false"/>
      <itemData name="Ref Key" defStyleNum="dsOthers" spellChecking="false"/>
      <itemData name="LatexCommand" defStyleNum="dsChar" spellChecking="false"/>
      <itemData name="Comment" defStyleNum="dsComment" spellChecking="false"/>
      <itemData name="Error" defStyleNum="dsAlert" spellChecking="false"/>
      <itemData name="String" defStyleNum="dsString" spellChecking="true"/>
</itemDatas>
  </highlighting>
  <general>
   <keywords casesensitive="0" weakDeliminator="\" wordWrapDeliminator=",{}[]"/>
  </general>
</language>