Skip to content

Commit ee9ff50

Browse files
committed
Added a function that returns a C struct for navigation.
1 parent 09189eb commit ee9ff50

File tree

16 files changed

+531
-244
lines changed

16 files changed

+531
-244
lines changed

c-example/Rules/Braille/UEB/unicode.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- "<": [t: "⠈⠣"] # 0x003C (Less than)
2222
- "": [t: "⠸⠈⠣"] # 0x2264 (Less than or equal to)
2323
- ">": [t: "⠈⠜"] # 0x003E (Greater than)
24-
- "": [t: "⠸⠠⠤"] # 0x2263
24+
- "": [t: "⠸⠠⠤"] # 0x2263
2525
- "": [t: "⠸⠈⠜"] # 0x2265 (Greater than or equal to)
2626
- "": [t: "⠨⠈⠣"] # 0x226A (Much less than)
2727
- "": [t: "⠨⠈⠜"] # 0x226B (Much greater than)
@@ -52,7 +52,7 @@
5252
- "": [t: "⠈⠸⠜"] # 0x22B3 (Contains as normal subgroup)
5353
- "": [t: "⠸⠸⠣"] # 0x22B4 (Normal subgroup of or equal)
5454
- "": [t: "⠸⠸⠜"] # 0x22B5 (Contains as normal subgroup or equal)
55-
- "": [t: "⠈⠖⠠⠱."] # 0x22bb (Xor)
55+
- "": [t: "⠈⠖⠠⠱"] # 0x22bb (Xor)
5656
- "": [t: "⠨⠸⠣"] # 0x22EC (not normal subgroup) -- this isn't the same as what is in GTM 10, but that similar has no Unicode equiv
5757
- "": [t: "⠨⠸⠣"] # 0x22ED (does not contain as normal subgroup) -- this isn't the same as what is in GTM 10, but that similar has no Unicode equiv
5858
- "": [t: "⠸⠒"] # 0x22a2 (Right tack)

c-example/Rules/Braille/Vietnam/Vietnam_Rules.yaml

Lines changed: 121 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
- T: "#" # signal end of previous numeric mode
5151
- x: "*[1]"
5252
- test:
53-
if: "$Vietnam_UseDropNumbers='true'"
53+
if: "$Vietnam_UseDropNumbers"
5454
then:
55-
- x: "BrailleChars(translate(*[2], '0123456789', '\ue000\ue001\ue002\ue003\ue004\ue005\ue006\ue007\ue008\ue009'), 'UEB')" # drop numbers for the denominator
55+
- x: "BrailleChars(translate(*[2], '0123456789', '\ue000\ue001\ue002\ue003\ue004\ue005\ue006\ue007\ue008\ue009'), 'Vietnam')" # drop numbers for the denominator
5656
else:
5757
- T: "N⠌"
5858
- x: "*[2]"
@@ -65,9 +65,9 @@
6565
- T: "#" # signal end of any previous numeric mode (probably not needed, but...)
6666
- x: "*[1]"
6767
- test:
68-
if: "$Vietnam_UseDropNumbers='true'"
68+
if: "$Vietnam_UseDropNumbers"
6969
then:
70-
- x: "BrailleChars(translate(*[2], '0123456789', '\ue000\ue001\ue002\ue003\ue004\ue005\ue006\ue007\ue008\ue009'), 'UEB')" # drop numbers for the denominator
70+
- x: "BrailleChars(translate(*[2], '0123456789', '\ue000\ue001\ue002\ue003\ue004\ue005\ue006\ue007\ue008\ue009'), 'Vietnam')" # drop numbers for the denominator
7171
else:
7272
- T: "N⠌"
7373
- x: "*[2]"
@@ -105,7 +105,6 @@
105105
- x: "*[2]/*[2]/*[1]/*[1]"
106106
- x: "*[3]"
107107

