metanorma-iso 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,9 @@
1
1
  require_relative "init"
2
2
  require "isodoc"
3
+ require_relative "index"
3
4
 
4
5
  module IsoDoc
5
6
  module Iso
6
-
7
- # A {Converter} implementation that generates HTML output, and a document
8
- # schema encapsulation of the document for validation
9
- #
10
7
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
11
8
  def initialize(options)
12
9
  super
@@ -130,6 +130,11 @@ module IsoDoc
130
130
  @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
131
131
  sub(/ \(All Parts\)/i, "") }
132
132
  end
133
+
134
+ def back_anchor_names(docxml)
135
+ super
136
+ docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
137
+ end
133
138
  end
134
139
  end
135
140
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.7.2".freeze
3
+ VERSION = "1.7.3".freeze
4
4
  end
5
5
  end
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
42
42
  spec.add_development_dependency "guard", "~> 2.14"
43
43
  spec.add_development_dependency "guard-rspec", "~> 4.7"
44
- spec.add_development_dependency "rake" #, "~> 12.0"
44
+ spec.add_development_dependency "rake" , "~> 13.0"
45
45
  spec.add_development_dependency "rspec", "~> 3.6"
46
46
  spec.add_development_dependency "rubocop", "= 0.54.0"
47
47
  spec.add_development_dependency "simplecov", "~> 0.15"
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -655,4 +655,223 @@ RSpec.describe IsoDoc do
655
655
  </html>
656
656
  OUTPUT
657
657
  end
