summaryrefslogtreecommitdiff
path: root/dot_local/share/gtksourceview-4/language-specs/gemini.lang
blob: c9278f584404f835141d073b3f698f0a9eeb486f (plain) (blame)
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- v0.14.2 -->
<language id="gemini" name="Gemini" version="2.0" _section="Markup">
	<metadata>
		<property name="mimetypes">text/gemini</property>
		<property name="globs">*.gmi</property>
	</metadata>

	<styles>
		<style id="link-marker" name="Link Marker" map-to="def:link-symbol" />
		<style id="link" name="Link" map-to="def:link-destination" />
		<style id="link-title" name="Link Title" map-to="def:link-text" />

		<style id="pre" name="Preformatted" map-to="def:preformatted-section" />
		<style id="pre-alt" name="Preformatted Alt Text" map-to="def:emphasis" />

		<style id="header" name="Header" map-to="def:heading" />

		<style id="list" name="Unordered List" map-to="def:list-marker" />

		<style id="blockquote" name="Blockquote" map-to="def:insertion" />
	</styles>

	<definitions>
		<!-- Examples:
			=> url Link
			=> url
			=>url Link
			=>url
		-->
		<context id="link">
			<match extended="true">
				^
				(=>)   # identifier
				[ ]?   # optional whitespace
				(\S+)  # the link
				( .*)? # the title
				$
			</match>
			<include>
				<context sub-pattern="1" style-ref="link-marker" />
				<context sub-pattern="2" class="no-spell-check" style-ref="link" />
				<context sub-pattern="3" style-ref="link-title" />
			</include>
		</context>

		<!-- Starts with ``` and ends with ``` -->
		<context id="pre" class="no-spell-check" style-ref="pre">
			<start>^```(.*)$</start>
			<end>^```</end> <!-- technically it's not valid to have anything after this, but the failure conditional is undesirable -->
			<include>
				<context sub-pattern="1" where="start" style-ref="pre-alt" />
			</include>
		</context>
	
		<!-- Examples:
    		# Header 1
    		## Header 2
    		###Header 3
    	-->
    	<context id="header" style-ref="header">
    		<match>^#{1,3}.+$</match>
    	</context>

		<!-- Examples:
			* list1
			* list2
		-->
		<context id="list" style-ref="list">
			<match>^\* </match>
		</context>

		<!-- Examples:
			> line1
			> an entirely unrelated line
		-->
		<context id="blockquote" style-ref="blockquote">
			<match>^>.+$</match>
		</context>
		
		<context id="gemini">
			<include>
				<context ref="link" />
				<context ref="pre" />
				<context ref="header" />
				<context ref="list" />
				<context ref="blockquote" />
			</include>
		</context>
	</definitions>
</language>