isodoc 1.8.4 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
+ =begin
4
5
  it "processes prefatory blocks" do
5
6
  input = <<~INPUT
6
7
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -996,6 +997,7 @@ RSpec.describe IsoDoc do
996
997
  <br/>
997
998
  Variant 1
998
999
  </h1>
1000
+ <p style='display:none;' class='variant-title-sub'>Variant 1</p>
999
1001
  <div id='Q'>
1000
1002
  <h2>
1001
1003
  A.1.&#160; Annex A.1
@@ -1032,6 +1034,7 @@ RSpec.describe IsoDoc do
1032
1034
  <br/>
1033
1035
  <div>
1034
1036
  <h1 class='Section3'>Bibliography</h1>
1037
+ <p style='display:none;' class='variant-title-sub'>Variant 1</p>
1035
1038
  <div>
1036
1039
  <h2 class='Section3'>
1037
1040
  Bibliography Subsection
@@ -1274,6 +1277,7 @@ RSpec.describe IsoDoc do
1274
1277
  <br/>
1275
1278
  Variant 1
1276
1279
  </h1>
1280
+ <p style='display:none;' class='variant-title-sub'>Variant 1</p>
1277
1281
  <div id='Q'>
1278
1282
  <h2>
1279
1283
  A.1.
@@ -1320,6 +1324,7 @@ RSpec.describe IsoDoc do
1320
1324
  </p>
1321
1325
  <div>
1322
1326
  <h1 class='Section3'>Bibliography</h1>
1327
+ <p style='display:none;' class='variant-title-sub'>Variant 1</p>
1323
1328
  <div>
1324
1329
  <h2 class='Section3'>
1325
1330
  Bibliography Subsection
@@ -1491,149 +1496,135 @@ RSpec.describe IsoDoc do
1491
1496
  .new({ suppressheadingnumbers: true })
1492
1497
  .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1493
1498
  end
1494
-
1499
+ =end
1495
1500
  it "processes floating titles" do
1496
1501
  input = <<~INPUT
1497
1502
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1498
1503
  <preface>
1504
+ <floating-title depth="1">A0</p>
1499
1505
  <introduction id="B" obligation="informative">
1500
1506
  <title>Introduction</title>
1501
- <p type="floating-title">A</p>
1507
+ <floating-title depth="1">A</p>
1502
1508
  <clause id="B1" obligation="informative">
1503
1509
  <title>Introduction Subsection</title>
1504
- <p type="floating-title">B</p>
1510
+ <floating-title depth="2">B</p>
1505
1511
  <clause id="B2" obligation="informative">
1506
1512
  <title>Introduction Sub-subsection</title>
1507
- <p type="floating-title">C</p>
1513
+ <floating-title depth="1">C</p>
1508
1514
  </clause>
1509
1515
  </clause>
1510
1516
  </introduction>
1511
1517
  </preface>
1512
1518
  <sections>
1513
- <clause id="A" obligation="informative">
1514
- <title>Introduction</title>
1515
- <p type="floating-title">A</p>
1516
- <clause id="A1" obligation="informative">
1517
- <title>Introduction Subsection</title>
1518
- <p type="floating-title">B</p>
1519
- <clause id="A2" obligation="informative">
1520
- <title>Introduction Sub-subsection</title>
1521
- <p type="floating-title">C</p>
1522
- </clause>
1523
- </clause>
1524
- </clause>
1525
- </sections>
1526
- <annex id="C" obligation="informative">
1519
+ <clause id="C" obligation="informative">
1527
1520
  <title>Introduction</title>
1528
- <p type="floating-title">A</p>
1521
+ <floating-title depth="1">A</p>
1529
1522
  <clause id="C1" obligation="informative">
1530
1523
  <title>Introduction Subsection</title>
1531
- <p type="floating-title">B</p>
1524
+ <floating-title depth="2">B</p>
1532
1525
  <clause id="C2" obligation="informative">
1533
1526
  <title>Introduction Sub-subsection</title>
1534
- <p type="floating-title">C</p>
1527
+ <floating-title depth="1">C</p>
1535
1528
  </clause>
1536
1529
  </clause>
1537
- </annex>
1530
+ </clause>
1531
+ <floating-title depth="1">D</p>
1532
+ <clause id="C4"><title>Clause 2</title></clause>
1533
+ </sections>
1538
1534
  </iso-standard>
