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
@@ -262,7 +262,7 @@ RSpec.describe IsoDoc do
262
262
  :pub_phone=>"3333333",
263
263
  :pub_uri=>"http://www.example.com",
264
264
  :publisheddate=>"2011-01",
265
- :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers",
265
+ :publisher=>"International Organization for Standardization, International Electrotechnical Commission, and Institute of Electrical and Electronics Engineers",
266
266
  :receiveddate=>"XXX",
267
267
  :revdate=>"2016-05",
268
268
  :revdate_monthyear=>"May 2016",
@@ -474,7 +474,6 @@ RSpec.describe IsoDoc do
474
474
  OUTPUT
475
475
  end
476
476
 
477
- =begin
478
477
  it "populates HTML ToC" do
479
478
  FileUtils.rm_f "test.doc"
480
479
  FileUtils.rm_f "test.html"
@@ -499,7 +498,6 @@ RSpec.describe IsoDoc do
499
498
  HAJSHJAS
500
499
  OUTPUT
501
500
  end
502
- =end
503
501
 
504
502
  it "populates Word ToC" do
505
503
  FileUtils.rm_f "test.doc"
@@ -677,6 +675,472 @@ RSpec.describe IsoDoc do
677
675
  OUTPUT
678
676
  end
679
677
 
