zotica 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 768244b2c952c5326c6a245d54e51b6103f8a5e6d072f2155cc76cc49f652176
4
- data.tar.gz: ef29e149f6fe8ddf376e9eff1f0da778fd17fa572860bb53af7e4c4388992ece
3
+ metadata.gz: 46424f38382db4c95bd3a2a11ea8a51702749b173031b9c3a5ea34db5236e410
4
+ data.tar.gz: e31907a1bbe6768ab69fd8341e461c94f0889bdb78616ec5fbc77bb858c2252a
5
5
  SHA512:
6
- metadata.gz: 4b08b255e685e21aa9f401538a2997990672f80d8757f712efe65a0507923019e3af89b6b015aa69f3e5caffb2b5df2655c51ef63429a54da18cf4be5dd010e3
7
- data.tar.gz: b807e3c24c149a0984fd5ad8eab7cbba49897b79c54eedb845a6afd57f90271403ba98d49d7ce2a8ae8254ec0ef66ad8f53681d185a5a8b8617ca2c71b432fa7
6
+ metadata.gz: 5e0f6c7468c73604664eca91f23c8a9e9ac26edde468b20c0dadaee5ed1c32682478cdc688d58ef37cc6e17914eee1897b312ad73c344b0be5c88a06a659e3a5
7
+ data.tar.gz: 9c5a39b83b6c6d39650836d89915b26f5f09713f03b9c7c85627f5fef310a52decaaacd55c2456e3f34e49d5baa46d0dec904afaf4133d31e841d2d3e424c5ef
@@ -1,15 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
 
4
- require 'json'
5
- require 'pp'
6
- require 'rexml/document'
7
- require 'sassc'
8
- require 'ttfunk'
9
- include REXML
10
-
11
-
12
- module ZoticaBuilder
4
+ module Zenithal::ZoticaBuilder
13
5
 
14
6
  DATA_PATH = "resource/math.json"
15
7
  COMMON_STYLE_PATH = "resource/style/math.scss"
@@ -36,7 +28,7 @@ module ZoticaBuilder
36
28
 
37
29
  def apply_options(nodes, options)
38
30
  nodes.each do |node|
39
- if node.is_a?(Element) && options[:role]
31
+ if node.is_a?(REXML::Element) && options[:role]
40
32
  classes = node["class"].split(" ") - ROLES
41
33
  classes << options[:role]
42
34
  node["class"] = classes.join(" ")
@@ -62,9 +54,9 @@ module ZoticaBuilder
62
54
  end
63
55
 
64
56
  def build_number(text, options = {})
65
- this = Nodes[]
57
+ this = REXML::Nodes[]
66
58
  element = nil
67
- this << Element.build("math-n") do |this|
59
+ this << REXML::Element.build("math-n") do |this|
68
60
  this << ~text
69
61
  element = this
70
62
  end
@@ -84,10 +76,10 @@ module ZoticaBuilder
84
76
  end
85
77
 
86
78
  def build_identifier(text, types, options = {})
87
- this = Nodes[]
79
+ this = REXML::Nodes[]
88
80
  element = nil
89
81
  font_type = (types.include?("alt")) ? "math" : "main"
90
- this << Element.build("math-i") do |this|
82
+ this << REXML::Element.build("math-i") do |this|
91
83
  this["class"] = types.join(" ")
92
84
  this["data-cont"] = text
93
85
  this << ~text
@@ -104,10 +96,10 @@ module ZoticaBuilder
104
96
  end
105
97
 
106
98
  def build_operator(symbol, types, options = {}, &block)
107
- this = Nodes[]
99
+ this = REXML::Nodes[]
108
100
  element = nil
109
101
  font_type = (types.include?("txt")) ? "main" : "math"
110
- this << Element.build("math-o") do |this|
102
+ this << REXML::Element.build("math-o") do |this|
111
103
  this["class"] = types.join(" ")
112
104
  this << ~symbol
113
105
  element = this
@@ -136,8 +128,8 @@ module ZoticaBuilder
136
128
  end
137
129
 
138
130
  def build_strut(type, options = {})
139
- this = Nodes[]
140
- this << Element.build("math-strut") do |this|
131
+ this = REXML::Nodes[]
132
+ this << REXML::Element.build("math-strut") do |this|
141
133
  if type == "upper" || type == "dupper"
142
134
  this["style"] += "margin-bottom: -0.5em;"
143
135
  elsif type == "dlower" || type == "dfull"
@@ -154,7 +146,7 @@ module ZoticaBuilder
154
146
  top_margin = options[:fonts]&.dig(:main, "72", 1) || DEFAULT_FONTS.dig(:main, "72", 1)
155
147
  this["style"] += "margin-top: #{top_margin}em;"
156
148
  end
157
- this << Element.build("math-text") do |this|
149
+ this << REXML::Element.build("math-text") do |this|
158
150
  this["style"] += "line-height: 1;"
159
151
  this << ~" "
160
152
  end
@@ -164,24 +156,24 @@ module ZoticaBuilder
164
156
  end
165
157
 
166
158
  def build_subsuper(options = {}, &block)
167
- this = Nodes[]
159
+ this = REXML::Nodes[]
168
160
  base_element, sub_element, super_element, left_sub_element, left_super_element = nil
169
161
  main_element = nil
170
- this << Element.build("math-subsup") do |this|
162
+ this << REXML::Element.build("math-subsup") do |this|
171
163
  main_element = this
172
- this << Element.build("math-lsub") do |this|
164
+ this << REXML::Element.build("math-lsub") do |this|
173
165
  left_sub_element = this
174
166
  end
175
- this << Element.build("math-lsup") do |this|
167
+ this << REXML::Element.build("math-lsup") do |this|
176
168
  left_super_element = this
177
169
  end
178
- this << Element.build("math-base") do |this|
170
+ this << REXML::Element.build("math-base") do |this|
179
171
  base_element = this
180
172
  end
181
- this << Element.build("math-sub") do |this|
173
+ this << REXML::Element.build("math-sub") do |this|
182
174
  sub_element = this
183
175
  end
184
- this << Element.build("math-sup") do |this|
176
+ this << REXML::Element.build("math-sup") do |this|
185
177
  super_element = this
186
178
  end
187
179
  end
@@ -208,19 +200,19 @@ module ZoticaBuilder
208
200
  end
209
201
 
210
202
  def build_underover(options = {}, &block)
211
- this = Nodes[]
203
+ this = REXML::Nodes[]
212
204
  base_element, under_element, over_element = nil
213
205
  main_element = nil
214
- this << Element.build("math-underover") do |this|
206
+ this << REXML::Element.build("math-underover") do |this|
215
207
  main_element = this
216
- this << Element.build("math-over") do |this|
208
+ this << REXML::Element.build("math-over") do |this|
217
209
  over_element = this
218
210
  end