1539
1535
  INPUT
1540
1536
 
1541
1537
  presxml = <<~PRESXML
1542
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
1543
- <preface>
1544
- <introduction id="B" obligation="informative" displayorder="1">
1545
- <title>Introduction</title>
1546
- <p type="floating-title" depth="2">A</p>
1547
- <clause id="B1" obligation="informative">
1548
- <title depth="2">Introduction Subsection</title>
1549
- <p type="floating-title" depth="3">B</p>
1550
- <clause id="B2" obligation="informative">
1551
- <title depth="3">Introduction Sub-subsection</title>
1552
- <p type="floating-title" depth="4">C</p>
1553
- </clause>
1554
- </clause>
1555
- </introduction>
1556
- </preface>
1557
- <sections>
1558
- <clause id="A" obligation="informative" displayorder="2">
1559
- <title depth="1">1.<tab/>Introduction</title>
1560
- <p type="floating-title" depth="2">A</p>
1561
- <clause id="A1" obligation="informative">
1562
- <title depth="2">1.1.<tab/>Introduction Subsection</title>
1563
- <p type="floating-title" depth="3">B</p>
1564
- <clause id="A2" obligation="informative">
1565
- <title depth="3">1.1.1.<tab/>Introduction Sub-subsection</title>
1566
- <p type="floating-title" depth="4">C</p>
1567
- </clause>
1568
- </clause>
1569
- </clause>
1570
- </sections>
1571
- <annex id="C" obligation="informative" displayorder="3">
1572
- <title><strong>Annex A</strong><br/>(informative)<br/><br/><strong>Introduction</strong></title>
1573
- <p type="floating-title" depth="2">A</p>
1574
- <clause id="C1" obligation="informative">
1575
- <title depth="2">A.1.<tab/>Introduction Subsection</title>
1576
- <p type="floating-title" depth="3">B</p>
1577
- <clause id="C2" obligation="informative">
1578
- <title depth="3">A.1.1.<tab/>Introduction Sub-subsection</title>
1579
- <p type="floating-title" depth="4">C</p>
1580
- </clause>
1581
- </clause>
1582
- </annex>
1538
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1539
+ <preface>
1540
+ <p depth='1' type='floating-title' displayorder='1'>A0</p>
1541
+ <introduction id='B' obligation='informative' displayorder='2'>
1542
+ <title>Introduction</title>
1543
+ <p depth='1' type='floating-title'>A</p>
1544
+ <clause id='B1' obligation='informative'>
1545
+ <title depth='2'>Introduction Subsection</title>
1546
+ <p depth='2' type='floating-title'>B</p>
1547
+ <clause id='B2' obligation='informative'>
1548
+ <title depth='3'>Introduction Sub-subsection</title>
1549
+ <p depth='1' type='floating-title'>C</p>
1550
+ </clause>
1551
+ </clause>
1552
+ </introduction>
1553
+ </preface>
1554
+ <sections>
1555
+ <clause id='C' obligation='informative' displayorder='3'>
1556
+ <title depth='1'>
1557
+ 1.
1558
+ <tab/>
1559
+ Introduction
1560
+ </title>
1561
+ <p depth='1' type='floating-title'>A</p>
1562
+ <clause id='C1' obligation='informative'>
1563
+ <title depth='2'>
1564
+ 1.1.
1565
+ <tab/>
1566
+ Introduction Subsection
1567
+ </title>
1568
+ <p depth='2' type='floating-title'>B</p>
1569
+ <clause id='C2' obligation='informative'>
1570
+ <title depth='3'>
1571
+ 1.1.1.
1572
+ <tab/>
1573
+ Introduction Sub-subsection
1574
+ </title>
1575
+ <p depth='1' type='floating-title'>C</p>
1576
+ </clause>
1577
+ </clause>
1578
+ </clause>
1579
+ <p depth='1' type='floating-title'>D</p>
1580
+ <clause id='C4' displayorder='4'>
1581
+ <title depth='1'>
1582
+ 2.
1583
+ <tab/>
1584
+ Clause 2
1585
+ </title>
1586
+ </clause>
1587
+ </sections>
1583
1588
  </iso-standard>
1584
1589
  PRESXML
1585
1590
 
1586
1591
  html = <<~OUTPUT
1587
1592
  #{HTML_HDR}
