isodoc 2.0.3 → 2.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/convert.rb +36 -18
  3. data/lib/isodoc/function/inline.rb +24 -13
  4. data/lib/isodoc/function/references.rb +1 -1
  5. data/lib/isodoc/i18n.rb +20 -7
  6. data/lib/isodoc/metadata_contributor.rb +1 -1
  7. data/lib/isodoc/presentation_function/bibdata.rb +26 -9
  8. data/lib/isodoc/presentation_function/image.rb +3 -4
  9. data/lib/isodoc/presentation_function/inline.rb +119 -76
  10. data/lib/isodoc/presentation_function/math.rb +1 -0
  11. data/lib/isodoc/presentation_function/xrefs.rb +100 -0
  12. data/lib/isodoc/version.rb +1 -1
  13. data/lib/isodoc/word_function/body.rb +11 -1
  14. data/lib/isodoc/word_function/postprocess.rb +4 -6
  15. data/lib/isodoc/word_function/postprocess_cover.rb +82 -1
  16. data/lib/isodoc/xref/xref_anchor.rb +1 -0
  17. data/lib/isodoc/xref/xref_gen.rb +2 -1
  18. data/lib/isodoc/xref/xref_sect_gen.rb +14 -8
  19. data/lib/isodoc/xslfo_convert.rb +19 -19
  20. data/lib/isodoc-yaml/i18n-ar.yaml +11 -0
  21. data/lib/isodoc-yaml/i18n-de.yaml +11 -0
  22. data/lib/isodoc-yaml/i18n-en.yaml +11 -0
  23. data/lib/isodoc-yaml/i18n-es.yaml +11 -0
  24. data/lib/isodoc-yaml/i18n-fr.yaml +11 -0
  25. data/lib/isodoc-yaml/i18n-ru.yaml +11 -0
  26. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +11 -0
  27. data/spec/isodoc/blocks_spec.rb +13 -77
  28. data/spec/isodoc/inline_spec.rb +564 -22
  29. data/spec/isodoc/metadata_spec.rb +1 -1
  30. data/spec/isodoc/postproc_spec.rb +466 -2
  31. data/spec/isodoc/presentation_xml_spec.rb +139 -0
  32. data/spec/isodoc/ref_spec.rb +7 -7
  33. data/spec/isodoc/section_spec.rb +1 -2
  34. data/spec/isodoc/terms_spec.rb +8 -8
  35. data/spec/isodoc/xref_spec.rb +60 -1188
  36. data/spec/isodoc/xslfo_convert_spec.rb +12 -7
  37. metadata +3 -2
@@ -173,12 +173,12 @@ RSpec.describe IsoDoc do
173
173
  <li><concept><refterm>term</refterm>
174
174
  <renderterm>word</renderterm>
175
175
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
176
- <localityStack>
176
+ <localityStack connective="and">
177
177
  <locality type='clause'>
178
178
  <referenceFrom>3.1</referenceFrom>
179
179
  </locality>
180
180
  </localityStack>
181
- <localityStack>
181
+ <localityStack connective="and">
182
182
  <locality type='figure'>
183
183
  <referenceFrom>b</referenceFrom>
184
184
  </locality>
@@ -188,12 +188,12 @@ RSpec.describe IsoDoc do
188
188
  <li><concept><refterm>term</refterm>
189
189
  <renderterm>word</renderterm>
190
190
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
191
- <localityStack>
191
+ <localityStack connective="and">
192
192
  <locality type='clause'>
193
193
  <referenceFrom>3.1</referenceFrom>
194
194
  </locality>
195
195
  </localityStack>
196
- <localityStack>
196
+ <localityStack connective="and">
197
197
  <locality type='figure'>
198
198
  <referenceFrom>b</referenceFrom>
199
199
  </locality>
@@ -263,24 +263,24 @@ RSpec.describe IsoDoc do
263
263
  </locality>ISO 712, Clause 3.1, Figure a</eref>]
264
264
  </li>
265
265
  <li>
266
- <em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
266
+ <em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack connective="and">
267
267
  <locality type="clause">
268
268
  <referenceFrom>3.1</referenceFrom>
269
269
  </locality>
270
- </localityStack><localityStack>
270
+ </localityStack><localityStack connective="and">
271
271
  <locality type="figure">
272
272
  <referenceFrom>b</referenceFrom>
273
273
  </locality>