108-
109108
#
110109
# Matrix/Determinant rules
111110
# matrix and determinant are the same other than "matrix"/"determinant" based on the bracketing chars
@@ -120,6 +119,14 @@
120119
- "*[2][self::m:mtable] and"
121120
- (IsBracketed(., '(', ')') or IsBracketed(., '[', ']') or IsBracketed(., '|', '|'))
122121
replace: [x: "*[2]"]
122+
-
123+
name: default-cases
124+
tag: mrow
125+
variables:
126+
- RowStart: "*[1]"
127+
- RowEnd: "''"
128+
match: "*[2][self::m:mtable] and count(*)=2 and *[1][.='{' or .='[' or .='(']"
129+
replace: [x: "*[2]"]
123130
-
124131
name: default-mtable
125132
tag: mtable
@@ -130,6 +137,9 @@
130137
tag: [mtr, mlabeledtr]
131138
match: "."
132139
replace:
140+
- test:
141+
if: "preceding-sibling::*"
142+
then: [t: "⣍"]
133143
- test:
134144
if: "count(parent::*) > 1"
135145
then: [t: "⠠"]
@@ -163,32 +173,32 @@
163173
# else nothing to braille
164174

165175
-
166-
name: no-content
167-
tag: math
168-
match: "not(*)" # empty
169-
replace: [t: "W"] # not sure that is right, but this shouldn't happen
176+
name: no-content
177+
tag: math
178+
match: "not(*)" # empty
179+
replace: [t: "W"] # not sure that is right, but this shouldn't happen
170180

171181
-
172-
name: default
173-
tag: math
174-
match: "."
175-
variables:
176-
- RowStart: "''" # empty string -- it needs to be set
177-
- RowEnd: "''" # empty string -- it needs to be set
178-
- NewScriptContext: "''" # empty string -- it needs to be set
179-
replace: [x: "*"]
182+
name: default
183+
tag: math
184+
match: "."
185+
variables:
186+
- RowStart: "''" # empty string -- it needs to be set
187+
- RowEnd: "''" # empty string -- it needs to be set
188+
- NewScriptContext: "''" # empty string -- it needs to be set
189+
replace: [x: "*"]
180190

181191
-
182-
name: empty-mrow
183-
tag: mrow
184-
match: "not(*)"
185-
replace: [t: "W"] # not sure what is correct -- if in a fraction, probably something is better than nothing
192+
name: empty-mrow
193+
tag: mrow
194+
match: "not(*)"
195+
replace: [t: "W"] # not sure what is correct -- if in a fraction, probably something is better than nothing
186196

187197
-
188-
name: default
189-
tag: mrow
190-
match: "."
191-
replace: [x: "*"]
198+
name: default
199+
tag: mrow
200+
match: "."
201+
replace: [x: "*"]
192202

193203
-
194204
# add space after these ops when they are prefix operators
@@ -238,118 +248,121 @@
238248
- test:
239249
if: "substring(., string-length(.), 1)='\u00A0'"
240250
then:
241-
- x: "BrailleChars(., 'UEB', 2, string-length(.))"
251+
- x: "BrailleChars(., 'Vietnam', 2, string-length(.))"
242252
- test:
243253
if: following-sibling::*[2][@class='MathML-unit' or BaseNode(.)[@class='MathML-unit']] # '*[2]' to skip invisible times
244254
then: [t: "𝐖"] # BANA 5(a) -- Units are treated as separate exprs
245255
else: [t: ""]
246256
else:
247-
- x: "BrailleChars(., 'UEB', 2, string-length(.)+1)"
257+
- x: "BrailleChars(., 'Vietnam', 2, string-length(.)+1)"
248258
else:
249259
- test:
250260
if: "substring(., string-length(.), 1)='\u00A0'"
251261
then:
252-
- x: "BrailleChars(., 'UEB', 1, string-length(.))"
262+
- x: "BrailleChars(., 'Vietnam', 1, string-length(.))"
253263
- test:
254264
if: following-sibling::*[2][@class='MathML-unit' or BaseNode(.)[@class='MathML-unit']] # '*[2]' to skip invisible times
255265
then: [t: "𝐖"] # BANA 5(a) -- Units are treated as separate exprs
256266
else: [t: ""]
257267
else:
258-
- x: "BrailleChars(., 'UEB', 1, string-length(.)+1)"
268+
- x: "BrailleChars(., 'Vietnam', 1, string-length(.)+1)"
259269