219
- this << Element.build("math-basewrap") do |this|
220
- this << Element.build("math-base") do |this|
211
+ this << REXML::Element.build("math-basewrap") do |this|
212
+ this << REXML::Element.build("math-base") do |this|
221
213
  base_element = this
222
214
  end
223
- this << Element.build("math-under") do |this|
215
+ this << REXML::Element.build("math-under") do |this|
224
216
  under_element = this
225
217
  end
226
218
  end
@@ -242,15 +234,15 @@ module ZoticaBuilder
242
234
  end
243
235
 
244
236
  def build_fraction(options = {}, &block)
245
- this = Nodes[]
237
+ this = REXML::Nodes[]
246
238
  numerator_element, denominator_element = nil
247
- this << Element.build("math-frac") do |this|
248
- this << Element.build("math-num") do |this|
239
+ this << REXML::Element.build("math-frac") do |this|
240
+ this << REXML::Element.build("math-num") do |this|
249
241
  numerator_element = this
250
242
  end
251
- this << Element.build("math-denwrap") do |this|
252
- this << Element.new("math-line")
253
- this << Element.build("math-den") do |this|
243
+ this << REXML::Element.build("math-denwrap") do |this|
244
+ this << REXML::Element.new("math-line")
245
+ this << REXML::Element.build("math-den") do |this|
254
246
  denominator_element = this
255
247
  end
256
248
  end
@@ -273,22 +265,22 @@ module ZoticaBuilder
273
265
  end
274
266
 
275
267
  def build_radical(symbol, modify, options = {}, &block)
276
- this = Nodes[]
268
+ this = REXML::Nodes[]
277
269
  content_element, index_element = nil
278
- this << Element.build("math-rad") do |this|
270
+ this << REXML::Element.build("math-rad") do |this|
279
271
  if modify
280
272
  this["class"] = "mod"
281
273
  end
282
- this << Element.build("math-index") do |this|
274
+ this << REXML::Element.build("math-index") do |this|
283
275
  index_element = this
284
276
  end
285
- this << Element.build("math-sqrt") do |this|
286
- this << Element.build("math-surd") do |this|
287
- this << Element.build("math-o") do |this|
288
- this << Text.new(symbol, true, nil, false)
277
+ this << REXML::Element.build("math-sqrt") do |this|
278
+ this << REXML::Element.build("math-surd") do |this|
279
+ this << REXML::Element.build("math-o") do |this|
280
+ this << REXML::Text.new(symbol, true, nil, false)
289
281
  end
290
282
  end
291
- this << Element.build("math-cont") do |this|
283
+ this << REXML::Element.build("math-cont") do |this|
292
284
  content_element = this
293
285
  end
294
286
  end
@@ -313,26 +305,26 @@ module ZoticaBuilder
313
305
  end
314
306
 
315
307
  def build_fence(left_kind, right_kind, left_symbol, right_symbol, modify, options = {}, &block)
316
- this = Nodes[]
308
+ this = REXML::Nodes[]
317
309
  content_element = nil
318
- this << Element.build("math-fence") do |this|
310
+ this << REXML::Element.build("math-fence") do |this|
319
311
  this["class"] = "par"
320
312
  if modify
321
313
  this["class"] = [*this["class"].split(" "), "mod"].join(" ")
322
314
  this["data-left"] = left_kind
323
315
  this["data-right"] = right_kind
324
316
  end
325
- this << Element.build("math-left") do |this|
326
- this << Element.build("math-o") do |this|
327
- this << Text.new(left_symbol, true, nil, false)
317
+ this << REXML::Element.build("math-left") do |this|
318
+ this << REXML::Element.build("math-o") do |this|
319
+ this << REXML::Text.new(left_symbol, true, nil, false)
328
320
  end
329
321
  end
330
- this << Element.build("math-cont") do |this|
322
+ this << REXML::Element.build("math-cont") do |this|
331
323
  content_element = this
332
324
  end
333
- this << Element.build("math-right") do |this|
334
- this << Element.build("math-o") do |this|
335
- this << Text.new(right_symbol, true, nil, false)
325
+ this << REXML::Element.build("math-right") do |this|
326
+ this << REXML::Element.build("math-o") do |this|
327
+ this << REXML::Text.new(right_symbol, true, nil, false)
336
328
  end
337
329
  end
338
330
  end
@@ -342,9 +334,9 @@ module ZoticaBuilder
342
334
  end
343
335
 
344
336
  def build_set(left_kind, right_kind, center_kind, left_symbol, right_symbol, center_symbol, modify, options = {}, &block)
345
- this = Nodes[]
337
+ this = REXML::Nodes[]
346
338
  left_element, right_element = nil
347
- this << Element.build("math-fence") do |this|
339
+ this << REXML::Element.build("math-fence") do |this|
348
340
  this["class"] = "par"
349
341
  if modify
350
342
  this["class"] = [*this["class"].split(" "), "mod"].join(" ")
@@ -352,26 +344,26 @@ module ZoticaBuilder
352
344
  this["data-right"] = right_kind
353
345
  this["data-center"] = center_kind
354
346
  end
355
- this << Element.build("math-left") do |this|
356
- this << Element.build("math-o") do |this|
357
- this << Text.new(left_symbol, true, nil, false)
347
+ this << REXML::Element.build("math-left") do |this|
348
+ this << REXML::Element.build("math-o") do |this|
349
+ this << REXML::Text.new(left_symbol, true, nil, false)
358
350
  end
359
351
  end
360
- this << Element.build("math-cont") do |this|
352
+ this << REXML::Element.build("math-cont") do |this|
361
353
  left_element = this
362
354
  end
363
- this << Element.build("math-center") do |this|
355
+ this << REXML::Element.build("math-center") do |this|
364
356
  this["class"] = "cpar"
365
- this << Element.build("math-o") do |this|
366
- this << Text.new(right_symbol, true, nil, false)
357
+ this << REXML::Element.build("math-o") do |this|
358
+ this << REXML::Text.new(right_symbol, true, nil, false)
367
359
  end
368
360
  end
369
- this << Element.build("math-cont") do |this|
361
+ this << REXML::Element.build("math-cont") do |this|
370
362
  right_element = this
371
363
  end
372
- this << Element.build("math-right") do |this|
373
- this << Element.build("math-o") do |this|
374
- this << Text.new(right_symbol, true, nil, false)
364
+ this << REXML::Element.build("math-right") do |this|
365
+ this << REXML::Element.build("math-o") do |this|
366
+ this << REXML::Text.new(right_symbol, true, nil, false)
375
367
  end
376
368
  end
377
369
  end
@@ -387,27 +379,27 @@ module ZoticaBuilder
387
379
  end
388
380
 
389
381
  def build_integral(symbol, size, options = {}, &block)
390
- this = Nodes[]
382
+ this = REXML::Nodes[]
391
383
  base_element, sub_element, super_element = nil
392
- this << Element.build("math-subsup") do |this|
384
+ this << REXML::Element.build("math-subsup") do |this|
393
385
  this["class"] = "int"
