forked from papyri/xsugar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commentary.xsg
140 lines (108 loc) · 4.56 KB
/
commentary.xsg
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
xmlns:xml = "http://www.w3.org/XML/1998/namespace"
NL = [\r\n]+
BEGP = [\n]{2}
BEGWRAP = "<W:"
ENDWRAP = ":W>"
PN_URL = ((ddbdp/)|(hgv/)|(dclp/)|(apis/)|(biblio/))
NUM_RNG_WHL = ([0-9]+\-{1}[0-9]+|[0-9]+|[IVXLCDM]+\-{1}[IVXLCDM]+|[IVXLCDM]+|[ivxlcdm]+\-{1}[ivxlcdm]+|[ivxlcdm]+)
//same as WORDSLOOSE except for slashes and tab, no line returns, and no + for 1 or more and no MAX designator
ANYLETTER = [^\/\\\t<>_\*\|]
//very permisive for free text, only remove what is in grammar
WORDSLOOSE = ([^\n\r<>_\*\|]+) (MAX)
//stops at :> at end of link or footnote grammar - stops at '|' in links
URL_LOOSE = ([^\|>]+[^\|\:>]{1}) (MAX)
//used for text portion of link - stops at '|' in links
TEXT_LOOSE = ([^\n\r\|]+) (MAX)
wrap
: [BEGWRAP] [items i] [ENDWRAP] = <wrap>[items i]</>
items
: [item i] [items more] = [item i] [items more]
>: [item p] = [item p]
item
: [paragraph p] = [paragraph p]
: [footnote f] = [footnote f]
: [bib b] = [bib b]
: [url u] = [url u]
: [emphasis_bold eb] = [emphasis_bold eb]
: [emphasis_italics ei] = [emphasis_italics ei]
: [emphasis_underline el] = [emphasis_underline el]
>: [newline nl] = [newline nl]
>: [item_can_nest icn] = [item_can_nest icn]
item_can_nest
: [WORDSLOOSE w] = [WORDSLOOSE w]
>: [ANYLETTER a] = [ANYLETTER a]
paragraph_item_not_nest
:[paragraph_item bi] [paragraph_item_not_nest more] = [paragraph_item bi] [paragraph_item_not_nest more]
>:[paragraph_item bi] = [paragraph_item bi]
paragraph_item
: [footnote f] = [footnote f]
: [bib b] = [bib b]
: [url u] = [url u]
: [emphasis_bold eb] = [emphasis_bold eb]
: [emphasis_italics ei] = [emphasis_italics ei]
: [emphasis_underline el] = [emphasis_underline el]
>: [item_can_nest icn] = [item_can_nest icn]
bold_item_not_nest
:[bold_item bi] [bold_item_not_nest more] = [bold_item bi] [bold_item_not_nest more]
>:[bold_item bi] = [bold_item bi]
bold_item
: [footnote f] = [footnote f]
: [paragraph p] = [paragraph p]
: [bib b] = [bib b]
: [url u] = [url u]
: [emphasis_italics ei] = [emphasis_italics ei]
: [emphasis_underline el] = [emphasis_underline el]
>: [item_can_nest icn] = [item_can_nest icn]
italic_item_not_nest
:[italic_item ii] [italic_item_not_nest more] = [italic_item ii] [italic_item_not_nest more]
>:[italic_item ii] = [italic_item ii]
italic_item
: [footnote f] = [footnote f]
: [paragraph p] = [paragraph p]
: [bib b] = [bib b]
: [url u] = [url u]
: [emphasis_bold eb] = [emphasis_bold eb]
: [emphasis_underline el] = [emphasis_underline el]
>: [item_can_nest icn] = [item_can_nest icn]
underline_item_not_nest
:[underline_item ui] [underline_item_not_nest more] = [underline_item ui] [underline_item_not_nest more]
>:[underline_item ui] = [underline_item ui]
underline_item
: [footnote f] = [footnote f]
: [paragraph p] = [paragraph p]
: [bib b] = [bib b]
: [url u] = [url u]
: [emphasis_bold eb] = [emphasis_bold eb]
: [emphasis_italics ei] = [emphasis_italics ei]
>: [item_can_nest icn] = [item_can_nest icn]
paragraph
: [BEGP] [paragraph_item_not_nest pinn] = <p>[paragraph_item_not_nest pinn]</>
footnote
: "<:fn=" [URL_LOOSE text] ":>" = <note type="footnote" xml:lang="en">[URL_LOOSE text]</>
pn_target
: [PN_URL pnurl][URL_LOOSE url] = "http://papyri.info/" [PN_URL pnurl][URL_LOOSE url]
>: [URL_LOOSE url] = "http://" [URL_LOOSE url]
url
: "<:" [TEXT_LOOSE text] "|" [pn_target pt] ":>" = <ref target=[pn_target pt]>[TEXT_LOOSE text]</>
bib_target
: "bibl/" [URL_LOOSE url] = "http://" [URL_LOOSE url]
bib_scope
: [bib_scope_detail bsd] [bib_scope more] = [bib_scope_detail bsd] [bib_scope more]
: [bib_scope_detail bsd] = [bib_scope_detail bsd]
: =
bib_scope_detail
: "|v=" [NUM_RNG_WHL nrw] = <biblScope unit="vol">[NUM_RNG_WHL nrw]</>
: "|i=" [NUM_RNG_WHL nrw] = <biblScope unit="issue">[NUM_RNG_WHL nrw]</>
: "|p=" [NUM_RNG_WHL nrw] = <biblScope unit="pp">[NUM_RNG_WHL nrw]</>
: "|l=" [NUM_RNG_WHL nrw] = <biblScope unit="ll">[NUM_RNG_WHL nrw]</>
: "|ch=" [NUM_RNG_WHL nrw] = <biblScope unit="chap">[NUM_RNG_WHL nrw]</>
bib
: "<:" [WORDSLOOSE text] "|" [bib_target bt] [bib_scope bs] ":>" = <listBibl><bibl><ref target=[bib_target bt]>[WORDSLOOSE text]</>[bib_scope bs]</></>
emphasis_bold
: "*" [bold_item_not_nest binn] "*" = <emph rend="bold">[bold_item_not_nest binn]</>
emphasis_italics
: "|" [italic_item_not_nest iinn] "|" = <emph rend="italics">[italic_item_not_nest iinn]</>
emphasis_underline
: "_" [underline_item_not_nest uinn] "_" = <emph rend="underline">[underline_item_not_nest uinn]</>
newline
: [NL n] = [NL n]