summaryrefslogtreecommitdiff
path: root/testdata/integration/user_defined_syntax/wikilike.in.osml
blob: 9bc80c75609109f7c640ed13f8e940d7ead618e0 (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
\begin{document}

\ontology#book{
	\struct#book[root=true]
		\field
			\childRef[ref=section]
			\childRef[ref=paragraph]
	\struct#section
		\primitive#title[type=string,subtree=true]
			\syntax
				\open{==}
				\close{==}
		\field
			\childRef[ref=paragraph]
	\struct#paragraph[transparent=true]
		\syntax
			\close{\paragraph}
		\field
			\childRef[ref=text]
			\childRef[ref=code]
			\childRef[ref=speech]
			\childRef[ref=thought]
	\struct#code
		\syntax
			\open{`}
			\close{`}
		\field
			\childRef[ref=text]
	\struct#speech
		\syntax
			\open{<<}
			\close{>>}
		\fieldRef[ref=paragraph.$default]
	\struct#text[transparent=true]
		\primitive[type=string]
	\struct#thought
		\syntax
			\short{--}
}

\begin{book}
== This tests somewhat plays with user defined syntax ==

As you -- surely -- can see, just the tiny `\\syntax` definitions above make writing documents
much easier.

For instance, this is a new paragraph.

And here goes another one.

All with the power of just adding `\\close\{\\paragraph\}` to the `\\syntax`
definition of the paragraph structure.

<<Well, that's insane!>>, I hear you say. Right so! This indeed is insane.

== One last thing ==

Did you notice how we started sections here?

Sections can be allowed to use Wiki-like syntax with only three lines of code. Awesome!
\end{book}
\end{document}