274
- </localityStack>ISO 712, Clause 3.1; Figure b</eref>]
274
+ </localityStack>ISO 712, Clause 3.1 and Figure b</eref>]
275
275
  </li>
276
276
  <li>
277
277
  <em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
278
- <localityStack>
278
+ <localityStack connective="and">
279
279
  <locality type="clause">
280
280
  <referenceFrom>3.1</referenceFrom>
281
281
  </locality>
282
282
  </localityStack>
283
- <localityStack>
283
+ <localityStack connective="and">
284
284
  <locality type="figure">
285
285
  <referenceFrom>b</referenceFrom>
286
286
  </locality>
@@ -362,7 +362,7 @@ RSpec.describe IsoDoc do
362
362
  <li>
363
363
  <i>word</i>
364
364
  [term defined in
365
- <a href='#ISO712'>ISO 712, Clause 3.1; Figure b</a>
365
+ <a href='#ISO712'>ISO 712, Clause 3.1 and Figure b</a>
366
366
  ]
367
367
  </li>
368
368
  <li>
@@ -710,7 +710,7 @@ RSpec.describe IsoDoc do
710
710
  <div>
711
711
  <h1 class="ForewordTitle">Foreword</h1>
712
712
  <p>
713
- <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
713
+ <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> Requirement <tt>/req/core/http</tt>
714
714
  </p>
715
715
  </div>
716
716
  <p class="zzSTDTitle1"/>
@@ -1082,8 +1082,8 @@ RSpec.describe IsoDoc do
1082
1082
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
1083
1083
  <eref type="inline" bibitemid="ISO712"/>
1084
1084
  <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
1085
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1086
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1085
+ <eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1086
+ <eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1087
1087
  <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
1088
1088
  <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
1089
1089
  <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
@@ -1121,8 +1121,8 @@ RSpec.describe IsoDoc do
1121
1121
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
1122
1122
  <eref type="inline" bibitemid="ISO712">ISO 712</eref>
1123
1123
  <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
1124
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
1125
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
1124
+ <eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
1125
+ <eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1 and Clause 1</eref>
1126
1126
  <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
1127
1127
  <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
1128
1128
  <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
@@ -1165,7 +1165,7 @@ RSpec.describe IsoDoc do
1165
1165
  <a href="#ISO712">ISO 712</a>
1166
1166
  <a href="#ISO712">ISO 712, Table 1</a>
1167
1167
  <a href='#ISO712'>ISO 712, Table 1</a>
1168
- <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
1168
+ <a href='#ISO712'>ISO 712, Table 1 and Clause 1</a>
1169
1169
  <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
1170
1170
  <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
1171
1171
  <a href="#ISO712">ISO 712, Clause 1</a>
@@ -1204,8 +1204,8 @@ RSpec.describe IsoDoc do
1204
1204
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
1205
1205
  <eref type="inline" bibitemid="ISO712"/>
1206
1206
  <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
1207
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1208
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1207
+ <eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1208
+ <eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1209
1209
  <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
1210
1210
  <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
1211
1211
  <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
@@ -1267,8 +1267,8 @@ RSpec.describe IsoDoc do
1267
1267
  <eref type='inline' bibitemid='ISO713'><locality type='table'>
1268
1268
  <referenceFrom>1</referenceFrom>
1269
1269
  </locality>ISO 713, Table 1</eref>
1270
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
1271
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1; Clause 1</eref>
1270
+ <eref type='inline' bibitemid='ISO713'><localityStack connective="and"><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
1271
+ <eref type='inline' bibitemid='ISO713'><localityStack connective="and"><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1 and Clause 1</eref>
1272
1272
  <eref type='inline' bibitemid='ISO713'><locality type='table'>
1273
1273
  <referenceFrom>1</referenceFrom>
1274
1274
  <referenceTo>1</referenceTo>
@@ -1345,7 +1345,7 @@ RSpec.describe IsoDoc do
1345
1345
  <a href='http://www.example.com'>ISO 712</a>
1346
1346
  <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
1347
1347
  <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
1348
- <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
1348
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1 and Clause 1</a>
1349
1349
  <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
1350
1350
  <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
1351
1351
  <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
@@ -1404,7 +1404,7 @@ RSpec.describe IsoDoc do
1404
1404
  <a href='http://www.example.com'>ISO 712</a>
1405
1405
  <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
1406
1406
  <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
1407
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
1407
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1 and Clause 1</a>
1408
1408
  <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