260270
-
261-
name: default
262-
tag: mn
263-
match: "."
264-
replace:
265-
- x: "BrailleChars(., 'UEB')"
271+
name: default
272+
tag: mn
273+
match: "."
274+
replace:
275+
- x: "BrailleChars(., 'Vietnam')"
266276

267277
-
268-
name: sin
269-
tag: mi
270-
match: "text()='sin'"
271-
replace:
272-
- t: "⠻⠎"
278+
name: sin
279+
tag: mi
280+
match: "text()='sin'"
281+
replace:
282+
- t: "⠻⠎"
273283

274284
-
275-
name: cos
276-
tag: mi
277-
match: "text()='cos'"
278-
replace:
279-
- t: "⠻⠉"
285+
name: cos
286+
tag: mi
287+
match: "text()='cos'"
288+
replace:
289+
- t: "⠻⠉"
280290

281291
-
282-
name: tan
283-
tag: mi
284-
match: "text()='tan'"
285-
replace:
286-
- t: "⠻⠞"
292+
name: tan
293+
tag: mi
294+
match: "text()='tan'"
295+
replace:
296+
- t: "⠻⠞"
287297

288298
-
289-
name: cot
290-
tag: mi
291-
match: "text()='cot'"
292-
replace:
293-
- t: "⠻⠉⠞"
299+
name: cot
300+
tag: mi
301+
match: "text()='cot'"
302+
replace:
303+
- t: "⠻⠉⠞"
294304

295305
-
296-
name: arcsin
297-
tag: mi
298-
match: "text()='arcsin'"
299-
replace:
300-
- t: "⠁⠗⠉⠻⠎"
306+
name: arcsin
307+
tag: mi
308+
match: "text()='arcsin'"
309+
replace:
310+
- t: "⠁⠗⠉⠻⠎"
301311

302312
-
303-
name: arccos
304-
tag: mi
305-
match: "text()='arccos'"
306-
replace:
307-
- t: "⠁⠗⠉⠻⠉"
313+
name: arccos
314+
tag: mi
315+
match: "text()='arccos'"
316+
replace:
317+
- t: "⠁⠗⠉⠻⠉"
308318

309319
-
310-
name: arctan
311-
tag: mi
312-
match: "text()='arctan'"
313-
replace:
314-
- t: "⠁⠗⠉⠻⠞"
320+
name: arctan
321+
tag: mi
322+
match: "text()='arctan'"
323+
replace:
324+
- t: "⠁⠗⠉⠻⠞"
315325

316326
-
317-
name: arccot
318-
tag: mi
319-
match: "text()='arccot'"
320-
replace:
321-
- t: "⠁⠗⠉⠻⠉⠞"
327+
name: arccot
328+
tag: mi
329+
match: "text()='arccot'"
330+
replace:
331+
- t: "⠁⠗⠉⠻⠉⠞"
322332

323333
-
324-
# FIX: need to deal with all caps
325-
name: default
326-
tag: [mi, mtext]
327-
match: "."
328-
replace:
329-
- x: "BrailleChars(., 'UEB')"
334+
# FIX: need to deal with all caps
335+
name: default
336+
tag: [mi, mtext]
337+
match: "."
338+
replace:
339+
- test:
340+
if: "IsInDefinition(., 'Units') or (string-length(.)=1 and @mathvariant='normal')"
341+
then: [t: "W"]
342+
- x: "BrailleChars(., 'Vietnam')"
330343