394
386
  unless size == "lrg"
395
387
  this["class"] = [*this["class"].split(" "), size].join(" ")
396
388
  end
397
- this << Element.build("math-base") do |this|
389
+ this << REXML::Element.build("math-base") do |this|
398
390
  base_element = this
399
- this << Element.build("math-o") do |this|
391
+ this << REXML::Element.build("math-o") do |this|
400
392
  this["class"] = "int"
401
393
  unless size == "lrg"
402
394
  this["class"] = [*this["class"].split(" "), size].join(" ")
403
395
  end
404
- this << Text.new(symbol, true, nil, false)
396
+ this << REXML::Text.new(symbol, true, nil, false)
405
397
  end
406
398
  end
407
- this << Element.build("math-sub") do |this|
399
+ this << REXML::Element.build("math-sub") do |this|
408
400
  sub_element = this
409
401
  end
410
- this << Element.build("math-sup") do |this|
402
+ this << REXML::Element.build("math-sup") do |this|
411
403
  super_element = this
412
404
  end
413
405
  end
@@ -424,22 +416,22 @@ module ZoticaBuilder
424
416
  end
425
417
 
426
418
  def build_sum(symbol, size, options = {}, &block)
427
- this = Nodes[]
419
+ this = REXML::Nodes[]
428
420
  if size == "lrg"
429
421
  under_element, over_element = nil
430
- this << Element.build("math-underover") do |this|
422
+ this << REXML::Element.build("math-underover") do |this|
431
423
  this["class"] = "sum"
432
- this << Element.build("math-over") do |this|
424
+ this << REXML::Element.build("math-over") do |this|
433
425
  over_element = this
434
426
  end
435
- this << Element.build("math-basewrap") do |this|
436
- this << Element.build("math-base") do |this|
437
- this << Element.build("math-o") do |this|
427
+ this << REXML::Element.build("math-basewrap") do |this|
428
+ this << REXML::Element.build("math-base") do |this|
429
+ this << REXML::Element.build("math-o") do |this|
438
430
  this["class"] = "sum"
439
- this << Text.new(symbol, true, nil, false)
431
+ this << REXML::Text.new(symbol, true, nil, false)
440
432
  end
441
433
  end
442
- this << Element.build("math-under") do |this|
434
+ this << REXML::Element.build("math-under") do |this|
443
435
  under_element = this
444
436
  end
445
437
  end
@@ -449,19 +441,19 @@ module ZoticaBuilder
449
441
  modify_underover(under_element, over_element)
450
442
  else
451
443
  base_element, sub_element, super_element = nil
452
- this << Element.build("math-subsup") do |this|
444
+ this << REXML::Element.build("math-subsup") do |this|
453
445
  this["class"] = "sum inl"
454
- this << Element.build("math-base") do |this|
446
+ this << REXML::Element.build("math-base") do |this|
455
447
  base_element = this
456
- this << Element.build("math-o") do |this|
448
+ this << REXML::Element.build("math-o") do |this|
457
449
  this["class"] = "sum inl"
458
- this << Text.new(symbol, true, nil, false)
450
+ this << REXML::Text.new(symbol, true, nil, false)
459
451
  end
460
452
  end
461
- this << Element.build("math-sub") do |this|
453
+ this << REXML::Element.build("math-sub") do |this|
462
454
  sub_element = this
463
455
  end
464
- this << Element.build("math-sup") do |this|
456
+ this << REXML::Element.build("math-sup") do |this|
465
457
  super_element = this
466
458
  end
467
459
  end
@@ -473,31 +465,31 @@ module ZoticaBuilder
473
465
  end
474
466
 
475
467
  def build_accent(under_symbol, over_symbol, options = {}, &block)
476
- this = Nodes[]
468
+ this = REXML::Nodes[]
477
469
  base_element, under_element, over_element = nil
478
470
  main_element = nil
479
- this << Element.build("math-underover") do |this|
471
+ this << REXML::Element.build("math-underover") do |this|
480
472
  main_element = this
481
473
  this["class"] = "acc"
482
- this << Element.build("math-over") do |this|
474
+ this << REXML::Element.build("math-over") do |this|
483
475
  over_element = this
484
476
  if over_symbol
485
- this << Element.build("math-o") do |this|
477
+ this << REXML::Element.build("math-o") do |this|
486
478
  this["class"] = "acc"
487
- this << Text.new(over_symbol, true, nil, false)
479
+ this << REXML::Text.new(over_symbol, true, nil, false)
488
480
  end
489
481
  end
490
482
  end
491
- this << Element.build("math-basewrap") do |this|
492
- this << Element.build("math-base") do |this|
483
+ this << REXML::Element.build("math-basewrap") do |this|
484
+ this << REXML::Element.build("math-base") do |this|
493
485
  base_element = this
494
486
  end
495
- this << Element.build("math-under") do |this|
487
+ this << REXML::Element.build("math-under") do |this|
496
488
  under_element = this
497
489
  if under_symbol
498
- this << Element.build("math-o") do |this|
490
+ this << REXML::Element.build("math-o") do |this|
499
491
  this["class"] = "acc"
500
- this << Text.new(under_symbol, true, nil, false)
492
+ this << REXML::Text.new(under_symbol, true, nil, false)
501
493
  end
502
494
  end
503
495
  end
@@ -540,34 +532,34 @@ module ZoticaBuilder
540
532
  end
541
533
 
542
534
  def build_wide(kind, under_symbol, over_symbol, modify, options = {}, &block)
543
- this = Nodes[]
535
+ this = REXML::Nodes[]
544
536
  base_element, under_element, over_element = nil
545
537
  main_element = nil
546
- this << Element.build("math-underover") do |this|
538
+ this << REXML::Element.build("math-underover") do |this|
547
539
  this["class"] = "wid"
548
540
  if modify
549
541
  this["class"] = [*this["class"].split(" "), "mod"].join(" ")
550
542
  this["data-kind"] = kind
551
543
  end
552
544
  main_element = this
553
- this << Element.build("math-over") do |this|
545
+ this << REXML::Element.build("math-over") do |this|
554
546
  if over_symbol
555
- this << Element.build("math-o") do |this|
547
+ this << REXML::Element.build("math-o") do |this|
556
548
  this["class"] = "wid"
557
- this << Text.new(over_symbol, true, nil, false)
549
+ this << REXML::Text.new(over_symbol, true, nil, false)
558
550
  end
559
551
  end
560
552
  over_element = this
561
553
  end
562
- this << Element.build("math-basewrap") do |this|
563
- this << Element.build("math-base") do |this|
554
+ this << REXML::Element.build("math-basewrap") do |this|
555
+ this << REXML::Element.build("math-base") do |this|
564
556
  base_element = this
565
557
  end
566
- this << Element.build("math-under") do |this|
558
+ this << REXML::Element.build("math-under") do |this|
567
559
  if under_symbol