1409
1409
  <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
1410
1410
  <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
@@ -1456,6 +1456,266 @@ RSpec.describe IsoDoc do
1456
1456
  .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1457
1457
  end
1458
1458
 
1459
+ it "processes eref content pointing to hidden bibliographic entries" do
1460
+ input = <<~INPUT
1461
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1462
+ <preface><foreword>
1463
+ <p>
1464
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
1465
+ <eref type="inline" bibitemid="ISO712"/>
1466
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
1467
+ <eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1468
+ <eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
1469
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
1470
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
1471
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
1472
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
1473
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
1474
+ <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
1475
+ <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
1476
+ <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
1477
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
1478
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
1479
+ </p>
1480
+ </foreword></preface>
1481
+ <bibliography><references id="_normative_references" obligation="informative" normative="true" hidden="true"><title>Normative References</title>
1482
+ <bibitem id="ISO712" type="standard" hidden="true">
1483
+ <title format="text/plain">Cereals and cereal products</title>
1484
+ <uri type="citation">http://www.example.com</uri>
1485
+ <docidentifier>ISO 712</docidentifier>
1486
+ <contributor>
1487
+ <role type="publisher"/>
1488
+ <organization>
1489
+ <abbreviation>ISO</abbreviation>
1490
+ </organization>
1491
+ </contributor>
1492
+ </bibitem>
1493
+ <bibitem id="ISO713" type="standard" hidden="true">
1494
+ <title format="text/plain">Cereals and cereal products</title>
1495
+ <uri type='src'>https://www.iso.org/standard/3944.html</uri>
1496
+ <uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
1497
+ <docidentifier>ISO 713</docidentifier>
1498
+ <contributor>
1499
+ <role type="publisher"/>
1500
+ <organization>
1501
+ <abbreviation>ISO</abbreviation>
1502
+ </organization>
1503
+ </contributor>
1504
+ </bibitem>
1505
+ INPUT
1506
+ presxml = <<~PRESXML
1507
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1508
+ <preface>
1509
+ <foreword displayorder='1'>
1510
+ <p>
1511
+ <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
1512
+ <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
1513
+ <eref type='inline' bibitemid='ISO713'>
1514
+ <locality type='table'>
1515
+ <referenceFrom>1</referenceFrom>
1516
+ </locality>
1517
+ ISO 713, Table 1
1518
+ </eref>
1519
+ <eref type='inline' bibitemid='ISO713'>
1520
+ <localityStack connective="and">
1521
+ <locality type='table'>
1522
+ <referenceFrom>1</referenceFrom>
1523
+ </locality>
1524
+ </localityStack>
1525
+ ISO 713, Table 1
1526
+ </eref>
1527
+ <eref type='inline' bibitemid='ISO713'>
1528
+ <localityStack connective="and">
1529
+ <locality type='table'>
1530
+ <referenceFrom>1</referenceFrom>
1531
+ </locality>
1532
+ </localityStack>
1533
+ <localityStack connective="and">
1534
+ <locality type='clause'>
1535
+ <referenceFrom>1</referenceFrom>
1536
+ </locality>
1537
+ </localityStack>
1538
+ ISO 713, Table 1 and Clause 1
1539
+ </eref>
1540
+ <eref type='inline' bibitemid='ISO713'>
1541
+ <locality type='table'>
1542
+ <referenceFrom>1</referenceFrom>
1543
+ <referenceTo>1</referenceTo>
1544
+ </locality>
1545
+ ISO 713, Table 1&#x2013;1
1546
+ </eref>
1547
+ <eref type='inline' bibitemid='ISO713'>
1548
+ <locality type='clause'>
1549
+ <referenceFrom>1</referenceFrom>
1550
+ </locality>
1551
+ <locality type='table'>
1552
+ <referenceFrom>1</referenceFrom>
1553
+ </locality>
1554
+ ISO 713, Clause 1, Table 1
1555
+ </eref>
1556
+ <eref type='inline' bibitemid='ISO713'>
1557
+ <locality type='clause'>
1558
+ <referenceFrom>1</referenceFrom>
1559
+ </locality>
1560
+ ISO 713, Clause 1
1561
+ </eref>
1562
+ <eref type='inline' bibitemid='ISO713'>
1563
+ <locality type='clause'>
1564
+ <referenceFrom>1.5</referenceFrom>
1565
+ </locality>
1566
+ ISO 713, Clause 1.5
1567
+ </eref>
1568
+ <eref type='inline' bibitemid='ISO713'>
1569
+ <locality type='table'>
1570
+ <referenceFrom>1</referenceFrom>
1571
+ </locality>
1572
+ A
1573
+ </eref>
1574
+ <eref type='inline' bibitemid='ISO713'>
1575
+ <locality type='whole'/>
1576
+ ISO 713, Whole of text
1577
+ </eref>
1578
+ <eref type='inline' bibitemid='ISO713'>
1579
+ <locality type='locality:prelude'>
1580
+ <referenceFrom>7</referenceFrom>
1581
+ </locality>
1582
+ ISO 713, Prelude 7
1583
+ </eref>
1584
+ <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
1585
+ <eref type='inline' bibitemid='ISO713'>
1586
+ <locality type='anchor'>
1587
+ <referenceFrom>xyz</referenceFrom>
1588
+ </locality>
1589
+ ISO 713
1590
+ </eref>
1591
+ <eref type='inline' bibitemid='ISO713'>
1592
+ <locality type='anchor'>
1593
+ <referenceFrom>xyz</referenceFrom>
1594
+ </locality>
1595
+ <locality type='clause'>
1596
+ <referenceFrom>1</referenceFrom>
1597
+ </locality>
1598
+ ISO 713, Clause 1
1599
+ </eref>
1600
+ </p>
1601
+ </foreword>
1602
+ </preface>
1603
+ <bibliography>
1604
+ <references id='_normative_references' obligation='informative' normative='true' displayorder='2' hidden="true">
1605
+ <title depth='1'>
1606
+ 1.
1607
+ <tab/>
1608
+ Normative References
1609
+ </title>
1610
+ <bibitem id='ISO712' type='standard' hidden="true">
1611
+ <title format='text/plain'>Cereals and cereal products</title>
1612
+ <uri type='citation'>http://www.example.com</uri>
1613
+ <docidentifier>ISO 712</docidentifier>
1614
+ <contributor>
1615
+ <role type='publisher'/>
1616
+ <organization>
1617
+ <abbreviation>ISO</abbreviation>
1618
+ </organization>
1619
+ </contributor>
1620
+ </bibitem>
1621
+ <bibitem id='ISO713' type='standard' hidden="true">
1622
+ <title format='text/plain'>Cereals and cereal products</title>
1623
+ <uri type='src'>https://www.iso.org/standard/3944.html</uri>
1624
+ <uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
1625
+ <docidentifier>ISO 713</docidentifier>
1626
+ <contributor>
1627
+ <role type='publisher'/>
1628
+ <organization>
1629
+ <abbreviation>ISO</abbreviation>
1630
+ </organization>
1631
+ </contributor>
1632
+ </bibitem>
1633
+ </references>
1634
+ </bibliography>
1635
+ </iso-standard>
1636
+ PRESXML
1637
+ html = <<~OUTPUT
1638
+ #{HTML_HDR}
1639
+ <br/>
1640
+ <div>
1641
+ <h1 class='ForewordTitle'>Foreword</h1>
1642
+ <p>
1643
+ <a href='http://www.example.com'>ISO 712</a>
1644
+ <a href='http://www.example.com'>ISO 712</a>
1645
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
1646
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
1647
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 and Clause 1 </a>
1648
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1&#8211;1 </a>
1649
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1, Table 1 </a>
1650
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1 </a>
1651
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1.5 </a>
1652
+ <a href='https://www.iso.org/standard/3944.html'> A </a>
1653
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Whole of text </a>
1654
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Prelude 7 </a>
1655
+ <a href='https://www.iso.org/standard/3944.html'>A</a>
1656
+ <a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713 </a>
1657
+ <a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713, Clause 1 </a>
1658
+ </p>
1659
+ </div>
1660
+ <p class='zzSTDTitle1'/>
1661
+ </div>
1662
+ </body>
1663
+ </html>
1664
+ OUTPUT
1665
+ word = <<~OUTPUT
1666
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1667
+ <head><style/></head>
1668
+ <body lang='EN-US' link='blue' vlink='#954F72'>
1669
+ <div class='WordSection1'>
1670
+ <p>&#160;</p>
1671
+ </div>
1672
+ <p>
1673
+ <br clear='all' class='section'/>
1674
+ </p>
1675
+ <div class='WordSection2'>
1676
+ <p>
1677
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1678
+ </p>
1679
+ <div>
1680
+ <h1 class='ForewordTitle'>Foreword</h1>
1681
+ <p>
1682
+ <a href='http://www.example.com'>ISO 712</a>
1683
+ <a href='http://www.example.com'>ISO 712</a>
1684
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
1685
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
1686
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 and Clause 1 </a>
1687
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1&#8211;1 </a>
1688
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1, Table 1 </a>
1689
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1 </a>
1690
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1.5 </a>
1691
+ <a href='https://www.iso.org/standard/3944.html'> A </a>
1692
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Whole of text </a>
1693
+ <a href='https://www.iso.org/standard/3944.html'> ISO 713, Prelude 7 </a>
1694
+ <a href='https://www.iso.org/standard/3944.html'>A</a>
1695
+ <a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713 </a>
1696
+ <a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713, Clause 1 </a>
1697
+ </p>
1698
+ </div>
1699
+ <p>&#160;</p>
1700
+ </div>
1701
+ <p>
1702
+ <br clear='all' class='section'/>
1703
+ </p>
1704
+ <div class='WordSection3'>
1705
+ <p class='zzSTDTitle1'/>
1706
+ </div>
1707
+ </body>
1708
+ </html>
1709
+ OUTPUT
1710
+
1711
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1712
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1713
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1714
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1715
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1716
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1717
+ end
1718
+
1459
1719
  it "processes eref content with Unicode characters" do