1588
- <br/>
1589
- <div class='Section3' id='B'>
1590
- <h1 class='IntroTitle'>Introduction</h1>
1591
- <p class='h2'>A</p>
1592
- <div id='B1'>
1593
- <h2>Introduction Subsection</h2>
1594
- <p class='h3'>B</p>
1595
- <div id='B2'>
1596
- <h3>Introduction Sub-subsection</h3>
1597
- <p class='h4'>C</p>
1598
- </div>
1599
- </div>
1600
- </div>
1601
- <p class='zzSTDTitle1'/>
1602
- <div id='A'>
1603
- <h1>1.&#160; Introduction</h1>
1604
- <p class='h2'>A</p>
1605
- <div id='A1'>
1606
- <h2>1.1.&#160; Introduction Subsection</h2>
1607
- <p class='h3'>B</p>
1608
- <div id='A2'>
1609
- <h3>1.1.1.&#160; Introduction Sub-subsection</h3>
1610
- <p class='h4'>C</p>
1611
- </div>
1612
- </div>
1613
- </div>
1614
- <br/>
1615
- <div id='C' class='Section3'>
1616
- <h1 class='Annex'>
1617
- <b>Annex A</b>
1618
- <br/>
1619
- (informative)
1620
- <br/>
1621
- <br/>
1622
- <b>Introduction</b>
1623
- </h1>
1624
- <p class='h2'>A</p>
1625
- <div id='C1'>
1626
- <h2>A.1.&#160; Introduction Subsection</h2>
1627
- <p class='h3'>B</p>
1628
- <div id='C2'>
1629
- <h3>A.1.1.&#160; Introduction Sub-subsection</h3>
1630
- <p class='h4'>C</p>
1631
- </div>
1632
- </div>
1633
- </div>
1593
+ <p class='h1'>A0</p>
1594
+ <br/>
1595
+ <div class='Section3' id='B'>
1596
+ <p class='h1'>A0</p>
1597
+ <h1 class='IntroTitle'>Introduction</h1>
1598
+ <p class='h1'>A</p>
1599
+ <div id='B1'>
1600
+ <h2>Introduction Subsection</h2>
1601
+ <p class='h2'>B</p>
1602
+ <div id='B2'>
1603
+ <h3>Introduction Sub-subsection</h3>
1604
+ <p class='h1'>C</p>
1605
+ </div>
1606
+ </div>
1607
+ </div>
1608
+ <p class='zzSTDTitle1'/>
1609
+ <div id='C'>
1610
+ <h1> 1. &#160; Introduction </h1>
1611
+ <p class='h1'>A</p>
1612
+ <div id='C1'>
1613
+ <h2> 1.1. &#160; Introduction Subsection </h2>
1614
+ <p class='h2'>B</p>
1615
+ <div id='C2'>
1616
+ <h3> 1.1.1. &#160; Introduction Sub-subsection </h3>
1617
+ <p class='h1'>C</p>
1634
1618
  </div>
1635
- </body>
1636
- </html>
1619
+ </div>
1620
+ </div>
1621
+ <div id='C4'>
1622
+ <p class='h1'>D</p>
1623
+ <h1> 2. &#160; Clause 2 </h1>
1624
+ </div>
1625
+ </div>
1626
+ </body>
1627
+ </html>
1637
1628
  OUTPUT
1638
1629
 
1639
1630
  word = <<~OUTPUT
@@ -1641,93 +1632,73 @@ RSpec.describe IsoDoc do
1641
1632
  <head>
1642
1633
  <style></style>
1643
1634
  </head>