568
- this << Element.build("math-o") do |this|
560
+ this << REXML::Element.build("math-o") do |this|
569
561
  this["class"] = "wid"
570
- this << Text.new(under_symbol, true, nil, false)
562
+ this << REXML::Text.new(under_symbol, true, nil, false)
571
563
  end
572
564
  end
573
565
  under_element = this
@@ -582,9 +574,9 @@ module ZoticaBuilder
582
574
  end
583
575
 
584
576
  def build_table(type, align_config, raw, options = {}, &block)
585
- this = Nodes[]
577
+ this = REXML::Nodes[]
586
578
  table_element = nil
587
- this << Element.build("math-table") do |this|
579
+ this << REXML::Element.build("math-table") do |this|
588
580
  this["class"] = type
589
581
  table_element = this
590
582
  end
@@ -595,9 +587,9 @@ module ZoticaBuilder
595
587
  end
596
588
 
597
589
  def build_diagram(vertical_gaps_string, horizontal_gaps_string, options = {}, &block)
598
- this = Nodes[]
590
+ this = REXML::Nodes[]
599
591
  table_element = nil
600
- this << Element.build("math-diagram") do |this|
592
+ this << REXML::Element.build("math-diagram") do |this|
601
593
  if vertical_gaps_string
602
594
  this["class"] = [*this["class"].split(" "), "vnon"].join(" ")
603
595
  end
@@ -674,9 +666,9 @@ module ZoticaBuilder
674
666
  end
675
667
 
676
668
  def build_table_cell(options = {}, &block)
677
- this = Nodes[]
669
+ this = REXML::Nodes[]
678
670
  cell_element = nil
679
- this << Element.build("math-cell") do |this|
671
+ this << REXML::Element.build("math-cell") do |this|
680
672
  cell_element = this
681
673
  end
682
674
  apply_options(this, options)
@@ -685,13 +677,13 @@ module ZoticaBuilder
685
677
  end
686
678
 
687
679
  def build_diagram_vertex(name, options = {}, &block)
688
- this = Nodes[]
680
+ this = REXML::Nodes[]
689
681
  vertex_element = nil
690
- this << Element.build("math-cellwrap") do |this|
682
+ this << REXML::Element.build("math-cellwrap") do |this|
691
683
  if name
692
684
  this["data-name"] = name
693
685
  end
694
- this << Element.build("math-cell") do |this|
686
+ this << REXML::Element.build("math-cell") do |this|
695
687
  vertex_element = this
696
688
  end
697
689
  end
@@ -701,9 +693,9 @@ module ZoticaBuilder
701
693
  end
702
694
 
703
695
  def build_arrow(name, configs, options = {}, &block)
704
- this = Nodes[]
696
+ this = REXML::Nodes[]
705
697
  label_element = nil
706
- this << Element.build("math-arrow") do |this|
698
+ this << REXML::Element.build("math-arrow") do |this|
707
699
  this["data-start"] = configs[:start_config]
708
700
  this["data-end"] = configs[:end_config]
709
701
  if configs[:tip_kinds]
@@ -741,9 +733,9 @@ module ZoticaBuilder
741
733
  end
742
734
 
743
735
  def build_tree(options = {}, &block)
744
- this = Nodes[]
736
+ this = REXML::Nodes[]
745
737
  content_element = nil
746
- this << Element.build("math-tree") do |this|
738
+ this << REXML::Element.build("math-tree") do |this|
747
739
  content_element = this
748
740
  end
749
741
  apply_options(this, options)
@@ -764,8 +756,8 @@ module ZoticaBuilder
764
756
  left_label_element = child.get_elements("math-sys-llabel").first
765
757
  right_label_element = child.get_elements("math-sys-rlabel").first
766
758
  antecedent_elements = stack.pop(number)
767
- inference_element = Element.build("math-infer") do |this|
768
- this << Element.build("math-label") do |this|
759
+ inference_element = REXML::Element.build("math-infer") do |this|
760
+ this << REXML::Element.build("math-label") do |this|
769
761
  if left_label_element.to_a.empty?
770
762
  this["class"] = "non"
771
763
  end
@@ -773,22 +765,22 @@ module ZoticaBuilder
773
765
  this << each_element
774
766
  end
775
767
  end
776
- this << Element.build("math-step") do |this|
777
- this << Element.build("math-ant") do |this|
768
+ this << REXML::Element.build("math-step") do |this|
769
+ this << REXML::Element.build("math-ant") do |this|
778
770
  antecedent_elements.each do |antecedent_element|
779
771
  this << antecedent_element
780
772
  end
781
773
  end
782
- this << Element.build("math-conwrap") do |this|
783
- this << Element.new("math-line")
784
- this << Element.build("math-con") do |this|
774
+ this << REXML::Element.build("math-conwrap") do |this|
775
+ this << REXML::Element.new("math-line")
776
+ this << REXML::Element.build("math-con") do |this|
785
777
  this << ZoticaBuilder.build_strut("upper").first
786
778
  this << ZoticaBuilder.build_strut("dlower").first
787
779
  this << child.get_elements("math-cont").first
788
780
  end
789
781
  end
790
782
  end
791
- this << Element.build("math-label") do |this|
783
+ this << REXML::Element.build("math-label") do |this|
792
784
  if right_label_element.to_a.empty?
793
785
  this["class"] = "non"
794
786
  end
@@ -807,9 +799,9 @@ module ZoticaBuilder
807
799
  end
808
800
 
809
801
  def build_tree_axiom(options = {}, &block)
810
- this = Nodes[]
802
+ this = REXML::Nodes[]
811
803
  content_element = nil
812
- this << Element.build("math-axiom") do |this|
804
+ this << REXML::Element.build("math-axiom") do |this|
813
805
  content_element = this
814
806
  end
815
807
  apply_options(this, options)
@@ -818,17 +810,17 @@ module ZoticaBuilder
818
810
  end
819
811
 
820
812
  def build_tree_inference(number, options = {}, &block)
821
- this = Nodes[]
813
+ this = REXML::Nodes[]
822
814
  content_element, right_label_element, left_label_element = nil
823
- this << Element.build("math-sys-infer") do |this|
815
+ this << REXML::Element.build("math-sys-infer") do |this|
824
816
  this["data-num"] = number.to_s
825
- this << Element.build("math-cont") do |this|
817
+ this << REXML::Element.build("math-cont") do |this|
826
818
  content_element = this
827
819
  end
828
- this << Element.build("math-sys-rlabel") do |this|
820
+ this << REXML::Element.build("math-sys-rlabel") do |this|
829
821
  right_label_element = this
830
822
  end
831
- this << Element.build("math-sys-llabel") do |this|
823
+ this << REXML::Element.build("math-sys-llabel") do |this|
832
824
  left_label_element = this
833
825
  end
834
826
  end
@@ -838,9 +830,9 @@ module ZoticaBuilder
838
830
  end
839
831
 