678
+ it "populates Word ToC with figures, tables, recommendations" do
679
+ FileUtils.rm_f "test.doc"
680
+ input = <<~INPUT
681
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
682
+ <sections>
683
+ <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
684
+ <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
685
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
686
+ </fn></title>
687
+ </clause>
688
+ <clause id="O" inline-header="false" obligation="normative">
689
+ <title>Clause 4.2</title>
690
+ <recommendation id="AC" type="abstracttest">
691
+ <name>Recommendation Verification 1</name>
692
+ <label>/ogc/recommendation/wfs/3</label>
693
+ </recommendation>
694
+ <recommendation id="AA">
695
+ <label>/ogc/recommendation/wfs/2</label>
696
+ </recommendation>
697
+ <recommendation id="AB" type="abstracttest">
698
+ <name>Recommendation Verification 2</name>
699
+ <label>/ogc/recommendation/wfs/3</label>
700
+ </recommendation>
701
+ <figure id="BA"><name>First figure</name></figure>
702
+ <table id="CA"><name>First table</name></table>
703
+ <p>A<fn reference="1">
704
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
705
+ </fn></p>
706
+ <clause id="P" inline-header="false" obligation="normative">
707
+ <title>Clause 4.2.1</title>
708
+ </clause>
709
+ </clause></clause>
710
+ </sections>
711
+ </iso-standard>
712
+ INPUT
713
+ IsoDoc::WordConvert.new(
714
+ { wordstylesheet: "spec/assets/word.css",
715
+ htmlstylesheet: "spec/assets/html.scss",
716
+ wordintropage: "spec/assets/wordintro.html",
717
+ doctoclevels: 3 },
718
+ ).convert("test", input, false)
719
+ word = File.read("test.doc")
720
+ .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
721
+ .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
722
+ expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")))
723
+ .to be_equivalent_to xmlpp(<<~'OUTPUT')
724
+ <div class='WordSection2'>
725
+ /* an empty word intro page */
726
+ <p class='MsoToc1'>
727
+ <span lang='EN-GB' xml:lang='EN-GB'>
728
+ <span style='mso-element:field-begin'/>
729
+ <span style='mso-spacerun:yes'>&#xA0;</span>
730
+ TOC \o "1-3" \h \z \u
731
+ <span style='mso-element:field-separator'/>
732
+ </span>
733
+ <span class='MsoHyperlink'>
734
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
735
+ <a href='#_Toc'>
736
+ Clause 4
737
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
738
+ <span style='mso-tab-count:1 dotted'>. </span>
739
+ </span>
740
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
741
+ <span style='mso-element:field-begin'/>
742
+ </span>
743
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
744
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
745
+ <span style='mso-element:field-separator'/>
746
+ </span>
747
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
748
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
749
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
750
+ <span style='mso-element:field-end'/>
751
+ </span>
752
+ </a>
753
+ </span>
754
+ </span>
755
+ </p>
756
+ <p class='MsoToc2'>
757
+ <span class='MsoHyperlink'>
758
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
759
+ <a href='#_Toc'>
760
+ Introduction to this
761
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
762
+ <span style='mso-tab-count:1 dotted'>. </span>
763
+ </span>
764
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
765
+ <span style='mso-element:field-begin'/>
766
+ </span>
767
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
768
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
769
+ <span style='mso-element:field-separator'/>
770
+ </span>
771
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
772
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
773
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
774
+ <span style='mso-element:field-end'/>
775
+ </span>
776
+ </a>
777
+ </span>
778
+ </span>
779
+ </p>
780
+ <p class='MsoToc2'>
781
+ <span class='MsoHyperlink'>
782
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
783
+ <a href='#_Toc'>
784
+ Clause 4.2
785
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
786
+ <span style='mso-tab-count:1 dotted'>. </span>
787
+ </span>
788
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
789
+ <span style='mso-element:field-begin'/>
790
+ </span>
791
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
792
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
793
+ <span style='mso-element:field-separator'/>
794
+ </span>
795
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
796
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
797
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
798
+ <span style='mso-element:field-end'/>
799
+ </span>
800
+ </a>
801
+ </span>
802
+ </span>
803
+ </p>
804
+ <p class='MsoToc3'>
805
+ <span class='MsoHyperlink'>
806
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
807
+ <a href='#_Toc'>
808
+ Clause 4.2.1
809
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
810
+ <span style='mso-tab-count:1 dotted'>. </span>
811
+ </span>
812
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
813
+ <span style='mso-element:field-begin'/>
814
+ </span>
815
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
816
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
817
+ <span style='mso-element:field-separator'/>
818
+ </span>
819
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
820
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
821
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
822
+ <span style='mso-element:field-end'/>
823
+ </span>
824
+ </a>
825
+ </span>
826
+ </span>
827
+ </p>
828
+ <p class='MsoToc1'>
829
+ <span lang='EN-GB' xml:lang='EN-GB'>
830
+ <span style='mso-element:field-end'/>
831
+ </span>
832
+ <span lang='EN-GB' xml:lang='EN-GB'>
833
+ <p class='MsoNormal'>&#xA0;</p>
834
+ </span>
835
+ </p>
836
+ <p class='MsoNormal'>&#xA0;</p>
837
+ </div>
838
+ OUTPUT
839
+
840
+ toc_input = input.sub(%r{<iso-standard xmlns="http://riboseinc.com/isoxml">},
841
+ <<~MISC,
842
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
843
+ <misc-container>
844
+ <toc type="table"><title>List of tables</title></toc>
845
+ <toc type="figure"><title>List of figures</title></toc>
846
+ <toc type="recommendation"><title>List of recommendations</title></toc>
847
+ </misc-container>
848
+ MISC
849
+ )
850
+ IsoDoc::WordConvert.new(
851
+ { wordstylesheet: "spec/assets/word.css",
852
+ htmlstylesheet: "spec/assets/html.scss",
853
+ wordintropage: "spec/assets/wordintro.html",
854
+ doctoclevels: 3 },
855
+ ).convert("test", toc_input, false)
856
+ word = File.read("test.doc")
857
+ .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
858
+ .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
859
+ expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")))
860
+ .to be_equivalent_to xmlpp(<<~'OUTPUT')
861
+ <div class='WordSection2'>
862
+ /* an empty word intro page */
863
+ <p class='MsoToc1'>
864
+ <span lang='EN-GB' xml:lang='EN-GB'>
865
+ <span style='mso-element:field-begin'/>
866
+ <span style='mso-spacerun:yes'>&#xA0;</span>
867
+ TOC \o "1-3" \h \z \u
868
+ <span style='mso-element:field-separator'/>
869
+ </span>
870
+ <span class='MsoHyperlink'>
871
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
872
+ <a href='#_Toc'>
873
+ Clause 4
874
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
875
+ <span style='mso-tab-count:1 dotted'>. </span>
876
+ </span>
877
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
878
+ <span style='mso-element:field-begin'/>
879
+ </span>
880
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
881
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
882
+ <span style='mso-element:field-separator'/>
883
+ </span>
884
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
885
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
886
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
887
+ <span style='mso-element:field-end'/>
888
+ </span>
889
+ </a>
890
+ </span>
891
+ </span>
892
+ </p>
893
+ <p class='MsoToc2'>
894
+ <span class='MsoHyperlink'>
895
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
896
+ <a href='#_Toc'>
897
+ Introduction to this
898
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
899
+ <span style='mso-tab-count:1 dotted'>. </span>
900
+ </span>
901
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
902
+ <span style='mso-element:field-begin'/>
903
+ </span>
904
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
905
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
906
+ <span style='mso-element:field-separator'/>
907
+ </span>
908
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
909
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
910
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
911
+ <span style='mso-element:field-end'/>
912
+ </span>
913
+ </a>
914
+ </span>
915
+ </span>
916
+ </p>
917
+ <p class='MsoToc2'>
918
+ <span class='MsoHyperlink'>
919
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
920
+ <a href='#_Toc'>
921
+ Clause 4.2
922
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
923
+ <span style='mso-tab-count:1 dotted'>. </span>
924
+ </span>
925
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
926
+ <span style='mso-element:field-begin'/>
927
+ </span>
928
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
929
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
930
+ <span style='mso-element:field-separator'/>
931
+ </span>
932
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
933
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
934
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
935
+ <span style='mso-element:field-end'/>
936
+ </span>
937
+ </a>
938
+ </span>
939
+ </span>
940
+ </p>
941
+ <p class='MsoToc3'>
942
+ <span class='MsoHyperlink'>
943
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
944
+ <a href='#_Toc'>
945
+ Clause 4.2.1
946
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
947
+ <span style='mso-tab-count:1 dotted'>. </span>
948
+ </span>
949
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
950
+ <span style='mso-element:field-begin'/>
951
+ </span>
952
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
953
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
954
+ <span style='mso-element:field-separator'/>
955
+ </span>
956
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
957
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
958
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
959
+ <span style='mso-element:field-end'/>
960
+ </span>
961
+ </a>
962
+ </span>
963
+ </span>
964
+ </p>
965
+ <p class='MsoToc1'>
966
+ <span lang='EN-GB' xml:lang='EN-GB'>
967
+ <span style='mso-element:field-end'/>
968
+ </span>
969
+ <span lang='EN-GB' xml:lang='EN-GB'>
970
+ <p class='MsoNormal'>&#xA0;</p>
971
+ </span>
972
+ </p>
973
+ <p class='TOCTitle'>List of tables</p>
974
+ <p class='MsoToc1'>
975
+ <span lang='EN-GB' xml:lang='EN-GB'>
976
+ <span style='mso-element:field-begin'/>
977
+ <span style='mso-spacerun:yes'>&#xA0;</span>
978
+ TOC \h \z \t "TableTitle,tabletitle"
979
+ <span style='mso-element:field-separator'/>
980
+ </span>
981
+ <span class='MsoHyperlink'>
982
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
983
+ <a href='#_Toc'>
984
+ First table
985
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
986
+ <span style='mso-tab-count:1 dotted'>. </span>
987
+ </span>
988
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
989
+ <span style='mso-element:field-begin'/>
990
+ </span>
991
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
992
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
993
+ <span style='mso-element:field-separator'/>
994
+ </span>
995
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
996
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
997
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
998
+ <span style='mso-element:field-end'/>
999
+ </span>
1000
+ </a>
1001
+ </span>
1002
+ </span>
1003
+ </p>
1004
+ <p class='MsoToc1'>
1005
+ <span lang='EN-GB' xml:lang='EN-GB'>
1006
+ <span style='mso-element:field-end'/>
1007
+ </span>
1008
+ <span lang='EN-GB' xml:lang='EN-GB'>
1009
+ <p class='MsoNormal'>&#xA0;</p>
1010
+ </span>
1011
+ </p>
1012
+ <p class='TOCTitle'>List of figures</p>
1013
+ <p class='MsoToc1'>
1014
+ <span lang='EN-GB' xml:lang='EN-GB'>
1015
+ <span style='mso-element:field-begin'/>
1016
+ <span style='mso-spacerun:yes'>&#xA0;</span>
1017
+ TOC \h \z \t "FigureTitle,figuretitle"
1018
+ <span style='mso-element:field-separator'/>
1019
+ </span>
1020
+ <span class='MsoHyperlink'>
1021
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
1022
+ <a href='#_Toc'>
1023
+ First figure
1024
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1025
+ <span style='mso-tab-count:1 dotted'>. </span>
1026
+ </span>
1027
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1028
+ <span style='mso-element:field-begin'/>
1029
+ </span>
1030
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
1031
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1032
+ <span style='mso-element:field-separator'/>
1033
+ </span>
1034
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
1035
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
1036
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1037
+ <span style='mso-element:field-end'/>
1038
+ </span>
1039
+ </a>
1040
+ </span>
1041
+ </span>
1042
+ </p>
1043
+ <p class='MsoToc1'>
1044
+ <span lang='EN-GB' xml:lang='EN-GB'>
1045
+ <span style='mso-element:field-end'/>
1046
+ </span>
1047
+ <span lang='EN-GB' xml:lang='EN-GB'>
1048
+ <p class='MsoNormal'>&#xA0;</p>
1049
+ </span>
1050
+ </p>
1051
+ <p class='TOCTitle'>List of recommendations</p>
1052
+ <p class='MsoToc1'>
1053
+ <span lang='EN-GB' xml:lang='EN-GB'>
1054
+ <span style='mso-element:field-begin'/>
1055
+ <span style='mso-spacerun:yes'>&#xA0;</span>
1056
+ TOC \h \z \t
1057
+ "RecommendationTitle,RecommendationTestTitle,recommendationtitle,recommendationtesttitle"
1058
+ <span style='mso-element:field-separator'/>
1059
+ </span>
1060
+ <span class='MsoHyperlink'>
1061
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
1062
+ <a href='#_Toc'>
1063
+ : /ogc/recommendation/wfs/2
1064
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1065
+ <span style='mso-tab-count:1 dotted'>. </span>
1066
+ </span>
1067
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1068
+ <span style='mso-element:field-begin'/>
1069
+ </span>
1070
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
1071
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1072
+ <span style='mso-element:field-separator'/>
1073
+ </span>
1074
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
1075
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
1076
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1077
+ <span style='mso-element:field-end'/>
1078
+ </span>
1079
+ </a>
1080
+ </span>
1081
+ </span>
1082
+ </p>
1083
+ <p class='MsoToc1'>
1084
+ <span class='MsoHyperlink'>
1085
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
1086
+ <a href='#_Toc'>
1087
+ Recommendation Verification 1: /ogc/recommendation/wfs/3
1088
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1089
+ <span style='mso-tab-count:1 dotted'>. </span>
1090
+ </span>
1091
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1092
+ <span style='mso-element:field-begin'/>
1093
+ </span>
1094
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
1095
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1096
+ <span style='mso-element:field-separator'/>
1097
+ </span>
1098
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
1099
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
1100
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1101
+ <span style='mso-element:field-end'/>
1102
+ </span>
1103
+ </a>
1104
+ </span>
1105
+ </span>
1106
+ </p>
1107
+ <p class='MsoToc1'>
1108
+ <span class='MsoHyperlink'>
1109
+ <span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
1110
+ <a href='#_Toc'>
1111
+ Recommendation Verification 2: /ogc/recommendation/wfs/3
1112
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1113
+ <span style='mso-tab-count:1 dotted'>. </span>
1114
+ </span>
1115
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1116
+ <span style='mso-element:field-begin'/>
1117
+ </span>
1118
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
1119
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1120
+ <span style='mso-element:field-separator'/>
1121
+ </span>
1122
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
1123
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
1124
+ <span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
1125
+ <span style='mso-element:field-end'/>
1126
+ </span>
1127
+ </a>
1128
+ </span>
1129
+ </span>
1130
+ </p>
1131
+ <p class='MsoToc1'>
1132
+ <span lang='EN-GB' xml:lang='EN-GB'>
1133
+ <span style='mso-element:field-end'/>
1134
+ </span>
1135
+ <span lang='EN-GB' xml:lang='EN-GB'>
1136
+ <p class='MsoNormal'>&#xA0;</p>
1137
+ </span>
1138
+ </p>
1139
+ <p class='MsoNormal'>&#xA0;</p>
1140
+ </div>
1141
+ OUTPUT
1142
+ end
1143
+
680
1144
  it "generates HTML output with custom ToC levels function" do