1460
1720
  input = <<~INPUT
1461
1721
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -1782,4 +2042,286 @@ RSpec.describe IsoDoc do
1782
2042
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
1783
2043
  .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1784
2044
  end
2045
+
2046
+ it "processes formatting in eref/@citeas" do
2047
+ input = <<~INPUT
2048
+ <itu-standard xmlns="https://www.calconnect.org/standards/itu">
2049
+ <preface>
2050
+ <foreword id='_' obligation='informative'>
2051
+ <title>Foreword</title>
2052
+ <p id='_'>
2053
+ <eref type='inline' bibitemid='iso124' citeas='[&amp;#x3c;strong&amp;#x3e;A&amp;#x3c;/strong&amp;#x3e;.&amp;#x3c;fn reference=&amp;#x22;1&amp;#x22;&amp;#x3e;&amp;#xa; &amp;#x3c;p&amp;#x3e;hello&amp;#x3c;/p&amp;#x3e;&amp;#xa;&amp;#x3c;/fn&amp;#x3e;]'/>
2054
+ </p>
2055
+ </foreword>
2056
+ </preface>
2057
+ </itu-standard>
2058
+ INPUT
2059
+ output = <<~OUTPUT
2060
+ <itu-standard xmlns='https://www.calconnect.org/standards/itu' type='presentation'>
2061
+ <preface>
2062
+ <foreword id='_' obligation='informative' displayorder='1'>
2063
+ <title>Foreword</title>
2064
+ <p id='_'>
2065
+ <eref type='inline' bibitemid='iso124' citeas='[&amp;#x3c;strong&amp;#x3e;A&amp;#x3c;/strong&amp;#x3e;.&amp;#x3c;fn reference=&amp;#x22;1&amp;#x22;&amp;#x3e;&amp;#xa; &amp;#x3c;p&amp;#x3e;hello&amp;#x3c;/p&amp;#x3e;&amp;#xa;&amp;#x3c;/fn&amp;#x3e;]'>
2066
+ [
2067
+ <strong>A</strong>
2068
+ .
2069
+ <fn reference='1'>
2070
+ <p>hello</p>
2071
+ </fn>
2072
+ ]
2073
+ </eref>
2074
+ </p>
2075
+ </foreword>
2076
+ </preface>
2077
+ </itu-standard>
2078
+ OUTPUT
2079
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2080
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2081
+ end
2082
+
2083
+ it "combines locality stacks with connectives" do
2084
+ input = <<~INPUT
2085
+ <itu-standard xmlns="https://www.calconnect.org/standards/itu">
2086
+ <p id='_'>
2087
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2088
+ <localityStack connective='from'>
2089
+ <locality type='clause'>
2090
+ <referenceFrom>3</referenceFrom>
2091
+ </locality>
2092
+ </localityStack>
2093
+ <localityStack connective='to'>
2094
+ <locality type='clause'>
2095
+ <referenceFrom>5</referenceFrom>
2096
+ </locality>
2097
+ </localityStack>
2098
+ </eref>
2099
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2100
+ <localityStack connective='from'>
2101
+ <locality type='clause'>
2102
+ <referenceFrom>3</referenceFrom>
2103
+ </locality>
2104
+ </localityStack>
2105
+ <localityStack connective='to'>
2106
+ <locality type='clause'>
2107
+ <referenceFrom>5</referenceFrom>
2108
+ </locality>
2109
+ <locality type="table">
2110
+ <referenceFrom>2</referenceFrom>
2111
+ </locality>
2112
+ </locality>
2113
+ </localityStack>
2114
+ text
2115
+ </eref>
2116
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2117
+ <localityStack connective='and'>
2118
+ <locality type='clause'>
2119
+ <referenceFrom>3</referenceFrom>
2120
+ </locality>
2121
+ </localityStack>
2122
+ <localityStack connective='and'>
2123
+ <locality type='clause'>
2124
+ <referenceFrom>5</referenceFrom>
2125
+ </locality>
2126
+ </localityStack>
2127
+ </eref>
2128
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2129
+ <localityStack connective='and'>
2130
+ <locality type='clause'>
2131
+ <referenceFrom>3</referenceFrom>
2132
+ </locality>
2133
+ </localityStack>
2134
+ <localityStack connective='and'>
2135
+ <locality type='clause'>
2136
+ <referenceFrom>5</referenceFrom>
2137
+ </locality>
2138
+ </localityStack>
2139
+ <localityStack connective='and'>
2140
+ <locality type='clause'>
2141
+ <referenceFrom>7</referenceFrom>
2142
+ </locality>
2143
+ </localityStack>
2144
+ </eref>
2145
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2146
+ <localityStack connective='and'>
2147
+ <locality type='clause'>
2148
+ <referenceFrom>3</referenceFrom>
2149
+ </locality>
2150
+ </localityStack>
2151
+ <localityStack connective='and'>
2152
+ <locality type='annex'>
2153
+ <referenceFrom>5</referenceFrom>
2154
+ </locality>
2155
+ </localityStack>
2156
+ </eref>
2157
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2158
+ <localityStack connective='and'>
2159
+ <locality type='clause'>
2160
+ <referenceFrom>3</referenceFrom>
2161
+ </locality>
2162
+ </localityStack>
2163
+ <localityStack connective='or'>
2164
+ <locality type='clause'>
2165
+ <referenceFrom>5</referenceFrom>
2166
+ </locality>
2167
+ </localityStack>
2168
+ text
2169
+ </eref>
2170
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2171
+ <localityStack connective='from'>
2172
+ <locality type='clause'>
2173
+ <referenceFrom>3</referenceFrom>
2174
+ </locality>
2175
+ </localityStack>
2176
+ <localityStack connective='to'>
2177
+ <locality type='clause'>
2178
+ <referenceFrom>5</referenceFrom>
2179
+ </locality>
2180
+ </localityStack>
2181
+ <localityStack connective='and'>
2182
+ <locality type='clause'>
2183
+ <referenceFrom>8</referenceFrom>
2184
+ </locality>
2185
+ </localityStack>
2186
+ <localityStack connective='to'>
2187
+ <locality type='clause'>
2188
+ <referenceFrom>10</referenceFrom>
2189
+ </locality>
2190
+ </localityStack>
2191
+ </eref>
2192
+ </p>
2193
+ </clause>
2194
+ </sections>
2195
+ <bibliography>
2196
+ <references id='_' normative='false' obligation='informative'>
2197
+ <title>Bibliography</title>
2198
+ <bibitem id='ref1'>
2199
+ <formattedref format='application/x-isodoc+xml'>
2200
+ <em>Standard</em>
2201
+ </formattedref>
2202
+ <docidentifier>XYZ</docidentifier>
2203
+ </bibitem>
2204
+ </references>
2205
+ </bibliography>
2206
+ </itu-standard>
2207
+ INPUT
2208
+ output = <<~OUTPUT
2209
+ <itu-standard xmlns='https://www.calconnect.org/standards/itu' type='presentation'>
2210
+ <p id='_'>
2211
+ <eref type='inline' bibitemid='ref1' citeas='XYZ' droploc=''>
2212
+ <localityStack connective='from'>
2213
+ <locality type='clause'>
2214
+ <referenceFrom>3</referenceFrom>
2215
+ </locality>
2216
+ </localityStack>
2217
+ <localityStack connective='to'>
2218
+ <locality type='clause'>
2219
+ <referenceFrom>5</referenceFrom>
2220
+ </locality>
2221
+ </localityStack>
2222
+ XYZ, Clause 3 to 5
2223
+ </eref>
2224
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2225
+ <localityStack connective='from'>
2226
+ <locality type='clause'>
2227
+ <referenceFrom>3</referenceFrom>
2228
+ </locality>
2229
+ </localityStack>
2230
+ <localityStack connective='to'>
2231
+ <locality type='clause'>
2232
+ <referenceFrom>5</referenceFrom>
2233
+ </locality>
2234
+ <locality type='table'>
2235
+ <referenceFrom>2</referenceFrom>
2236
+ </locality>
2237
+ </localityStack>
2238
+ XYZ, Clause 3 to Clause 5, Table 2
2239
+ </eref>
2240
+ text
2241
+ </p>
2242
+ <eref type='inline' bibitemid='ref1' citeas='XYZ' droploc=''>
2243
+ <localityStack connective='and'>
2244
+ <locality type='clause'>
2245
+ <referenceFrom>3</referenceFrom>
2246
+ </locality>
2247
+ </localityStack>
2248
+ <localityStack connective='and'>
2249
+ <locality type='clause'>
2250
+ <referenceFrom>5</referenceFrom>
2251
+ </locality>
2252
+ </localityStack>
2253
+ XYZ, Clause 3 and 5
2254
+ </eref>
2255
+ <eref type='inline' bibitemid='ref1' citeas='XYZ' droploc=''>
2256
+ <localityStack connective='and'>
2257
+ <locality type='clause'>
2258
+ <referenceFrom>3</referenceFrom>
2259
+ </locality>
2260
+ </localityStack>
2261
+ <localityStack connective='and'>
2262
+ <locality type='clause'>
2263
+ <referenceFrom>5</referenceFrom>
2264
+ </locality>
2265
+ </localityStack>
2266
+ <localityStack connective='and'>
2267
+ <locality type='clause'>
2268
+ <referenceFrom>7</referenceFrom>
2269
+ </locality>
2270
+ </localityStack>
2271
+ XYZ, Clause 3, 5, and 7
2272
+ </eref>
2273
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2274
+ <localityStack connective='and'>
2275
+ <locality type='clause'>
2276
+ <referenceFrom>3</referenceFrom>
2277
+ </locality>
2278
+ </localityStack>
2279
+ <localityStack connective='and'>
2280
+ <locality type='annex'>
2281
+ <referenceFrom>5</referenceFrom>
2282
+ </locality>
2283
+ </localityStack>
2284
+ XYZ, Clause 3 and Annex 5
2285
+ </eref>
2286
+ <eref type='inline' bibitemid='ref1' citeas='XYZ'>
2287
+ <localityStack connective='and'>
2288
+ <locality type='clause'>
2289
+ <referenceFrom>3</referenceFrom>
2290
+ </locality>
2291
+ </localityStack>
2292
+ <localityStack connective='or'>
2293
+ <locality type='clause'>
2294
+ <referenceFrom>5</referenceFrom>
2295
+ </locality>
2296
+ </localityStack>
2297
+ text
2298
+ </eref>
2299
+ <eref type='inline' bibitemid='ref1' citeas='XYZ' droploc=''>
2300
+ <localityStack connective='from'>
2301
+ <locality type='clause'>
2302
+ <referenceFrom>3</referenceFrom>
2303
+ </locality>
2304
+ </localityStack>
2305
+ <localityStack connective='to'>
2306
+ <locality type='clause'>
2307
+ <referenceFrom>5</referenceFrom>
2308
+ </locality>
2309
+ </localityStack>
2310
+ <localityStack connective='and'>
2311
+ <locality type='clause'>
2312
+ <referenceFrom>8</referenceFrom>
2313
+ </locality>
2314
+ </localityStack>
2315
+ <localityStack connective='to'>
2316
+ <locality type='clause'>
2317
+ <referenceFrom>10</referenceFrom>
2318
+ </locality>
2319
+ </localityStack>
2320
+ XYZ, Clause 3 to 5 and 8 to 10
2321
+ </eref>
2322
+ </itu-standard>
2323
+ OUTPUT
2324
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2325
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2326
+ end
1785
2327
  end