840
832
  def build_group(transform_configs, options = {}, &block)
841
- this = Nodes[]
833
+ this = REXML::Nodes[]
842
834
  content_element = nil
843
- this << Element.build("math-group") do |this|
835
+ this << REXML::Element.build("math-group") do |this|
844
836
  transforms = []
845
837
  if transform_configs[:rotate]
846
838
  transforms << "rotate(#{transform_configs[:rotate]}deg)"
@@ -856,8 +848,8 @@ module ZoticaBuilder
856
848
  end
857
849
 
858
850
  def build_space(type, options = {})
859
- this = Nodes[]
860
- this << Element.build("math-space") do |this|
851
+ this = REXML::Nodes[]
852
+ this << REXML::Element.build("math-space") do |this|
861
853
  this["class"] = type
862
854
  end
863
855
  apply_options(this, options)
@@ -865,9 +857,9 @@ module ZoticaBuilder
865
857
  end
866
858
 
867
859
  def build_phantom(type, options = {}, &block)
868
- this = Nodes[]
860
+ this = REXML::Nodes[]
869
861
  content_element = nil
870
- this << Element.build("math-phantom") do |this|
862
+ this << REXML::Element.build("math-phantom") do |this|
871
863
  this["class"] = ["lpres", "rpres"].join(" ")
872
864
  unless type == "bth"
873
865
  this["class"] = [*this["class"].split(" "), type].join(" ")
@@ -880,9 +872,9 @@ module ZoticaBuilder
880
872
  end
881
873
 
882
874
  def build_text(text, options = {}, &block)
883
- this = Nodes[]
884
- this << Element.build("math-text") do |this|
885
- this << Text.new(text, true, nil, false)
875
+ this = REXML::Nodes[]
876
+ this << REXML::Element.build("math-text") do |this|
877
+ this << REXML::Text.new(text, true, nil, false)
886
878
  end
887
879
  apply_options(this, options)
888
880
  return this
@@ -901,7 +893,7 @@ module ZoticaBuilder
901
893
  def create_script_string
902
894
  dir = File.expand_path("../" + SCRIPT_DIR, __FILE__)
903
895
  string = "const DATA = "
904
- string << JSON.generate(ZoticaBuilder::DATA.slice("radical", "fence", "wide", "shift", "arrow"))
896
+ string << JSON.generate(Zenithal::ZoticaBuilder::DATA.slice("radical", "fence", "wide", "shift", "arrow"))
905
897
  string << ";\n"
906
898
  string << File.read(dir + "/main.js")
907
899
  string << "\n"
@@ -949,10 +941,10 @@ module ZoticaBuilder
949
941
  main_font_path = File.expand_path("../" + DEFAULT_FONT_PATHS[:main], __FILE__)
950
942
  math_font_path = File.expand_path("../" + DEFAULT_FONT_PATHS[:math], __FILE__)
951
943
  File.open(main_font_path, "w") do |file|
952
- file.write(ZoticaBuilder.create_font_string(:main))
944
+ file.write(Zenithal::ZoticaBuilder.create_font_string(:main))
953
945
  end
954
946
  File.open(math_font_path, "w") do |file|
955
- file.write(ZoticaBuilder.create_font_string(:math))
947
+ file.write(Zenithal::ZoticaBuilder.create_font_string(:math))
956
948
  end
957
949
  end
958
950
 
@@ -1,14 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
 
4
- require 'pp'
5
- require 'rexml/document'
6
- include REXML
7
-
8
-
9
- module ZoticaSingleParserMethod
10
-
11
- DATA = ZoticaBuilder::DATA
4
+ module Zenithal::ZoticaSingleParserMethod
12
5
 
13
6
  SPACE_ALTERNATIVES = {"sfun" => "afun", "sbin" => "abin", "srel" => "arel", "ssbin" => "asbin", "ssrel" => "asrel", "scas" => "acas", "quad" => "sgl", "qquad" => "dbl"}
14
7
  PHANTOM_TYPES = {"ph" => "bth", "vph" => "ver", "hph" => "hor"}
@@ -17,7 +10,7 @@ module ZoticaSingleParserMethod
17
10
  if @block
18
11
  inner_element = parse_math_root
19
12
  raw_nodes = @block.call(@attributes, [inner_element])
20
- nodes = raw_nodes.inject(Nodes[], :<<)
13
+ nodes = raw_nodes.inject(REXML::Nodes[], :<<)
21
14
  else
22
15
  nodes = parse_math_root
23
16
  end
@@ -27,7 +20,7 @@ module ZoticaSingleParserMethod
27
20
  private
28
21
 
29
22
  def create_math_element(name, attributes, children_list, options = {})
30
- this = Nodes[]
23
+ this = REXML::Nodes[]
31
24
  options[:role] = determine_role(attributes)
32
25
  options[:class] = attributes["class"]
33
26
  options[:fonts] = @fonts
@@ -81,7 +74,7 @@ module ZoticaSingleParserMethod
81
74
  right_symbol = ZoticaBuilder.fetch_fence_symbol(right_kind, 1, stretch_level)
82
75
  modify = !stretch_level
83
76
  this << ZoticaBuilder.build_fence(left_kind, right_kind, left_symbol, right_symbol, modify, options) do |content_this|
84
- content_this << children_list.fetch(0, Nodes[])
77
+ content_this << children_list.fetch(0, REXML::Nodes[])
85
78
  end
86
79
  when "set"
87
80
  stretch_level = attributes["s"]
@@ -93,8 +86,8 @@ module ZoticaSingleParserMethod
93
86
  center_symbol = ZoticaBuilder.fetch_fence_symbol(center_kind, 0, stretch_level)
94
87
  modify = !stretch_level
95
88
  this << ZoticaBuilder.build_set(left_kind, right_kind, center_kind, left_symbol, right_symbol, center_symbol, modify, options) do |left_this, right_this|
96
- left_this << children_list.fetch(0, Nodes[])
97
- right_this << children_list.fetch(1, Nodes[])
89
+ left_this << children_list.fetch(0, REXML::Nodes[])
90
+ right_this << children_list.fetch(1, REXML::Nodes[])
98
91
  end
99
92
  when DATA["fence"].method(:key?)
100
93
  stretch_level = attributes["s"]
@@ -102,50 +95,50 @@ module ZoticaSingleParserMethod
102
95
  right_symbol = ZoticaBuilder.fetch_fence_symbol(name, 1, stretch_level)
103
96
  modify = !stretch_level
104
97
  this << ZoticaBuilder.build_fence(name, name, left_symbol, right_symbol, modify, options) do |content_this|
105
- content_this << children_list.fetch(0, Nodes[])
98
+ content_this << children_list.fetch(0, REXML::Nodes[])
106
99
  end
107
100
  when "intlike"
108
101
  kind = attributes["k"] || "int"
109
102
  size = (attributes["in"]) ? "inl" : "lrg"