658
+
659
+ it "generates an index in English" do
660
+ input = <<~INPUT
661
+ <iso-standard xmlns="https://open.ribose.com/standards/bipm">
662
+ <bibdata>
663
+ <language>en</language>
664
+ <script>Latn</script>
665
+ </bibdata>
666
+ <sections>
667
+ <clause id="A">
668
+ <index><primary>&#xE9;long&#xE9;</primary></index>
669
+ <index><primary>&#xEA;tre</primary><secondary>Husserl</secondary><tertiary>en allemand</tertiary></index>
670
+ <index><primary><em>Eman</em>cipation</primary></index>
671
+ <index><primary><em>Eman</em>cipation</primary><secondary>dans la France</secondary></index>
672
+ <index><primary><em>Eman</em>cipation</primary><secondary>dans la France</secondary><tertiary>en Bretagne</tertiary></index>
673
+ <clause id="B">
674
+ <index><primary><em>Eman</em>cipation</primary></index>
675
+ <index><primary>zebra</primary></index>
676
+ <index><primary><em>Eman</em>cipation</primary><secondary>dans les &#xC9;tats-Unis</secondary></index>
677
+ <index><primary><em>Eman</em>cipation</primary><secondary>dans la France</secondary><tertiary>&#xE0; Paris</tertiary></index>
678
+ <index-xref also="true"><primary>&#xEA;tre</primary><secondary>Husserl</secondary><target>zebra</target></index-xref>
679
+ <index-xref also="true"><primary>&#xEA;tre</primary><secondary>Husserl</secondary><target><em>Eman</em>cipation</target></index-xref>
680
+ <index-xref also="false"><primary>&#xEA;tre</primary><secondary>Husserl</secondary><target>zebra</target></index-xref>
681
+ <index-xref also="false"><primary><em>Dasein</em></primary><target>&#xEA;tre</target></index-xref>
682
+ <index-xref also="false"><primary><em>Dasein</em></primary><target><em>Eman</em>cipation</target></index-xref>
683
+ </clause>
684
+ </clause>
685
+ </sections>
686
+ </bipm-standard>
687
+ INPUT
688
+ presxml = <<~OUTPUT
689
+ <iso-standard xmlns='https://open.ribose.com/standards/bipm' type='presentation'>
690
+ <bibdata>
691
+ <language current='true'>en</language>
692
+ <script current='true'>Latn</script>
693
+ </bibdata>
694
+ <sections>
695
+ <clause id='A'>
696
+ <title>1</title>
697
+ <bookmark id='_'/>
698
+ <bookmark id='_'/>
699
+ <bookmark id='_'/>
700
+ <bookmark id='_'/>
701
+ <bookmark id='_'/>
702
+ <clause id='B' inline-header='true'>
703
+ <title>1.1</title>
704
+ <bookmark id='_'/>
705
+ <bookmark id='_'/>
706
+ <bookmark id='_'/>
707
+ <bookmark id='_'/>
708
+ </clause>
709
+ </clause>
710
+ </sections>
711
+ <indexsect id='_'>
712
+ <title>Index</title>
713
+ <ul>
714
+ <li>
715
+ <em>Dasein</em>
716
+ , see
717
+ <em>Eman</em>
718
+ cipation, &#xEA;tre
719
+ </li>
720
+ <li>
721
+ &#xE9;long&#xE9;,
722
+ <xref target='_' pagenumber='true'>Clause 1</xref>
723
+ </li>
724
+ <li>
725
+ <em>Eman</em>
726
+ cipation,
727
+ <xref target='_' pagenumber='true'>Clause 1</xref>
728
+ ,
729
+ <xref target='_' pagenumber='true'>1.1</xref>
730
+ <ul>
731
+ <li>
732
+ dans la France,
733
+ <xref target='_' pagenumber='true'>Clause 1</xref>
734
+ <ul>
735
+ <li>
736
+ &#xE0; Paris,
737
+ <xref target='_' pagenumber='true'>1.1</xref>
738
+ </li>
739
+ <li>
740
+ en Bretagne,
741
+ <xref target='_' pagenumber='true'>Clause 1</xref>
742
+ </li>
743
+ </ul>
744
+ </li>
745
+ <li>
746
+ dans les &#xC9;tats-Unis,
747
+ <xref target='_' pagenumber='true'>1.1</xref>
748
+ </li>
749
+ </ul>
750
+ </li>
751
+ <li>
752
+ &#xEA;tre
753
+ <ul>
754
+ <li>
755
+ Husserl, see zebra, see also
756
+ <em>Eman</em>
757
+ cipation, zebra
758
+ <ul>
759
+ <li>
760
+ en allemand,
761
+ <xref target='_' pagenumber='true'>Clause 1</xref>
762
+ </li>
763
+ </ul>
764
+ </li>
765
+ </ul>
766
+ </li>
767
+ <li>
768
+ zebra,
769
+ <xref target='_' pagenumber='true'>1.1</xref>
770
+ </li>
771
+ </ul>
772
+ </indexsect>
773
+ </iso-standard>
774
+ OUTPUT
775
+ html = <<~OUTPUT
776
+ <html lang='en'>
777
+ <head/>
778
+ <body lang='en'>
779
+ <div class='title-section'>
780
+ <p>&#160;</p>
781
+ </div>
782
+ <br/>
783
+ <div class='prefatory-section'>
784
+ <p>&#160;</p>
785
+ </div>
786
+ <br/>
787
+ <div class='main-section'>
788
+ <p class='zzSTDTitle1'/>
789
+ <div id='A'>
790
+ <h1>1</h1>
791
+ <a id='_'/>
792
+ <a id='_'/>
793
+ <a id='_'/>
794
+ <a id='_'/>
795
+ <a id='_'/>
796
+ <div id='B'>
797
+ <span class='zzMoveToFollowing'>
798
+ <b>1.1&#160; </b>
799
+ </span>
800
+ <a id='_'/>
801
+ <a id='_'/>
802
+ <a id='_'/>
803
+ <a id='_'/>
804
+ </div>
805
+ </div>
806
+ <div id='_'>
807
+ <h1>Index</h1>
808
+ <ul>
809
+ <li>
810
+ <i>Dasein</i>
811
+ , see
812
+ <i>Eman</i>
813
+ cipation, &#234;tre
814
+ </li>
815
+ <li>
816
+ &#233;long&#233;,
817
+ <a href='#_'>Clause 1</a>
818
+ </li>
819
+ <li>
820
+ <i>Eman</i>
821
+ cipation,
822
+ <a href='#_'>Clause 1</a>
823
+ ,
824
+ <a href='#_'>1.1</a>
825
+ <ul>
826
+ <li>
827
+ dans la France,
828
+ <a href='#_'>Clause 1</a>
829
+ <ul>
830
+ <li>
831
+ &#224; Paris,
832
+ <a href='#_'>1.1</a>
833
+ </li>
834
+ <li>
835
+ en Bretagne,
836
+ <a href='#_'>Clause 1</a>
837
+ </li>
838
+ </ul>
839
+ </li>
840
+ <li>
841
+ dans les &#201;tats-Unis,
842
+ <a href='#_'>1.1</a>
843
+ </li>
844
+ </ul>
845
+ </li>
846
+ <li>
847
+ &#234;tre
848
+ <ul>
849
+ <li>
850
+ Husserl, see zebra, see also
851
+ <i>Eman</i>
852
+ cipation, zebra
853
+ <ul>
854
+ <li>
855
+ en allemand,
856
+ <a href='#_'>Clause 1</a>
857
+ </li>
858
+ </ul>
859
+ </li>
860
+ </ul>
861
+ </li>
862
+ <li>
863
+ zebra,
864
+ <a href='#_'>1.1</a>
865
+ </li>
866
+ </ul>
867
+ </div>
868
+ </div>
869
+ </body>
870
+ </html>
871
+ OUTPUT
872
+ expect(xmlpp(strip_guid(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)
873
+ .gsub(%r{<localized-strings>.*</localized-strings>}m, "")))).to be_equivalent_to xmlpp(presxml)
874
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
875
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
876
+ end
658
877
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
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-02-22 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -168,16 +168,16 @@ dependencies:
168
168
  name: rake
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: '13.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: '13.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rspec
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -320,6 +320,7 @@ files:
320
320
  - lib/isodoc/iso/i18n-fr.yaml