331344

332345
-
333-
name: default
334-
tag: mstyle
335-
match: "."
336-
replace:
337-
- test:
346+
name: default
347+
tag: mstyle
348+
match: "."
349+
replace:
350+
- test:
338351
if: "*"
339352
then: [x: "*"]
340353
# else do nothing -- no content
341354

342355

343356
-
344-
name: angle # angles need a shape indicator -- not sure this is the best test (three letters in base, have invisible separators)
345-
tag: mover
346-
match: "*[2][text()='^'] and *[1][
347-
self::m:mrow and count(*)=5 and
348-
*[1][self::m:mi] and *[2][text()='\u2063'] and *[3][self::m:mi] and *[4][text()='\u2063'] and *[5][self::m:mi]
349-
]"
350-
replace:
351-
- t: "⠫⠛" # shape indicator, g
352-
- x: "*[1]"
357+
name: angle # angles need a shape indicator -- not sure this is the best test (three letters in base, have invisible separators)
358+
tag: mover
359+
match: "*[2][text()='^'] and *[1][
360+
self::m:mrow and count(*)=5 and
361+
*[1][self::m:mi] and *[2][text()='\u2063'] and *[3][self::m:mi] and *[4][text()='\u2063'] and *[5][self::m:mi]
362+
]"
363+
replace:
364+
- t: "⠫⠛" # shape indicator, g
365+
- x: "*[1]"
353366

354367
-
355368
name: single-char-exceptions # GTM 12
@@ -380,7 +393,7 @@
380393
then: [t: "⠠"]
381394
- test:
382395
- if: "*[2][text()='_' or text()='¯']"
383-
then: [t: "⠱"]
396+
then: [T: "⠱"]
384397
- else_if: "*[2][text()='→']"
385398
then: [T: "⠨⠔⠳⠕"]
386399
- else_if: "*[2][text()='.' or text()='˙']"
@@ -442,6 +455,15 @@
442455
- t: ""
443456
- t: "#" # signal end script/numeric mode
444457

458+
- name: log-base-power
459+
tag: msubsup
460+
match: "*[1][.='log']"
461+
replace:
462+
- x: "*[1]" # log
463+
- T: ""
464+
- x: "*[3]" # superscript
465+
- T: ""
466+
- x: "*[2]" # supscript
445467

446468
-
447469
name: msubsup_default_mmultiscripts_equiv
@@ -466,7 +488,7 @@
466488
replace:
467489
- test:
468490
- if: "self::m:munderover"
469-
then: [t: "⠢"]
491+
then: [t: "⠢"] # not use dots 46-26, just use same sub sign dots 26
470492
else: [t: "⠢"]
471493
- test:
472494
# omit grouping indicators in the following cases
@@ -486,7 +508,7 @@
486508
- t: ""
487509
- test:
488510
- if: "self::m:munderover"
489-
then: [t: "⠔"]
511+
then: [t: "⠔"] # not use ⠨⠔ as UEB, just use dots 35
490512
else: [t: "⠔"]
491513
- test:
492514
# omit grouping indicators in the following cases
@@ -963,7 +985,7 @@
963985
then: [t: "⠳⠺⠗⠣"]
964986
- test:
965987
if: "contains(@notation,'top')"
966-
then: [t: "⠱"]
988+
then: [T: "⠱"]
967989
- test:
968990
if: "contains(@notation,'bottom')"
969991
then: [t: "⠠⠱"]
@@ -996,7 +1018,7 @@
9961018
if: "string(@lquote)!=''"
9971019
then: [x: "@lquote"]
9981020
else: [t: "⠄⠄"]
999-
- x: "BrailleChars(., 'UEB')"
1021+
- x: "BrailleChars(., 'Vietnam')"
10001022
- test:
10011023
if: "string(@rquote)!=''"
10021024
then: [x: "@rquote"]

0 commit comments

Comments
 (0)