110
103
  symbol = ZoticaBuilder.fetch_integral_symbol(kind, size)
111
104
  this << ZoticaBuilder.build_integral(symbol, size, options) do |sub_this, super_this|
112
- sub_this << children_list.fetch(0, Nodes[])
113
- super_this << children_list.fetch(1, Nodes[])
105
+ sub_this << children_list.fetch(0, REXML::Nodes[])
106
+ super_this << children_list.fetch(1, REXML::Nodes[])
114
107
  end
115
108
  when DATA["integral"].method(:key?)
116
109
  size = (attributes["in"]) ? "inl" : "lrg"
117
110
  symbol = ZoticaBuilder.fetch_integral_symbol(name, size)
118
111
  this << ZoticaBuilder.build_integral(symbol, size, options) do |sub_this, super_this|
119
- sub_this << children_list.fetch(0, Nodes[])
120
- super_this << children_list.fetch(1, Nodes[])
112
+ sub_this << children_list.fetch(0, REXML::Nodes[])
113
+ super_this << children_list.fetch(1, REXML::Nodes[])
121
114
  end
122
115
  when "sumlike"
123
116
  kind = attributes["k"] || "sum"
124
117
  size = (attributes["in"]) ? "inl" : "lrg"
125
118
  symbol = ZoticaBuilder.fetch_sum_symbol(kind, size)
126
119
  this << ZoticaBuilder.build_sum(symbol, size, options) do |under_this, over_this|
127
- under_this << children_list.fetch(0, Nodes[])
128
- over_this << children_list.fetch(1, Nodes[])
120
+ under_this << children_list.fetch(0, REXML::Nodes[])
121
+ over_this << children_list.fetch(1, REXML::Nodes[])
129
122
  end
130
123
  when DATA["sum"].method(:key?)
131
124
  size = (attributes["in"]) ? "inl" : "lrg"
132
125
  symbol = ZoticaBuilder.fetch_sum_symbol(name, size)
133
126
  this << ZoticaBuilder.build_sum(symbol, size, options) do |under_this, over_this|
134
- under_this << children_list.fetch(0, Nodes[])
135
- over_this << children_list.fetch(1, Nodes[])
127
+ under_this << children_list.fetch(0, REXML::Nodes[])
128
+ over_this << children_list.fetch(1, REXML::Nodes[])
136
129
  end
137
130
  when "accent"
138
131
  kind = attributes["k"]
139
132
  under_symbol = ZoticaBuilder.fetch_accent_symbol(kind, 0)
140
133
  over_symbol = ZoticaBuilder.fetch_accent_symbol(kind, 1)
141
134
  this << ZoticaBuilder.build_accent(under_symbol, over_symbol, options) do |base_this|
142
- base_this << children_list.fetch(0, Nodes[])
135
+ base_this << children_list.fetch(0, REXML::Nodes[])
143
136
  end
144
137
  when DATA["accent"].method(:key?)
145
138
  under_symbol = ZoticaBuilder.fetch_accent_symbol(name, 0)
146
139
  over_symbol = ZoticaBuilder.fetch_accent_symbol(name, 1)
147
140
  this << ZoticaBuilder.build_accent(under_symbol, over_symbol, options) do |base_this|
148
- base_this << children_list.fetch(0, Nodes[])
141
+ base_this << children_list.fetch(0, REXML::Nodes[])
149
142
  end
150
143
  when "wide"
151
144
  kind = attributes["k"]
@@ -154,7 +147,7 @@ module ZoticaSingleParserMethod
154
147
  over_symbol = ZoticaBuilder.fetch_wide_symbol(kind, 1, stretch_level)
155
148
  modify = !stretch_level
156
149
  this << ZoticaBuilder.build_wide(kind, under_symbol, over_symbol, modify, options) do |base_this|
157
- base_this << children_list.fetch(0, Nodes[])
150
+ base_this << children_list.fetch(0, REXML::Nodes[])
158
151
  end
159
152
  when DATA["wide"].method(:key?)
160
153
  stretch_level = attributes["s"]
@@ -162,98 +155,98 @@ module ZoticaSingleParserMethod
162
155
  over_symbol = ZoticaBuilder.fetch_wide_symbol(name, 1, stretch_level)
163
156
  modify = !stretch_level
164
157
  this << ZoticaBuilder.build_wide(name, under_symbol, over_symbol, modify, options) do |base_this|
165
- base_this << children_list.fetch(0, Nodes[])
158
+ base_this << children_list.fetch(0, REXML::Nodes[])
166
159
  end
167
160
  when "multi"
168
161
  this << ZoticaBuilder.build_subsuper(options) do |base_this, sub_this, super_this, left_sub_this, left_super_this|
169
- base_this << children_list.fetch(0, Nodes[])
170
- sub_this << children_list.fetch(1, Nodes[])
171
- super_this << children_list.fetch(2, Nodes[])
172
- left_sub_this << children_list.fetch(3, Nodes[])
173
- left_super_this << children_list.fetch(4, Nodes[])
162
+ base_this << children_list.fetch(0, REXML::Nodes[])
163
+ sub_this << children_list.fetch(1, REXML::Nodes[])
164
+ super_this << children_list.fetch(2, REXML::Nodes[])
165
+ left_sub_this << children_list.fetch(3, REXML::Nodes[])
166
+ left_super_this << children_list.fetch(4, REXML::Nodes[])
174
167
  end
175
168
  when "sb"
176
169
  this << ZoticaBuilder.build_subsuper(options) do |base_this, sub_this, super_this, left_sub_element, left_super_element|
177
- base_this << children_list.fetch(0, Nodes[])
178
- sub_this << children_list.fetch(1, Nodes[])
170
+ base_this << children_list.fetch(0, REXML::Nodes[])
171
+ sub_this << children_list.fetch(1, REXML::Nodes[])
179
172
  end
180
173
  when "sp"
181
174
  this << ZoticaBuilder.build_subsuper(options) do |base_this, sub_this, super_this, left_sub_element, left_super_element|
182
- base_this << children_list.fetch(0, Nodes[])
183
- super_this << children_list.fetch(1, Nodes[])
175
+ base_this << children_list.fetch(0, REXML::Nodes[])
176
+ super_this << children_list.fetch(1, REXML::Nodes[])
184
177
  end
185
178
  when "sbsp"
186
179
  this << ZoticaBuilder.build_subsuper(options) do |base_this, sub_this, super_this, left_sub_element, left_super_element|
187
- base_this << children_list.fetch(0, Nodes[])
188
- sub_this << children_list.fetch(1, Nodes[])
189
- super_this << children_list.fetch(2, Nodes[])
180
+ base_this << children_list.fetch(0, REXML::Nodes[])
181
+ sub_this << children_list.fetch(1, REXML::Nodes[])
182
+ super_this << children_list.fetch(2, REXML::Nodes[])
190
183
  end
191
184
  when "unov"
192
185
  this << ZoticaBuilder.build_underover(options) do |base_this, under_this, over_this|