321
321
  - lib/isodoc/iso/i18n-zh-Hans.yaml
322
322
  - lib/isodoc/iso/i18n.rb
323
+ - lib/isodoc/iso/index.rb
323
324
  - lib/isodoc/iso/init.rb
324
325
  - lib/isodoc/iso/iso.amendment.xsl
325
326
  - lib/isodoc/iso/iso.international-standard.xsl
@@ -336,16 +337,16 @@ files:
336
337
  - lib/metanorma/iso/processor.rb
337
338
  - lib/metanorma/iso/version.rb
338
339
  - metanorma-iso.gemspec
339
- - spec/asciidoctor-iso/amd_spec.rb
340
- - spec/asciidoctor-iso/base_spec.rb
341
- - spec/asciidoctor-iso/blocks_spec.rb
342
- - spec/asciidoctor-iso/cleanup_spec.rb
343
- - spec/asciidoctor-iso/inline_spec.rb
344
- - spec/asciidoctor-iso/lists_spec.rb
345
- - spec/asciidoctor-iso/refs_spec.rb
346
- - spec/asciidoctor-iso/section_spec.rb
347
- - spec/asciidoctor-iso/table_spec.rb
348
- - spec/asciidoctor-iso/validate_spec.rb
340
+ - spec/asciidoctor/amd_spec.rb
341
+ - spec/asciidoctor/base_spec.rb
342
+ - spec/asciidoctor/blocks_spec.rb
343
+ - spec/asciidoctor/cleanup_spec.rb
344
+ - spec/asciidoctor/inline_spec.rb
345
+ - spec/asciidoctor/lists_spec.rb
346
+ - spec/asciidoctor/refs_spec.rb
347
+ - spec/asciidoctor/section_spec.rb
348
+ - spec/asciidoctor/table_spec.rb
349
+ - spec/asciidoctor/validate_spec.rb
349
350
  - spec/assets/header.html
350
351
  - spec/assets/html.css
351
352
  - spec/assets/htmlcover.html