1644
- <body lang='EN-US' link='blue' vlink='#954F72'>
1645
- <div class='WordSection1'>
1646
- <p>&#160;</p>
1647
- </div>
1648
- <p>
1649
- <br clear='all' class='section'/>
1650
- </p>
1651
- <div class='WordSection2'>
1652
- <p>
1653
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1654
- </p>
1655
- <div class='Section3' id='B'>
1656
- <h1 class='IntroTitle'>Introduction</h1>
1657
- <p>A</p>
1658
- <div id='B1'>
1659
- <h2>Introduction Subsection</h2>
1660
- <p>B</p>
1661
- <div id='B2'>
1662
- <h3>Introduction Sub-subsection</h3>
1663
- <p>C</p>
1664
- </div>
1665
- </div>
1666
- </div>
1667
- <p>&#160;</p>
1668
- </div>
1669
- <p>
1670
- <br clear='all' class='section'/>
1671
- </p>
1672
- <div class='WordSection3'>
1673
- <p class='zzSTDTitle1'/>
1674
- <div id='A'>
1675
- <h1>
1676
- 1.
1677
- <span style='mso-tab-count:1'>&#160; </span>
1678
- Introduction
1679
- </h1>
1680
- <p>A</p>
1681
- <div id='A1'>
1682
- <h2>
1683
- 1.1.
1684
- <span style='mso-tab-count:1'>&#160; </span>
1685
- Introduction Subsection
1686
- </h2>
1687
- <p>B</p>
1688
- <div id='A2'>
1689
- <h3>
1690
- 1.1.1.
1691
- <span style='mso-tab-count:1'>&#160; </span>
1692
- Introduction Sub-subsection
1693
- </h3>
1694
- <p>C</p>
1695
- </div>
1696
- </div>
1697
- </div>
1698
- <p>
1699
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1700
- </p>
1701
- <div id='C' class='Section3'>
1702
- <h1 class='Annex'>
1703
- <b>Annex A</b>
1704
- <br/>
1705
- (informative)
1706
- <br/>
1707
- <br/>
1708
- <b>Introduction</b>
1709
- </h1>
1710
- <p>A</p>
1711
- <div id='C1'>
1712
- <h2>
1713
- A.1.
1714
- <span style='mso-tab-count:1'>&#160; </span>
1715
- Introduction Subsection
1716
- </h2>
1717
- <p>B</p>
1718
- <div id='C2'>
1719
- <h3>
1720
- A.1.1.
1721
- <span style='mso-tab-count:1'>&#160; </span>
1722
- Introduction Sub-subsection
1723
- </h3>
1724
- <p>C</p>
1725
- </div>
1726
- </div>
1635
+ <body lang='EN-US' link='blue' vlink='#954F72'>
1636
+ <div class='WordSection1'>
1637
+ <p>&#160;</p>
1638
+ </div>
1639
+ <p>
1640
+ <br clear='all' class='section'/>
1641
+ </p>
1642
+ <div class='WordSection2'>
1643
+ <p>A0</p>
1644
+ <p>
1645
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1646
+ </p>
1647
+ <div class='Section3' id='B'>
1648
+ <p>A0</p>
1649
+ <h1 class='IntroTitle'>Introduction</h1>
1650
+ <p>A</p>
1651
+ <div id='B1'>
1652
+ <h2>Introduction Subsection</h2>
1653
+ <p>B</p>
1654
+ <div id='B2'>
1655
+ <h3>Introduction Sub-subsection</h3>
1656
+ <p>C</p>
1727
1657
  </div>
1728
1658
  </div>
1729
- </body>
1730
- </html>
1659
+ </div>
1660
+ <p>&#160;</p>
1661
+ </div>
1662
+ <p>
1663
+ <br clear='all' class='section'/>
1664
+ </p>
1665
+ <div class='WordSection3'>
1666
+ <p class='zzSTDTitle1'/>
1667
+ <div id='C'>
1668
+ <h1>
1669
+ 1.
1670
+ <span style='mso-tab-count:1'>&#160; </span>
1671
+ Introduction
1672
+ </h1>
1673
+ <p>A</p>
1674
+ <div id='C1'>
1675
+ <h2>
1676
+ 1.1.
1677
+ <span style='mso-tab-count:1'>&#160; </span>
1678
+ Introduction Subsection
1679
+ </h2>
1680
+ <p>B</p>
1681
+ <div id='C2'>
1682
+ <h3>
1683
+ 1.1.1.
1684
+ <span style='mso-tab-count:1'>&#160; </span>
1685
+ Introduction Sub-subsection
1686
+ </h3>
1687
+ <p>C</p>
1688
+ </div>
1689
+ </div>
1690
+ </div>
1691
+ <div id='C4'>
1692
+ <p>D</p>
1693
+ <h1>
1694
+ 2.
1695
+ <span style='mso-tab-count:1'>&#160; </span>
1696
+ Clause 2
1697
+ </h1>
1698
+ </div>
1699
+ </div>
1700
+ </body>
1701
+ </html>
1731
1702
  OUTPUT
1732
1703
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1733
1704
  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-27 00:00:00.000000000 Z
11
+ date: 2022-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: htmlentities
43
43
  requirement: !ruby/object:Gem::Requirement