193
- base_this << children_list.fetch(0, Nodes[])
194
- under_this << children_list.fetch(1, Nodes[])
195
- over_this << children_list.fetch(2, Nodes[])
186
+ base_this << children_list.fetch(0, REXML::Nodes[])
187
+ under_this << children_list.fetch(1, REXML::Nodes[])
188
+ over_this << children_list.fetch(2, REXML::Nodes[])
196
189
  end
197
190
  when "un"
198
191
  this << ZoticaBuilder.build_underover(options) do |base_this, under_this, over_this|
199
- base_this << children_list.fetch(0, Nodes[])
200
- under_this << children_list.fetch(1, Nodes[])
192
+ base_this << children_list.fetch(0, REXML::Nodes[])
193
+ under_this << children_list.fetch(1, REXML::Nodes[])
201
194
  end
202
195
  when "ov"
203
196
  this << ZoticaBuilder.build_underover(options) do |base_this, under_this, over_this|
204
- base_this << children_list.fetch(0, Nodes[])
205
- over_this << children_list.fetch(1, Nodes[])
197
+ base_this << children_list.fetch(0, REXML::Nodes[])
198
+ over_this << children_list.fetch(1, REXML::Nodes[])
206
199
  end
207
200
  when "frac"
208
201
  this << ZoticaBuilder.build_fraction(options) do |numerator_this, denominator_this|
209
- numerator_this << children_list.fetch(0, Nodes[])
210
- denominator_this << children_list.fetch(1, Nodes[])
202
+ numerator_this << children_list.fetch(0, REXML::Nodes[])
203
+ denominator_this << children_list.fetch(1, REXML::Nodes[])
211
204
  end
212
205
  when "sqrt"
213
206
  stretch_level = attributes["s"]
214
207
  symbol = ZoticaBuilder.fetch_radical_symbol(stretch_level)
215
208
  modify = !stretch_level
216
209
  this << ZoticaBuilder.build_radical(symbol, modify, options) do |content_this, index_this|
217
- content_this << children_list.fetch(0, Nodes[])
218
- index_this << children_list.fetch(1, Nodes[])
210
+ content_this << children_list.fetch(0, REXML::Nodes[])
211
+ index_this << children_list.fetch(1, REXML::Nodes[])
219
212
  end
220
213
  when "table"
221
214
  type = attributes["t"]
222
215
  align_config = attributes["align"]
223
216
  raw = !!attributes["raw"]
224
217
  this << ZoticaBuilder.build_table(type, align_config, raw, options) do |table_this|
225
- table_this << children_list.fetch(0, Nodes[])
218
+ table_this << children_list.fetch(0, REXML::Nodes[])
226
219
  end
227
220
  when "array"
228
221
  align_config = attributes["align"]
229
222
  this << ZoticaBuilder.build_table("std", align_config, true, options) do |table_this|
230
- table_this << children_list.fetch(0, Nodes[])
223
+ table_this << children_list.fetch(0, REXML::Nodes[])
231
224
  end
232
225
  when "stack"
233
226
  this << ZoticaBuilder.build_table("stk", nil, true, options) do |table_this|
234
- table_this << children_list.fetch(0, Nodes[])
227
+ table_this << children_list.fetch(0, REXML::Nodes[])
235
228
  end
236
229
  when "matrix"
237
230
  this << ZoticaBuilder.build_table("mat", nil, false, options) do |table_this|
238
- table_this << children_list.fetch(0, Nodes[])
231
+ table_this << children_list.fetch(0, REXML::Nodes[])
239
232
  end
240
233
  when "case"
241
234
  left_symbol = ZoticaBuilder.fetch_fence_symbol("brace", 0, nil)
242
235
  right_symbol = ZoticaBuilder.fetch_fence_symbol("none", 1, nil)
243
236
  this << ZoticaBuilder.build_fence("brace", "none", left_symbol, right_symbol, true, options) do |this|
244
237
  this << ZoticaBuilder.build_table("cas", "ll", false) do |table_this|
245
- table_this << children_list.fetch(0, Nodes[])
238
+ table_this << children_list.fetch(0, REXML::Nodes[])
246
239
  end
247
240
  end
248
241
  when "diag"
249
242
  vertical_gaps_string = attributes["ver"]
250
243
  horizontal_gaps_string = attributes["hor"]
251
244
  this << ZoticaBuilder.build_diagram(vertical_gaps_string, horizontal_gaps_string, options) do |table_this|
252
- table_this << children_list.fetch(0, Nodes[])
245
+ table_this << children_list.fetch(0, REXML::Nodes[])
253
246
  end
254
247
  when "c"
255
248
  this << ZoticaBuilder.build_table_cell(options) do |cell_this|
256
- cell_this << children_list.fetch(0, Nodes[])
249
+ cell_this << children_list.fetch(0, REXML::Nodes[])
257
250
  end
258
251
  when "cc"
259
252
  children_list.each do |children|
@@ -261,11 +254,11 @@ module ZoticaSingleParserMethod
261
254
  cell_this << children
262
255
  end
263
256
  end
264
- this << Element.new("math-sys-br")
257
+ this << REXML::Element.new("math-sys-br")
265
258
  when "v"
266
259
  vertex_name = attributes["name"]
267
260
  this << ZoticaBuilder.build_diagram_vertex(vertex_name, options) do |vertex_this|
268
- vertex_this << children_list.fetch(0, Nodes[])
261
+ vertex_this << children_list.fetch(0, REXML::Nodes[])
269
262
  end
270
263
  when "vv"
271
264
  children_list.each do |children|
@@ -273,7 +266,7 @@ module ZoticaSingleParserMethod
273
266
  vertex_this << children
274
267
  end
275
268
  end
276
- this << Element.new("math-sys-br")
269
+ this << REXML::Element.new("math-sys-br")
277
270
  when "ar"
278
271
  configs = {}
279
272
  configs[:start_config] = attributes["s"]
@@ -288,35 +281,35 @@ module ZoticaSingleParserMethod
288
281
  configs[:mark] = attributes["mark"]
289
282
  arrow_name = attributes["name"]
290
283
  this << ZoticaBuilder.build_arrow(arrow_name, configs, options) do |label_this|
291
- label_this << children_list.fetch(0, Nodes[])
284
+ label_this << children_list.fetch(0, REXML::Nodes[])
292
285
  end
293
286
  when "tree"
294
287
  this << ZoticaBuilder.build_tree(options) do |content_this|
295
- content_this << children_list.fetch(0, Nodes[])
288
+ content_this << children_list.fetch(0, REXML::Nodes[])
296
289
  end
297
290
  when "axm"
298
291
  this << ZoticaBuilder.build_tree_axiom(options) do |content_this|
299
- content_this << children_list.fetch(0, Nodes[])
292
+ content_this << children_list.fetch(0, REXML::Nodes[])
300
293
  end
301
294
  when "infr"
