isodoc 1.7.4 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/isodoc.gemspec +7 -5
- data/lib/isodoc/class_utils.rb +25 -2
- data/lib/isodoc/convert.rb +2 -0
- data/lib/isodoc/function/to_word_html.rb +2 -1
- data/lib/isodoc/function/utils.rb +34 -14
- data/lib/isodoc/html_function/comments.rb +107 -111
- data/lib/isodoc/html_function/footnotes.rb +68 -67
- data/lib/isodoc/html_function/html.rb +113 -103
- data/lib/isodoc/presentation_function/block.rb +73 -78
- data/lib/isodoc/presentation_function/concept.rb +68 -0
- data/lib/isodoc/presentation_function/image.rb +112 -0
- data/lib/isodoc/presentation_function/inline.rb +20 -49
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +176 -174
- data/lib/isodoc/word_function/comments.rb +117 -112
- data/lib/isodoc/word_function/footnotes.rb +88 -86
- data/lib/isodoc/word_function/inline.rb +42 -67
- data/lib/isodoc/word_function/postprocess_cover.rb +121 -110
- data/lib/isodoc/xref/xref_gen.rb +153 -150
- data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
- data/lib/isodoc/xslfo_convert.rb +7 -6
- data/spec/assets/i18n.yaml +3 -1
- data/spec/assets/odf.svg +1 -4
- data/spec/isodoc/blocks_spec.rb +229 -157
- data/spec/isodoc/i18n_spec.rb +3 -3
- data/spec/isodoc/inline_spec.rb +304 -105
- data/spec/isodoc/postproc_spec.rb +38 -0
- data/spec/isodoc/presentation_xml_spec.rb +60 -0
- data/spec/isodoc/section_spec.rb +125 -0
- data/spec/isodoc/terms_spec.rb +116 -0
- data/spec/isodoc/xslfo_convert_spec.rb +16 -4
- metadata +57 -27
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -209,8 +209,7 @@ RSpec.describe IsoDoc do
|
|
209
209
|
<renderterm>word</renderterm>
|
210
210
|
<termref base='IEV' target='135-13-13'>The IEV database</termref>
|
211
211
|
</concept></li>
|
212
|
-
<li><concept
|
213
|
-
<renderterm>word</renderterm>
|
212
|
+
<li><concept>
|
214
213
|
<strong>error!</strong>
|
215
214
|
</concept>
|
216
215
|
</li>
|
@@ -295,7 +294,7 @@ RSpec.describe IsoDoc do
|
|
295
294
|
<li>
|
296
295
|
<em>word</em> [<termref base="IEV" target="135-13-13">The IEV database</termref>]
|
297
296
|
</li>
|
298
|
-
<li> <
|
297
|
+
<li> <strong>error!</strong> </li>
|
299
298
|
</ul>
|
300
299
|
</p>
|
301
300
|
</foreword></preface>
|
@@ -380,7 +379,7 @@ RSpec.describe IsoDoc do
|
|
380
379
|
<i>word</i>
|
381
380
|
[The IEV database]
|
382
381
|
</li>
|
383
|
-
<li> <
|
382
|
+
<li> <b>error!</b> </li>
|
384
383
|
</ul>
|
385
384
|
</p>
|
386
385
|
</div>
|
@@ -414,107 +413,129 @@ RSpec.describe IsoDoc do
|
|
414
413
|
|
415
414
|
it "processes concept attributes" do
|
416
415
|
input = <<~INPUT
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
</
|
416
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
417
|
+
<preface><foreword>
|
418
|
+
<p>
|
419
|
+
<ul>
|
420
|
+
<li><concept ital="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
421
|
+
<li><concept ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
422
|
+
<li><concept ital="true" ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
423
|
+
<li><concept ital="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
424
|
+
<li><concept ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
425
|
+
<li><concept ital="false" ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
426
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
427
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
428
|
+
<li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
429
|
+
<li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
430
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><strong>error!</strong></concept></li>
|
431
|
+
<li><concept ital="false" ref="false" linkmention="true">
|
432
|
+
<refterm>CV_DiscreteCoverage</refterm>
|
433
|
+
<renderterm>CV_DiscreteCoverage</renderterm>
|
434
|
+
<xref target="term-cv_discretecoverage"/>
|
435
|
+
</concept></li>
|
436
|
+
</ul></p>
|
437
|
+
</foreword></preface>
|
438
|
+
<sections>
|
439
|
+
<clause id="clause1"><title>Clause 1</title></clause>
|
440
|
+
</sections>
|
441
|
+
</iso-standard>
|
434
442
|
INPUT
|
435
443
|
presxml = <<~OUTPUT
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
<li>
|
458
|
-
<em>term</em>,
|
459
|
-
|
460
|
-
</li>
|
461
|
-
<li>
|
462
|
-
term,
|
463
|
-
|
464
|
-
</li>
|
465
|
-
</ul></p>
|
466
|
-
</foreword></preface>
|
467
|
-
<sections>
|
468
|
-
<clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
|
469
|
-
</sections>
|
444
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
445
|
+
<preface><foreword displayorder="1">
|
446
|
+
<p>
|
447
|
+
<ul>
|
448
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
449
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
450
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
451
|
+
<li>term [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
452
|
+
<li><em>term</em>,</li>
|
453
|
+
<li>term,</li>
|
454
|
+
<li><xref target="clause1"><em>term</em></xref> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
455
|
+
<li><xref target="clause1"><em>term</em></xref> [term defined in Clause 1],</li>
|
456
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
457
|
+
<li><em>term</em> [term defined in Clause 1],</li>
|
458
|
+
<li><strong>error!</strong></li>
|
459
|
+
<li><xref target='term-cv_discretecoverage'>CV_DiscreteCoverage</xref></li>
|
460
|
+
</ul></p>
|
461
|
+
</foreword></preface>
|
462
|
+
<sections>
|
463
|
+
<clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
|
464
|
+
</sections>
|
470
465
|
</iso-standard>
|
471
466
|
OUTPUT
|
472
467
|
output = <<~OUTPUT
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
468
|
+
#{HTML_HDR}
|
469
|
+
<br/>
|
470
|
+
<div>
|
471
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
472
|
+
<p>
|
473
|
+
<ul>
|
474
|
+
<li>
|
475
|
+
<i>term</i>
|
476
|
+
[term defined in
|
477
|
+
<a href='#clause1'>Clause 1</a>
|
478
|
+
],
|
479
|
+
</li>
|
480
|
+
<li>
|
481
|
+
<i>term</i>
|
482
|
+
[term defined in
|
483
|
+
<a href='#clause1'>Clause 1</a>
|
484
|
+
],
|
485
|
+
</li>
|
486
|
+
<li>
|
487
|
+
<i>term</i>
|
488
|
+
[term defined in
|
489
|
+
<a href='#clause1'>Clause 1</a>
|
490
|
+
],
|
491
|
+
</li>
|
492
|
+
<li>
|
493
|
+
term [term defined in
|
494
|
+
<a href='#clause1'>Clause 1</a>
|
495
|
+
],
|
496
|
+
</li>
|
497
|
+
<li>
|
498
|
+
<i>term</i>,
|
499
|
+
</li>
|
500
|
+
<li>term,</li>
|
501
|
+
<li>
|
502
|
+
<a href='#clause1'>
|
503
|
+
<i>term</i>
|
504
|
+
</a>
|
505
|
+
[term defined in
|
506
|
+
<a href='#clause1'>Clause 1</a>
|
507
|
+
],
|
508
|
+
</li>
|
509
|
+
<li>
|
510
|
+
<a href='#clause1'>
|
511
|
+
<i>term</i>
|
512
|
+
</a>
|
513
|
+
[term defined in Clause 1],
|
514
|
+
</li>
|
515
|
+
<li>
|
516
|
+
<i>term</i>
|
517
|
+
[term defined in
|
518
|
+
<a href='#clause1'>Clause 1</a>
|
519
|
+
],
|
520
|
+
</li>
|
521
|
+
<li>
|
522
|
+
<i>term</i>
|
523
|
+
[term defined in Clause 1],
|
524
|
+
</li>
|
525
|
+
<li> <b>error!</b> </li>
|
526
|
+
<li> <a href='#term-cv_discretecoverage'>CV_DiscreteCoverage</a> </li>
|
527
|
+
</ul>
|
528
|
+
</p>
|
529
|
+
</div>
|
530
|
+
<p class='zzSTDTitle1'/>
|
531
|
+
<div id='clause1'>
|
532
|
+
<h1>1.  Clause 1</h1>
|
533
|
+
</div>
|
534
|
+
</div>
|
535
|
+
</body>
|
536
|
+
</html>
|
516
537
|
OUTPUT
|
517
|
-
expect((IsoDoc::PresentationXMLConvert.new({})
|
538
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
518
539
|
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
519
540
|
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
520
541
|
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
@@ -1002,6 +1023,7 @@ RSpec.describe IsoDoc do
|
|
1002
1023
|
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
1003
1024
|
<eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
|
1004
1025
|
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
1026
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:URI"><referenceFrom>7</referenceFrom></locality></eref>
|
1005
1027
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
1006
1028
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
|
1007
1029
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
@@ -1040,6 +1062,7 @@ RSpec.describe IsoDoc do
|
|
1040
1062
|
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
1041
1063
|
<eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
|
1042
1064
|
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
|
1065
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:URI"><referenceFrom>7</referenceFrom></locality>ISO 712, URI 7</eref>
|
1043
1066
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
1044
1067
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
|
1045
1068
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
@@ -1082,6 +1105,7 @@ RSpec.describe IsoDoc do
|
|
1082
1105
|
<a href="#ISO712">A</a>
|
1083
1106
|
<a href="#ISO712">ISO 712, Whole of text</a>
|
1084
1107
|
<a href="#ISO712">ISO 712, Prelude 7</a>
|
1108
|
+
<a href="#ISO712">ISO 712, URI 7</a>
|
1085
1109
|
<a href="#ISO712">A</a>
|
1086
1110
|
<a href='#ISO712'>ISO 712</a>
|
1087
1111
|
<a href='#ISO712'>ISO 712, Clause 1</a>
|
@@ -1364,6 +1388,65 @@ RSpec.describe IsoDoc do
|
|
1364
1388
|
.convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
|
1365
1389
|
end
|
1366
1390
|
|
1391
|
+
it "processes eref content with Unicode characters" do
|
1392
|
+
input = <<~INPUT
|
1393
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1394
|
+
<preface><foreword>
|
1395
|
+
<p>
|
1396
|
+
<eref type="inline" bibitemid="ISO712" citeas="BSI BS EN ISO 19011:2018 — TC"/>
|
1397
|
+
</foreword></preface>
|
1398
|
+
<bibliography>
|
1399
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
1400
|
+
<title>Normative References</title>
|
1401
|
+
<bibitem id='ISO712' type='standard'>
|
1402
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
1403
|
+
<uri type='citation'>http://www.example.com</uri>
|
1404
|
+
<docidentifier>ISO 712</docidentifier>
|
1405
|
+
<contributor>
|
1406
|
+
<role type='publisher'/>
|
1407
|
+
<organization>
|
1408
|
+
<abbreviation>ISO</abbreviation>
|
1409
|
+
</organization>
|
1410
|
+
</contributor>
|
1411
|
+
</bibitem>
|
1412
|
+
</references></bibliography>
|
1413
|
+
</iso-standard>
|
1414
|
+
INPUT
|
1415
|
+
presxml = <<~OUTPUT
|
1416
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1417
|
+
<preface>
|
1418
|
+
<foreword displayorder='1'>
|
1419
|
+
<p>
|
1420
|
+
<eref type='inline' bibitemid='ISO712' citeas='BSI BS EN ISO 19011:2018 — TC'>BSI BS EN ISO 19011:2018 — TC</eref>
|
1421
|
+
</p>
|
1422
|
+
</foreword>
|
1423
|
+
<bibliography displayorder='2'>
|
1424
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder='3'>
|
1425
|
+
<title depth='1'>
|
1426
|
+
1.
|
1427
|
+
<tab/>
|
1428
|
+
Normative References
|
1429
|
+
</title>
|
1430
|
+
<bibitem id='ISO712' type='standard'>
|
1431
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
1432
|
+
<uri type='citation'>http://www.example.com</uri>
|
1433
|
+
<docidentifier>ISO 712</docidentifier>
|
1434
|
+
<contributor>
|
1435
|
+
<role type='publisher'/>
|
1436
|
+
<organization>
|
1437
|
+
<abbreviation>ISO</abbreviation>
|
1438
|
+
</organization>
|
1439
|
+
</contributor>
|
1440
|
+
</bibitem>
|
1441
|
+
</references>
|
1442
|
+
</bibliography>
|
1443
|
+
</preface>
|
1444
|
+
</iso-standard>
|
1445
|
+
OUTPUT
|
1446
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1447
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1448
|
+
end
|
1449
|
+
|
1367
1450
|
it "processes variant" do
|
1368
1451
|
input = <<~INPUT
|
1369
1452
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -1422,6 +1505,122 @@ RSpec.describe IsoDoc do
|
|
1422
1505
|
end
|
1423
1506
|
|
1424
1507
|
it "cases xrefs" do
|
1508
|
+
input = <<~INPUT
|
1509
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1510
|
+
<preface>
|
1511
|
+
<clause id="CC"><title>Introduction</title></clause>
|
1512
|
+
<sections>
|
1513
|
+
<clause id="A">
|
1514
|
+
<table id="B">
|
1515
|
+
</table>
|
1516
|
+
<figure id="B1"/>
|
1517
|
+
<example id="B2"/>
|
1518
|
+
</clause>
|
1519
|
+
<clause id="C">
|
1520
|
+
<p>This is <xref target="A"/> and <xref target="B"/>.
|
1521
|
+
This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
|
1522
|
+
This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
|
1523
|
+
Downcasing an xref affects only the first letter: <xref target="B2" case="lowercase"/>.
|
1524
|
+
Capitalising an xref affects only the first letter: <xref target="B1" case="capital"/>.
|
1525
|
+
<xref target="A"/> is clause <em>initial.</em><br/>
|
1526
|
+
<xref target="A"/> is too. </p>
|
1527
|
+
<p><xref target="A"/> is also.</p>
|
1528
|
+
<p>Annex has formatting, and crossreferences ignore it when determining casing. <xref target="AA"/>.</p>
|
1529
|
+
<p>Labels are not subject to casing: <xref target="CC" case="lowercase"/>
|
1530
|
+
</clause>
|
1531
|
+
<annex id="AA">
|
1532
|
+
<clause id="AA1"/>
|
1533
|
+
</annex>
|
1534
|
+
</sections>
|
1535
|
+
</iso-standard>
|
1536
|
+
INPUT
|
1537
|
+
output = <<~OUTPUT
|
1538
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1539
|
+
<preface>
|
1540
|
+
<clause id='CC' displayorder='1'>
|
1541
|
+
<title depth='1'>Introduction</title>
|
1542
|
+
</clause>
|
1543
|
+
<sections displayorder='2'>
|
1544
|
+
<clause id='A' displayorder='3'>
|
1545
|
+
<title>1.</title>
|
1546
|
+
<table id='B'>
|
1547
|
+
<name>Tabelo 1</name>
|
1548
|
+
</table>
|
1549
|
+
<figure id='B1'>
|
1550
|
+
<name>Figur-etikedo duvorta 1</name>
|
1551
|
+
</figure>
|
1552
|
+
<example id='B2'>
|
1553
|
+
<name>Ekzempl-etikedo Duvorta</name>
|
1554
|
+
</example>
|
1555
|
+
</clause>
|
1556
|
+
<clause id='C' displayorder='4'>
|
1557
|
+
<title>2.</title>
|
1558
|
+
<p>
|
1559
|
+
This is
|
1560
|
+
<xref target='A'>klaŭzo 1</xref>
|
1561
|
+
and
|
1562
|
+
<xref target='B'>tabelo 1</xref>
|
1563
|
+
. This is
|
1564
|
+
<xref target='A' case='capital'>Klaŭzo 1</xref>
|
1565
|
+
and
|
1566
|
+
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1567
|
+
. This is
|
1568
|
+
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1569
|
+
and
|
1570
|
+
<xref target='B' case='capital'>Tabelo 1</xref>
|
1571
|
+
. Downcasing an xref affects only the first letter:
|
1572
|
+
<xref target='B2' case='lowercase'>klaŭzo 1, Example</xref>
|
1573
|
+
. Capitalising an xref affects only the first letter:
|
1574
|
+
<xref target='B1' case='capital'>Figur-etikedo duvorta 1</xref>
|
1575
|
+
.
|
1576
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1577
|
+
is clause
|
1578
|
+
<em>initial.</em>
|
1579
|
+
<br/>
|
1580
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1581
|
+
is too.
|
1582
|
+
</p>
|
1583
|
+
<p>
|
1584
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1585
|
+
is also.
|
1586
|
+
</p>
|
1587
|
+
<p>
|
1588
|
+
Annex has formatting, and crossreferences ignore it when determining
|
1589
|
+
casing.
|
1590
|
+
<xref target='AA'>
|
1591
|
+
<strong>Aldono</strong>
|
1592
|
+
A
|
1593
|
+
</xref>
|
1594
|
+
.
|
1595
|
+
</p>
|
1596
|
+
<p>
|
1597
|
+
Labels are not subject to casing:
|
1598
|
+
<xref target='CC' case='lowercase'>Introduction</xref>
|
1599
|
+
</p>
|
1600
|
+
<annex id='AA' displayorder='5'>
|
1601
|
+
<title>
|
1602
|
+
<strong>
|
1603
|
+
<strong>Aldono</strong>
|
1604
|
+
A
|
1605
|
+
</strong>
|
1606
|
+
<br/>
|
1607
|
+
(informa)
|
1608
|
+
</title>
|
1609
|
+
<clause id='AA1'>
|
1610
|
+
<title>A.1.</title>
|
1611
|
+
</clause>
|
1612
|
+
</annex>
|
1613
|
+
</clause>
|
1614
|
+
</sections>
|
1615
|
+
</preface>
|
1616
|
+
</iso-standard>
|
1617
|
+
OUTPUT
|
1618
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1619
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1620
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
it "ignores casing of xrefs in unicameral scripts" do
|
1425
1624
|
input = <<~INPUT
|
1426
1625
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1427
1626
|
<sections>
|
@@ -1458,23 +1657,23 @@ RSpec.describe IsoDoc do
|
|
1458
1657
|
and
|
1459
1658
|
<xref target='B'>tabelo 1</xref>
|
1460
1659
|
. This is
|
1461
|
-
<xref target='A' case='capital'>
|
1660
|
+
<xref target='A' case='capital'>klaŭzo 1</xref>
|
1462
1661
|
and
|
1463
1662
|
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1464
1663
|
. This is
|
1465
1664
|
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1466
1665
|
and
|
1467
|
-
<xref target='B' case='capital'>
|
1666
|
+
<xref target='B' case='capital'>tabelo 1</xref>
|
1468
1667
|
.
|
1469
|
-
<xref target='A'>
|
1668
|
+
<xref target='A'>klaŭzo 1</xref>
|
1470
1669
|
is clause
|
1471
1670
|
<em>initial.</em>
|
1472
1671
|
<br/>
|
1473
|
-
<xref target='A'>
|
1672
|
+
<xref target='A'>klaŭzo 1</xref>
|
1474
1673
|
is too.
|
1475
1674
|
</p>
|
1476
1675
|
<p>
|
1477
|
-
<xref target='A'>
|
1676
|
+
<xref target='A'>klaŭzo 1</xref>
|
1478
1677
|
is also.
|
1479
1678
|
</p>
|
1480
1679
|
</clause>
|
@@ -1482,7 +1681,7 @@ RSpec.describe IsoDoc do
|
|
1482
1681
|
</iso-standard>
|
1483
1682
|
OUTPUT
|
1484
1683
|
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1485
|
-
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1684
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml", script: "Hans" })
|
1486
1685
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1487
1686
|
end
|
1488
1687
|
|
@@ -807,6 +807,44 @@ RSpec.describe IsoDoc do
|
|
807
807
|
OUTPUT
|
808
808
|
end
|
809
809
|
|
810
|
+
it "moves images in HTML" do
|
811
|
+
FileUtils.rm_f "test.html"
|
812
|
+
FileUtils.rm_rf "test_htmlimages"
|
813
|
+
IsoDoc::HtmlConvert.new(
|
814
|
+
{ baseassetpath: "spec/assets",
|
815
|
+
wordstylesheet: "word.css",
|
816
|
+
htmlstylesheet: "html.scss" },
|
817
|
+
).convert("test", <<~"INPUT", false)
|
818
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
819
|
+
<preface><foreword>
|
820
|
+
<figure id="_">
|
821
|
+
<name>Split-it-right sample divider</name>
|
822
|
+
<image src="rice_image1.png" id="_" mimetype="image/png"/>
|
823
|
+
</figure>
|
824
|
+
</foreword></preface>
|
825
|
+
</iso-standard>
|
826
|
+
INPUT
|
827
|
+
html = File.read("test.html")
|
828
|
+
.sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
829
|
+
.sub(%r{</main>.*$}m, "</main>")
|
830
|
+
expect(`ls test_htmlimages`).to match(/\.png$/)
|
831
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
|
832
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
833
|
+
<main class='main-section'>
|
834
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
835
|
+
<br/>
|
836
|
+
<div>
|
837
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
838
|
+
<div id='_' class='figure'>
|
839
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
840
|
+
<p class='FigureTitle' style='text-align:center;'>Split-it-right sample divider</p>
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
<p class='zzSTDTitle1'/>
|
844
|
+
</main>
|
845
|
+
OUTPUT
|
846
|
+
end
|
847
|
+
|
810
848
|
describe "mathvariant to plain" do
|
811
849
|
context "when `mathvariant` attr equal to `script`" do
|
812
850
|
it "converts mathvariant text chars into associated plain chars" do
|
@@ -762,6 +762,66 @@ RSpec.describe IsoDoc do
|
|
762
762
|
.to be_equivalent_to xmlpp(output)
|
763
763
|
end
|
764
764
|
|
765
|
+
it "duplicates EMF and SVG files" do
|
766
|
+
input = <<~INPUT
|
767
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
768
|
+
<bibdata/>
|
769
|
+
<sections>
|
770
|
+
<clause id='A' inline-header='false' obligation='normative'>
|
771
|
+
<title>Clause</title>
|
772
|
+
<figure id="B">
|
773
|
+
<image src="spec/assets/odf.svg" mimetype="image/svg+xml" alt="1"/>
|
774
|
+
<image src="spec/assets/odf.emf" mimetype="image/x-emf" alt="2"/>
|
775
|
+
<image src="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPjxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz48L3N2Zz4=" mimetype="image/svg+xml" alt="3"/>
|
776
|
+
<image src="data:application/x-msmetafile;base64,AQAAAMgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAJAQAACgAAAACAAAALgAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADAAIAAoADQAMAAzADUAYQA0AGYALAAgADIAMAAyADAALQAwADUALQAwADEAKQAgAAAAbwBkAGYALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAJAQAAA==" mimetype="image/x-emf" alt="4"/>
|
777
|
+
</figure>
|
778
|
+
</clause>
|
779
|
+
</sections>
|
780
|
+
</iso-standard>
|
781
|
+
INPUT
|
782
|
+
output = <<~OUTPUT
|
783
|
+
<?xml version="1.0"?>
|
784
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
785
|
+
<bibdata/>
|
786
|
+
<sections>
|
787
|
+
<clause id="A" inline-header="false" obligation="normative" displayorder="1">
|
788
|
+
<title depth="1">1.<tab/>Clause</title>
|
789
|
+
<figure id="B"><name>Figure 1</name>
|
790
|
+
<image src="spec/assets/odf.svg" mimetype="image/svg+xml" alt="1"><emf src="spec/assets/odf.emf"/></image>
|
791
|
+
<image src="" mimetype="image/svg+xml" alt="2">
|
792
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1275.0000" height="1275.0000">
|
793
|
+
<g transform="translate(-0.0000, -0.0000)">
|
794
|
+
<g transform="matrix(1.0000 0.0000 0.0000 1.0000 0.0000 0.0000)">
|
795
|
+
<path d="M 1188.0000,625.0000 C 1188.0000,936.0000 936.0000,1188.0000 625.0000,1188.0000 C 314.0000,1188.0000 63.0000,936.0000 63.0000,625.0000 C 63.0000,314.0000 314.0000,63.0000 625.0000,63.0000 C 936.0000,63.0000 1188.0000,314.0000 1188.0000,625.0000 Z " fill="#000099" stroke="none"/>
|
796
|
+
<path d="M 413.0000,325.0000 L 975.0000,325.0000 C 1119.0000,493.0000 1124.0000,739.0000 987.0000,913.0000 C 850.0000,1086.0000 609.0000,1139.0000 413.0000,1038.0000 L 413.0000,713.0000 L 738.0000,713.0000 L 738.0000,538.0000 L 413.0000,538.0000 Z " fill="#FFFFFF" stroke="none"/>
|
797
|
+
</g>
|
798
|
+
</g>
|
799
|
+
</svg>
|
800
|
+
<emf src="data:application/x-msmetafile;base64"/></image>
|
801
|
+
<image src="" mimetype="image/svg+xml" alt="3"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle fill="#009" r="45" cx="50" cy="50"/><path d="M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z" fill="#FFF"/></svg><emf src="data:application/x-msmetafile;base64"/></image>
|
802
|
+
<image src="" mimetype="image/svg+xml" alt="4">
|
803
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1275.0000" height="1275.0000">
|
804
|
+
<g transform="translate(-0.0000, -0.0000)">
|
805
|
+
<g transform="matrix(1.0000 0.0000 0.0000 1.0000 0.0000 0.0000)">
|
806
|
+
<path d="M 1188.0000,625.0000 C 1188.0000,936.0000 936.0000,1188.0000 625.0000,1188.0000 C 314.0000,1188.0000 63.0000,936.0000 63.0000,625.0000 C 63.0000,314.0000 314.0000,63.0000 625.0000,63.0000 C 936.0000,63.0000 1188.0000,314.0000 1188.0000,625.0000 Z " fill="#000099" stroke="none"/>
|
807
|
+
<path d="M 413.0000,325.0000 L 975.0000,325.0000 C 1119.0000,493.0000 1124.0000,739.0000 987.0000,913.0000 C 850.0000,1086.0000 609.0000,1139.0000 413.0000,1038.0000 L 413.0000,713.0000 L 738.0000,713.0000 L 738.0000,538.0000 L 413.0000,538.0000 Z " fill="#FFFFFF" stroke="none"/>
|
808
|
+
</g>
|
809
|
+
</g>
|
810
|
+
</svg>
|
811
|
+
<emf src="data:application/x-msmetafile;base64"/></image>
|
812
|
+
</figure>
|
813
|
+
</clause>
|
814
|
+
</sections>
|
815
|
+
</iso-standard>
|
816
|
+
OUTPUT
|
817
|
+
expect(IsoDoc::PresentationXMLConvert.new({})
|
818
|
+
.convert("test", input, true)
|
819
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")
|
820
|
+
.gsub(%r{"data:application/x-msmetafile;base64,[^"]+"},
|
821
|
+
'"data:application/x-msmetafile;base64"'))
|
822
|
+
.to be_equivalent_to (output)
|
823
|
+
end
|
824
|
+
|
765
825
|
private
|
766
826
|
|
767
827
|
def mock_symbols
|