isodoc 0.10.2 → 0.10.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc0387545ca3d334dd9c9aa2e6cf59c2fef6bf8bfc81bef16c36667af7c800a3
4
- data.tar.gz: 5b3a0b9229ad81cc0eb236004191e8ec9c3c909e57990befe194176b2b58d492
3
+ metadata.gz: 986c12ed2b13ccc9a053a01bd349fd2aab55c45ce0c165f8da27462b406e44a7
4
+ data.tar.gz: 70cc1c851e800931a2dc4bf146fbe988256ffe7b3810b72ff0047cfbe7f0aa8b
5
5
  SHA512:
6
- metadata.gz: 67e6e1c9f59b56faa46e10f4006d532057b52a601edb0cd0be98689ab3d398630882c8ed79850714c44b68806aad0aeb6addb95245b994545ebf53e87cc35bb8
7
- data.tar.gz: 1947a59bb969065aa5f3b6ed4b991b70c930509327de9baac70bdd3d4099dc679613e0e7fb3a4c0be493a59bdbfeaaa584c9493cde775fb0f52420d2d27ee72f
6
+ metadata.gz: ac13334d0028a116d294601f1b3354ef46138a5a0f7baa05052b23701755873547acb0de1ad7590bfea6af345e8ea11af9b7f6d916ce3e7cbaf497ceac16a026
7
+ data.tar.gz: 04a396b315e1c7c5abd31cd144d1ed9f6c9c2a73dd3004a3713f83d18c8b54e9035e15fe44e8547a8c6ff77291125799544fdd25b11f23979e9f1e49e9da1535
@@ -6,6 +6,7 @@ os:
6
6
  - linux
7
7
  - osx
8
8
  rvm:
9
+ - 2.6
9
10
  - 2.5
10
11
  - 2.4
11
12
  - ruby-head
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isodoc (0.10.2)
4
+ isodoc (0.10.3)
5
5
  asciimath
6
6
  html2doc (~> 0.8.11)
7
7
  htmlentities (~> 4.3.4)
@@ -81,7 +81,7 @@ GEM
81
81
  coderay (~> 1.1.0)
82
82
  method_source (~> 0.9.0)
83
83
  rainbow (3.0.0)
84
- rake (12.3.2)
84
+ rake (12.3.3)
85
85
  rb-fsevent (0.10.3)
86
86
  rb-inotify (0.10.0)
87
87
  ffi (~> 1.0)
@@ -7,6 +7,7 @@ cache:
7
7
 
8
8
  environment:
9
9
  matrix:
10
+ - RUBY_VERSION: 26
10
11
  - RUBY_VERSION: 25
11
12
  - RUBY_VERSION: 24
12
13
  - RUBY_VERSION: _trunk
@@ -137,6 +137,7 @@ module IsoDoc::Function
137
137
  meta = @meta.get.merge(@labels || {})
138
138
  docxml = docxml.
139
139
  gsub(/\[TERMREF\]\s*/, l10n("[#{@source_lbl}: ")).
140
+ gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@modified_lbl} [/TERMREF]")).
140
141
  gsub(/\s*\[\/TERMREF\]\s*/, l10n("]")).
141
142
  gsub(/\s*\[MODIFICATION\]/, l10n(", #{@modified_lbl} — "))
142
143
  template = liquid(docxml)
@@ -44,7 +44,9 @@ module IsoDoc::HtmlFunction
44
44
  def toHTML(result, filename)
45
45
  result = (from_xhtml(html_cleanup(to_xhtml(result))))
46
46
  result = populate_template(result, :html)
47
- result = script_cdata(from_xhtml(move_images(to_xhtml(result))))
47
+ #result = script_cdata(from_xhtml(move_images(to_xhtml(result))))
48
+ result = from_xhtml(move_images(to_xhtml(result)))
49
+ result = script_cdata(inject_script(result))
48
50
  File.open("#{filename}.html", "w:UTF-8") do |f|
49
51
  f.write(result)
50
52
  end
@@ -169,14 +171,20 @@ module IsoDoc::HtmlFunction
169
171
  html_intro(docxml) if @htmlintropage
170
172
  docxml.at("//body") << mathjax(@openmathdelim, @closemathdelim)
171
173
  docxml.at("//body") << sourcecode_highlighter
172
- if @scripts
173
- scripts = File.read(@scripts, encoding: "UTF-8")
174
- a = docxml.at("//body").add_child docxml.create_cdata(scripts)
175
- end
174
+ #if @scripts
175
+ # scripts = File.read(@scripts, encoding: "UTF-8")
176
+ # a = docxml.at("//body").add_child docxml.create_cdata(scripts)
177
+ #end
176
178
  html_main(docxml)
177
179
  docxml
178
180
  end
179
181
 
182
+ def inject_script(doc)
183
+ return doc unless @scripts
184
+ scripts = File.read(@scripts, encoding: "UTF-8")
185
+ doc.sub("</body>", scripts + "\n</body>")
186
+ end
187
+
180
188
  def html_cover(docxml)
181
189
  cover = File.read(@htmlcoverpage, encoding: "UTF-8")
182
190
  coverxml = to_xhtml_fragment(cover)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "0.10.2".freeze
2
+ VERSION = "0.10.3".freeze
3
3
  end
@@ -706,6 +706,46 @@ TOCLEVEL
706
706
  expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2\.</h2>})
707
707
  end
708
708
 
709
+ it "processes empty term modifications" do
710
+ FileUtils.rm_f "test.html"
711
+ FileUtils.rm_f "test.doc"
712
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
713
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
714
+ <sections>
715
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
716
+
717
+ <term id="paddy1"><preferred>paddy</preferred>
718
+ <domain>rice</domain>
719
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
720
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
721
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
722
+ <ul>
723
+ <li>A</li>
724
+ </ul>
725
+ </termexample>
726
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
727
+ <ul>
728
+ <li>A</li>
729
+ </ul>
730
+ </termexample>
731
+
732
+ <termsource status="modified">
733
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
734
+ <modification>
735
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
736
+ </modification>
737
+ </termsource></term>
738
+
739
+ </terms>
740
+ </sections>
741
+ </iso-standard>
742
+ INPUT
743
+ expect(File.exist?("test.html")).to be true
744
+ html = File.read("test.html")
745
+ expect(html).to include '[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified]'
746
+ end
747
+
748
+
709
749
  it "creates continuation styles for multiparagraph list items in Word" do
710
750
  FileUtils.rm_f "test.doc"
711
751
  FileUtils.rm_f "test.html"
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: 0.10.2
4
+ version: 0.10.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: 2019-07-14 00:00:00.000000000 Z
11
+ date: 2019-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath