isodoc 1.8.4 → 2.0.0

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.
@@ -717,49 +717,220 @@ RSpec.describe IsoDoc do
717
717
  </annex>
718
718
  </iso-standard>
719
719
  INPUT
720
- output = <<~OUTPUT
721
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
722
- <bibdata/>
723
- <sections>
724
- <clause id='_' inline-header='false' obligation='normative' displayorder='1'>
725
- <title depth='1'>
726
- <strong>Annex A</strong>
727
- <br/>
728
- (normative).
729
- <tab/>
730
- Clause
731
- </title>
732
- <p id='_'>Text</p>
733
- <clause id='_' inline-header='false' obligation='normative'>
734
- <title depth='1'>
735
- <strong>Annex A</strong>
736
- <br/>
737
- (normative).
738
- <tab/>
739
- Subclause
740
- </title>
741
- <variant-title variant_title='true' type='sub' id='_'>&#x201C;A&#x201D; &#x2018;B&#x2019;</variant-title>
742
- <p id='_'>Text</p>
743
- </clause>
744
- </clause>
745
- </sections>
746
- <annex id='_' inline-header='false' obligation='normative' displayorder='2'>
747
- <title>
748
- <strong>Annex A</strong>
749
- <br/>
750
- (normative)
720
+ presxml = <<~OUTPUT
721
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
722
+ <bibdata/>
723
+ <sections>
724
+ <clause id='_' inline-header='false' obligation='normative' displayorder='1'>
725
+ <title depth='1'>
726
+ <strong>Annex A</strong>
727
+ <br/>
728
+ (normative).
729
+ <tab/>
730
+ Clause
731
+ </title>
732
+ <p id='_'>Text</p>
733
+ <clause id='_' inline-header='false' obligation='normative'>
734
+ <title depth='1'>
735
+ <strong>Annex A</strong>
736
+ <br/>
737
+ (normative).
738
+ <tab/>
739
+ Subclause
740
+ </title>
741
+ <variant-title variant_title='true' type='sub' id='_'>&#x201C;A&#x201D; &#x2018;B&#x2019;</variant-title>
742
+ <variant-title variant_title='true' type='toc' id='_'>
743
+ Clause
744
+ <em>A</em>
745
+ <stem type='MathML'>
746
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
747
+ <mi>x</mi>
748
+ </math>
749
+ <!-- x -->
750
+ </stem>
751
+ </variant-title>
752
+ <p id='_'>Text</p>
753
+ </clause>
754
+ </clause>
755
+ </sections>
756
+ <annex id='_' inline-header='false' obligation='normative' displayorder='2'>
757
+ <title>
758
+ <strong>Annex A</strong>
759
+ <br/>
760
+ (normative)
761
+ <br/>
762
+ <br/>
763
+ <strong>Clause</strong>
764
+ </title>
765
+ <variant-title variant_title='true' type='toc' id='_'>
766
+ Clause
767
+ <em>A</em>
768
+ <stem type='MathML'>
769
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
770
+ <mi>x</mi>
771
+ </math>
772
+ <!-- x -->
773
+ </stem>
774
+ </variant-title>
775
+ <p id='_'>Text</p>
776
+ </annex>
777
+ </iso-standard>
778
+ OUTPUT
779
+ html = <<~OUTPUT
780
+ <html lang='en'>
781
+ <head/>
782
+ <body lang='en'>
783
+ <div class='title-section'>
784
+ <p>&#160;</p>
785
+ </div>
751
786
  <br/>
787
+ <div class='prefatory-section'>
788
+ <p>&#160;</p>
789
+ </div>
752
790
  <br/>