681
1145
  FileUtils.rm_f "test.doc"
682
1146
  FileUtils.rm_f "test.html"
@@ -27,6 +27,7 @@ RSpec.describe IsoDoc do
27
27
  </bibdata>
28
28
  <preface>
29
29
  <p>
30
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>...</mn></math></stem>
30
31
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>64212149677264515</mn></math></stem>
31
32
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>642121496772645.15</mn></math></stem>
32
33
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
@@ -41,6 +42,7 @@ RSpec.describe IsoDoc do
41
42
  </bibdata>
42
43
  <preface>
43
44
  <p displayorder="1">
45
+ ...
44
46
  64,212,149,677,264,515
45
47
  642,121,496,772,645.15 30,000
46
48
  <stem type='MathML'>
@@ -1156,6 +1158,143 @@ RSpec.describe IsoDoc do
1156
1158
  .to be_equivalent_to xmlpp(presxml)
1157
1159
  end
1158
1160
 
1161
+
1162
+ it "inserts toc metadata" do
1163
+ input = <<~INPUT
1164
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1165
+ <bibdata/>
1166
+ <sections>
1167
+ </sections>
1168
+ </iso-standard>
1169
+ INPUT
1170
+ presxml = <<~OUTPUT
1171
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1172
+ <bibdata/>
1173
+ <misc-container>
1174
+ <toc type='figure'>
1175
+ <title>List of figures</title>
1176
+ </toc>
1177
+ <toc type='table'>
1178
+ <title>List of tables</title>
1179
+ </toc>
1180
+ <toc type='recommendation'>
1181
+ <title>List of recommendations</title>
1182
+ </toc>
1183
+ </misc-container>
1184
+ <sections> </sections>
1185
+ </iso-standard>
1186
+ OUTPUT
1187
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1188
+ .new({ tocfigures: true,
1189
+ toctables: true,
1190
+ tocrecommendations: true })
1191
+ .convert("test", input, true))
1192
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1193
+ .to be_equivalent_to xmlpp(presxml)
1194
+ end
1195
+
1196
+ it "processes multiple-target xrefs" do
1197
+ input = <<~INPUT
1198
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1199
+ <bibdata/>
1200
+ <sections>
1201
+ <clause id="A" inline-header="false" obligation="normative">
1202
+ <title>Section</title>
1203
+ <p id="A"><xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/></xref>
1204
+ <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/>text</xref>
1205
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/></xref>
1206
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/><location target="ref3" connective="and"/></xref>
1207
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/>text</xref>
1208
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/></xref>
1209
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/><location target="ref3" connective="or"/></xref>
1210
+ <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/><location target="ref3" connective="and"/><location target="ref4" connective="to"/></xref></p>
1211
+ </clause>
1212
+ <clause id="ref1"/>
1213
+ <clause id="ref2"/>
1214
+ <clause id="ref3"/>
1215
+ <clause id="ref4"/>
1216
+ </sections>
1217
+ </iso-standard>
1218
+ INPUT
1219
+ presxml = <<~OUTPUT
1220
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1221
+ <bibdata/>
1222
+
1223
+ <sections>
1224
+ <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1225
+ <title depth='1'>
1226
+ 1.
1227
+ <tab/>
1228
+ Section
1229
+ </title>
1230
+ <p id='A'>
1231
+ <xref target='ref1'>
1232
+ <location target='ref1' connective='from'/>
1233
+ <location target='ref2' connective='to'/>
1234
+ Clause 2 to 3
1235
+ </xref>
1236
+ <xref target='ref1'>
1237
+ <location target='ref1' connective='from'/>
1238
+ <location target='ref2' connective='to'/>
1239
+ text
1240
+ </xref>
1241
+ <xref target='ref1'>
1242
+ <location target='ref1' connective='and'/>
1243
+ <location target='ref2' connective='and'/>
1244
+ Clause 2 and 3
1245
+ </xref>
1246
+ <xref target='ref1'>
1247
+ <location target='ref1' connective='and'/>
1248
+ <location target='ref2' connective='and'/>
1249
+ <location target='ref3' connective='and'/>
1250
+ Clause 2, 3, and 4
1251
+ </xref>
1252
+ <xref target='ref1'>
1253
+ <location target='ref1' connective='and'/>
1254
+ <location target='ref2' connective='and'/>
1255
+ text
1256
+ </xref>
1257
+ <xref target='ref1'>
1258
+ <location target='ref1' connective='and'/>
1259
+ <location target='ref2' connective='or'/>
1260
+ Clause 2 or 3
1261
+ </xref>
1262
+ <xref target='ref1'>
1263
+ <location target='ref1' connective='and'/>
1264
+ <location target='ref2' connective='or'/>
1265
+ <location target='ref3' connective='or'/>
1266
+ Clause 2, 3, or 4
1267
+ </xref>
1268
+ <xref target='ref1'>
1269
+ <location target='ref1' connective='from'/>
1270
+ <location target='ref2' connective='to'/>
1271
+ <location target='ref3' connective='and'/>
1272
+ <location target='ref4' connective='to'/>
1273
+ Clause 2 to 3 and 4 to 5
1274
+ </xref>
1275
+ </p>
1276
+ </clause>
1277
+ <clause id='ref1' displayorder='2'>
1278
+ <title>2.</title>
1279
+ </clause>
1280
+ <clause id='ref2' displayorder='3'>
1281
+ <title>3.</title>
1282
+ </clause>
1283
+ <clause id='ref3' displayorder='4'>
1284
+ <title>4.</title>
1285
+ </clause>
1286
+ <clause id='ref4' displayorder='5'>
1287
+ <title>5.</title>
1288
+ </clause>
1289
+ </sections>
1290
+ </iso-standard>
1291
+ OUTPUT
1292
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1293
+ .convert("test", input, true))
1294
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1295
+ .to be_equivalent_to xmlpp(presxml)
1296
+ end
1297
+
1159
1298
  private
1160
1299
 
1161
1300
  def mock_symbols