302
295
  number = attributes["n"].to_i
303
296
  this << ZoticaBuilder.build_tree_inference(number, options) do |content_this, right_label_this, left_label_this|
304
- content_this << children_list.fetch(0, Nodes[])
305
- right_label_this << children_list.fetch(1, Nodes[])
306
- left_label_this << children_list.fetch(2, Nodes[])
297
+ content_this << children_list.fetch(0, REXML::Nodes[])
298
+ right_label_this << children_list.fetch(1, REXML::Nodes[])
299
+ left_label_this << children_list.fetch(2, REXML::Nodes[])
307
300
  end
308
301
  when "br"
309
- this << Element.new("math-sys-br")
302
+ this << REXML::Element.new("math-sys-br")
310
303
  when "g"
311
304
  transform_configs = {}
312
305
  transform_configs[:rotate] = attributes["rotate"]
313
306
  this << ZoticaBuilder.build_group(transform_configs, options) do |content_this|
314
- content_this << children_list.fetch(0, Nodes[])
307
+ content_this << children_list.fetch(0, REXML::Nodes[])
315
308
  end
316
309
  when "ph", "vph", "hph"
317
310
  type = PHANTOM_TYPES[name] || attributes["t"] || "bth"
318
311
  this << ZoticaBuilder.build_phantom(type, options) do |content_this|
319
- content_this << children_list.fetch(0, Nodes[])
312
+ content_this << children_list.fetch(0, REXML::Nodes[])
320
313
  end
321
314
  when "s"
322
315
  type = attributes["t"] || "medium"
@@ -325,18 +318,18 @@ module ZoticaSingleParserMethod
325
318
  type = SPACE_ALTERNATIVES[name]
326
319
  this << ZoticaBuilder.build_space(type, options)
327
320
  else
328
- this << Element.build(name) do |this|
321
+ this << REXML::Element.build(name) do |this|
329
322
  attributes.each do |key, value|
330
323
  this[key] = value
331
324
  end
332
- this << children_list.fetch(0, Nodes[])
325
+ this << children_list.fetch(0, REXML::Nodes[])
333
326
  end
334
327
  end
335
328
  return this
336
329
  end
337
330
 
338
331
  def create_math_text(text, options = {})
339
- this = Nodes[]
332
+ this = REXML::Nodes[]
340
333
  options[:fonts] = @fonts
341
334
  text.each_char do |char|
342
335
  if char =~ /\p{Number}/
@@ -367,7 +360,7 @@ module ZoticaSingleParserMethod
367
360
  end
368
361
 
369
362
  def parse_math_root
370
- element = Element.new("math-root")
363
+ element = REXML::Element.new("math-root")
371
364
  children = parse_nodes({})
372
365
  if @exact
373
366
  parse_eof
@@ -427,12 +420,17 @@ module ZoticaSingleParserMethod
427
420
  return escape
428
421
  end
429
422
 
423
+ ZoticaBuilder = Zenithal::ZoticaBuilder
424
+
425
+ DATA = ZoticaBuilder::DATA
426
+ DEFAULT_FONTS = ZoticaBuilder::DEFAULT_FONTS
427
+
430
428
  end
431
429
 
432
430
 
433
- class ZoticaSingleParser < ZenithalParser
431
+ class Zenithal::ZoticaSingleParser < Zenithal::ZenithalParser
434
432
 
435
- include ZoticaSingleParserMethod
433
+ include Zenithal::ZoticaSingleParserMethod
436
434
 
437
435
  attr_accessor :exact
438
436
  attr_accessor :fonts
@@ -459,7 +457,7 @@ class ZoticaSingleParser < ZenithalParser
459
457
  end
460
458
 
461
459
 
462
- class ZoticaParser < ZenithalParser
460
+ class Zenithal::ZoticaParser < Zenithal::ZenithalParser
463
461
 
464
462
  def initialize(source)
465
463
  super(source)
@@ -477,7 +475,7 @@ class ZoticaParser < ZenithalParser
477
475
  def register_math_macro(name, &block)
478
476
  outer_self = self
479
477
  register_plugin(name) do |attributes|
480
- parser = ZoticaSingleParser.new(@source)
478
+ parser = Zenithal::ZoticaSingleParser.new(@source)
481
479
  @raw_macro_names.each do |raw_macro_name|
482
480
  parser.register_plugin(raw_macro_name) do |_|
483
481
  raw_parser = outer_self.clone
@@ -522,14 +520,14 @@ class ZoticaParser < ZenithalParser
522
520
 
523
521
  def register_resource_macro(name)
524
522
  register_macro(name) do |attributes, children_list|
525
- style_string = ZoticaBuilder.create_style_string(attributes["font-url"])
526
- script_string = ZoticaBuilder.create_script_string
527
- nodes = Nodes[]
528
- nodes << Element.build("style") do |element|
529
- element << Text.new(style_string, true, nil, true)
530
- end
531
- nodes << Element.build("script") do |element|
532
- element << CData.new(script_string)
523
+ style_string = Zenithal::ZoticaBuilder.create_style_string(attributes["font-url"])
524
+ script_string = Zenithal::ZoticaBuilder.create_script_string
525
+ nodes = REXML::Nodes[]
526
+ nodes << REXML::Element.build("style") do |element|
527
+ element << REXML::Text.new(style_string, true, nil, true)
528
+ end
529
+ nodes << REXML::Element.build("script") do |element|
530
+ element << REXML::CData.new(script_string)
533
531
  end
534
532
  next nodes
535
533
  end
@@ -589,6 +589,12 @@ math-space {
589
589
  }
590
590
  }
591
591
 
592
+ @each $name, $margin in $margins {
593
+ &.m#{$name} {
594
+ margin-left: spacing(-$margin) !important;
595
+ }
596
+ }
597
+
592
598
  }
593
599
 
594
600
 
data/source/zotica.rb CHANGED
@@ -1,14 +1,19 @@
1
1
  # coding: utf-8
2
2
 
3
3
 
4
- require 'zenml'
4
+ module Zenithal
5
5
 
6
+ ZOTICA_VERSION = "1.0.1"
7
+ ZOTICA_VERSION_ARRAY = VERSION.split(/\./).map(&:to_i)
6
8
 
7
- module Zenithal
9
+ end
8
10
 
9
- ZOTICA_VERSION = "1.0.0"
10
11
 
11
- require_relative 'zotica/builder'
12
- require_relative 'zotica/parser'
12
+ require 'json'
13
+ require 'rexml/document'
14
+ require 'sassc'
15
+ require 'ttfunk'
16
+ require 'zenml'
13
17
 
14
- end
18
+ require_relative 'zotica/builder'
19
+ require_relative 'zotica/parser'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zotica
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ziphil
8
8
  autorequire:
9
9
  bindir: exec
10
10
  cert_chain: []
11
- date: 2020-02-07 00:00:00.000000000 Z
11
+ date: 2020-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zenml