753
- <strong>Clause</strong>
754
- </title>
755
- <p id='_'>Text</p>
756
- </annex>
757
- </iso-standard>
791
+ <div class='main-section'>
792
+ <p class='zzSTDTitle1'/>
793
+ <div id='_'>
794
+ <h1>
795
+ <b>Annex A</b>
796
+ <br/>
797
+ (normative). &#160; Clause
798
+ </h1>
799
+ <p id='_'>Text</p>
800
+ <div id='_'>
801
+ <h1>
802
+ <b>Annex A</b>
803
+ <br/>
804
+ (normative). &#160; Subclause
805
+ <br/>
806
+ <br/>
807
+ &#8220;A&#8221; &#8216;B&#8217;
808
+ </h1>
809
+ <p style='display:none;' class='variant-title-toc'>
810
+ Clause
811
+ <i>A</i>
812
+ <span class='stem'>
813
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
814
+ <mi>x</mi>
815
+ </math>
816
+ </span>
817
+ </p>
818
+ <p id='_'>Text</p>
819
+ </div>
820
+ </div>
821
+ <br/>
822
+ <div id='_' class='Section3'>
823
+ <h1 class='Annex'>
824
+ <b>Annex A</b>
825
+ <br/>
826
+ (normative)
827
+ <br/>
828
+ <br/>
829
+ <b>Clause</b>
830
+ </h1>
831
+ <p style='display:none;' class='variant-title-toc'>
832
+ Clause
833
+ <i>A</i>
834
+ <span class='stem'>
835
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
836
+ <mi>x</mi>
837
+ </math>
838
+ </span>
839
+ </p>
840
+ <p id='_'>Text</p>
841
+ </div>
842
+ </div>
843
+ </body>
844
+ </html>
845
+ OUTPUT
846
+ doc = <<~OUTPUT
847
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
848
+ <head>
849
+ <style>
850
+ </style>
851
+ </head>
852
+ <body lang='EN-US' link='blue' vlink='#954F72'>
853
+ <div class='WordSection1'>
854
+ <p>&#160;</p>
855
+ </div>
856
+ <p>
857
+ <br clear='all' class='section'/>
858
+ </p>
859
+ <div class='WordSection2'>
860
+ <p>&#160;</p>
861
+ </div>
862
+ <p>
863
+ <br clear='all' class='section'/>
864
+ </p>
865
+ <div class='WordSection3'>
866
+ <p class='zzSTDTitle1'/>
867
+ <div id='_'>
868
+ <h1>
869
+ <b>Annex A</b>
870
+ <br/>
871
+ (normative).
872
+ <span style='mso-tab-count:1'>&#160; </span>
873
+ Clause
874
+ </h1>
875
+ <p id='_'>Text</p>
876
+ <div id='_'>
877
+ <h1>
878
+ <b>Annex A</b>
879
+ <br/>
880
+ (normative).
881
+ <span style='mso-tab-count:1'>&#160; </span>
882
+ Subclause
883
+ <br/>
884
+ <br/>
885
+ &#8220;A&#8221; &#8216;B&#8217;
886
+ </h1>
887
+ <p style='display:none;' class='variant-title-toc'>
888
+ Clause
889
+ <i>A</i>
890
+ <span class='stem'>
891
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
892
+ <mi>x</mi>
893
+ </math>
894
+ </span>
895
+ </p>
896
+ <p id='_'>Text</p>
897
+ </div>
898
+ </div>
899
+ <p>
900
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
901
+ </p>
902
+ <div id='_' class='Section3'>
903
+ <h1 class='Annex'>
904
+ <b>Annex A</b>
905
+ <br/>
906
+ (normative)
907
+ <br/>
908
+ <br/>
909
+ <b>Clause</b>
910
+ </h1>
911
+ <p style='display:none;' class='variant-title-toc'>
912
+ Clause
913
+ <i>A</i>
914
+ <span class='stem'>
915
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
916
+ <mi>x</mi>
917
+ </math>
918
+ </span>
919
+ </p>
920
+ <p id='_'>Text</p>
921
+ </div>
922
+ </div>
923
+ </body>
924
+ </html>
758
925
  OUTPUT
759
926
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
760
927
  .convert("test", input, true))
761
928
  .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
762
- .to be_equivalent_to xmlpp(output)
929
+ .to be_equivalent_to xmlpp(presxml)
930
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
931
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
932
+ expect(xmlpp(IsoDoc::WordConvert.new({})
933
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
763
934
  end
764
935
 
765
936
  it "duplicates EMF and SVG files" do