metanorma-iso 1.3.27 → 1.4.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 +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +6 -3
- data/.github/workflows/windows.yml +0 -1
- data/Gemfile +1 -0
- data/Rakefile +2 -0
- data/lib/asciidoctor/iso/base.rb +11 -14
- data/lib/isodoc/iso/base_convert.rb +23 -22
- data/lib/isodoc/iso/html/htmlstyle.css +47 -0
- data/lib/isodoc/iso/html/htmlstyle.scss +0 -1
- data/lib/isodoc/iso/html/isodoc.css +862 -0
- data/lib/isodoc/iso/html/isodoc.scss +0 -1
- data/lib/isodoc/iso/html/style-human.css +968 -0
- data/lib/isodoc/iso/html/style-iso.css +996 -0
- data/lib/isodoc/iso/html/wordstyle.css +1515 -0
- data/lib/isodoc/iso/html/wordstyle.scss +0 -1
- data/lib/isodoc/iso/iso.amendment.xsl +778 -261
- data/lib/isodoc/iso/iso.international-standard.xsl +778 -261
- data/lib/isodoc/iso/pdf_convert.rb +1 -14
- data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
- data/lib/isodoc/iso/sections.rb +2 -2
- data/lib/isodoc/iso/sts_convert.rb +8 -6
- data/lib/isodoc/iso/xref.rb +15 -9
- data/lib/metanorma-iso.rb +1 -0
- data/lib/metanorma/iso/processor.rb +11 -8
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +3 -2
- data/spec/asciidoctor-iso/cleanup_spec.rb +1 -1
- data/spec/asciidoctor-iso/table_spec.rb +1 -1
- data/spec/isodoc/ref_spec.rb +1 -1
- data/spec/metanorma/processor_spec.rb +2 -2
- metadata +32 -13
@@ -15,24 +15,11 @@ module IsoDoc
|
|
15
15
|
|
16
16
|
def pdf_stylesheet(docxml)
|
17
17
|
case doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
18
|
-
when "amendment", "technical-corrigendum" then "
|
18
|
+
when "amendment", "technical-corrigendum" then "iso.amendment.xsl"
|
19
19
|
else
|
20
20
|
"iso.international-standard.xsl"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
def convert(filename, file = nil, debug = false)
|
25
|
-
file = File.read(filename, encoding: "utf-8") if file.nil?
|
26
|
-
docxml, outname_html, dir = convert_init(file, filename, debug)
|
27
|
-
/\.xml$/.match(filename) or
|
28
|
-
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
29
|
-
f.write file
|
30
|
-
f.path
|
31
|
-
end
|
32
|
-
FileUtils.rm_rf dir
|
33
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
34
|
-
filename, outname_html + ".pdf", File.join(@libdir, pdf_stylesheet(docxml)))
|
35
|
-
end
|
36
23
|
end
|
37
24
|
end
|
38
25
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative "base_convert"
|
2
|
+
require "isodoc"
|
3
|
+
|
4
|
+
module IsoDoc
|
5
|
+
module Iso
|
6
|
+
|
7
|
+
# A {Converter} implementation that generates HTML output, and a document
|
8
|
+
# schema encapsulation of the document for validation
|
9
|
+
#
|
10
|
+
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/isodoc/iso/sections.rb
CHANGED
@@ -30,9 +30,9 @@ module IsoDoc
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def annex(isoxml, out)
|
33
|
-
|
33
|
+
amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
34
34
|
super
|
35
|
-
|
35
|
+
amd(isoxml) and @suppressheadingnumbers = true
|
36
36
|
end
|
37
37
|
|
38
38
|
def introduction(isoxml, out)
|
@@ -10,18 +10,20 @@ module IsoDoc
|
|
10
10
|
class StsConvert < IsoDoc::XslfoPdfConvert
|
11
11
|
def initialize(options)
|
12
12
|
@libdir = File.dirname(__FILE__)
|
13
|
+
@format = :sts
|
14
|
+
@suffix = "sts.xml"
|
13
15
|
end
|
14
16
|
|
15
|
-
def convert(
|
16
|
-
file = File.read(
|
17
|
-
docxml,
|
18
|
-
/\.xml$/.match(
|
19
|
-
|
17
|
+
def convert(input_filename, file = nil, debug = false, output_filename = nil)
|
18
|
+
file = File.read(input_filename, encoding: "utf-8") if file.nil?
|
19
|
+
docxml, filename, dir = convert_init(file, input_filename, debug)
|
20
|
+
/\.xml$/.match(input_filename) or
|
21
|
+
input_filename = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
20
22
|
f.write file
|
21
23
|
f.path
|
22
24
|
end
|
23
25
|
FileUtils.rm_rf dir
|
24
|
-
Mn2sts.convert(
|
26
|
+
Mn2sts.convert(input_filename, output_filename || "#{filename}.#{@suffix}")
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Iso
|
3
|
-
|
4
|
-
def
|
5
|
-
if @amd
|
3
|
+
class Xref < IsoDoc::Xref
|
4
|
+
def parse(docxml)
|
5
|
+
if @klass.amd(docxml)
|
6
6
|
back_anchor_names(docxml)
|
7
7
|
note_anchor_names(docxml.xpath(ns("//annex//table | //annex//figure")))
|
8
8
|
note_anchor_names(docxml.xpath(ns("//annex")))
|
@@ -33,7 +33,7 @@ module IsoDoc
|
|
33
33
|
|
34
34
|
def appendix_names(clause, num)
|
35
35
|
clause.xpath(ns("./appendix")).each_with_index do |c, i|
|
36
|
-
@anchors[c["id"]] = anchor_struct(i + 1, nil, @
|
36
|
+
@anchors[c["id"]] = anchor_struct(i + 1, nil, @labels["appendix"], "clause")
|
37
37
|
@anchors[c["id"]][:level] = 2
|
38
38
|
@anchors[c["id"]][:container] = clause["id"]
|
39
39
|
end
|
@@ -58,12 +58,12 @@ module IsoDoc
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def hierarchical_formula_names(clause, num)
|
61
|
-
c = IsoDoc::
|
61
|
+
c = IsoDoc::XrefGen::Counter.new
|
62
62
|
clause.xpath(ns(".//formula")).each do |t|
|
63
63
|
next if t["id"].nil? || t["id"].empty?
|
64
64
|
@anchors[t["id"]] =
|
65
65
|
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
|
66
|
-
t["inequality"] ? @
|
66
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
67
67
|
"formula", t["unnumbered"])
|
68
68
|
end
|
69
69
|
end
|
@@ -71,13 +71,13 @@ module IsoDoc
|
|
71
71
|
def figure_anchor(t, sublabel, label)
|
72
72
|
@anchors[t["id"]] = anchor_struct(
|
73
73
|
(sublabel ? "#{label} #{sublabel}" : label),
|
74
|
-
nil, @
|
74
|
+
nil, @labels["figure"], "figure", t["unnumbered"])
|
75
75
|
sublabel && t["unnumbered"] != "true" and
|
76
76
|
@anchors[t["id"]][:label] = sublabel
|
77
77
|
end
|
78
78
|
|
79
79
|
def sequential_figure_names(clause)
|
80
|
-
c = IsoDoc::
|
80
|
+
c = IsoDoc::XrefGen::Counter.new
|
81
81
|
j = 0
|
82
82
|
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
|
83
83
|
each do |t|
|
@@ -89,7 +89,7 @@ module IsoDoc
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def hierarchical_figure_names(clause, num)
|
92
|
-
c = IsoDoc::
|
92
|
+
c = IsoDoc::XrefGen::Counter.new
|
93
93
|
j = 0
|
94
94
|
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
|
95
95
|
each do |t|
|
@@ -100,6 +100,12 @@ module IsoDoc
|
|
100
100
|
figure_anchor(t, sublabel, label)
|
101
101
|
end
|
102
102
|
end
|
103
|
+
|
104
|
+
def reference_names(ref)
|
105
|
+
super
|
106
|
+
@anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
|
107
|
+
sub(/ \(All Parts\)/i, "") }
|
108
|
+
end
|
103
109
|
end
|
104
110
|
end
|
105
111
|
end
|
data/lib/metanorma-iso.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative "isodoc/iso/html_convert"
|
|
5
5
|
require_relative "isodoc/iso/word_convert"
|
6
6
|
require_relative "isodoc/iso/pdf_convert"
|
7
7
|
require_relative "isodoc/iso/sts_convert"
|
8
|
+
require_relative "isodoc/iso/presentation_xml_convert"
|
8
9
|
require "asciidoctor/extensions"
|
9
10
|
|
10
11
|
if defined? Metanorma
|
@@ -33,22 +33,25 @@ module Metanorma
|
|
33
33
|
"Metanorma::ISO #{Metanorma::ISO::VERSION}"
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
36
|
+
def use_presentation_xml(ext)
|
37
|
+
return true if ext == :html_alt
|
38
|
+
super
|
38
39
|
end
|
39
40
|
|
40
|
-
def output(isodoc_node, outname, format, options={})
|
41
|
+
def output(isodoc_node, inname, outname, format, options={})
|
41
42
|
case format
|
42
43
|
when :html
|
43
|
-
IsoDoc::Iso::HtmlConvert.new(options).convert(
|
44
|
+
IsoDoc::Iso::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
44
45
|
when :html_alt
|
45
|
-
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(
|
46
|
+
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(inname, isodoc_node, nil, outname)
|
46
47
|
when :doc
|
47
|
-
IsoDoc::Iso::WordConvert.new(options).convert(
|
48
|
+
IsoDoc::Iso::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
48
49
|
when :pdf
|
49
|
-
IsoDoc::Iso::PdfConvert.new(options).convert(
|
50
|
+
IsoDoc::Iso::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
50
51
|
when :sts
|
51
|
-
IsoDoc::Iso::StsConvert.new(options).convert(
|
52
|
+
IsoDoc::Iso::StsConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
53
|
+
when :presentation
|
54
|
+
IsoDoc::Iso::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
52
55
|
else
|
53
56
|
super
|
54
57
|
end
|
data/metanorma-iso.gemspec
CHANGED
@@ -30,17 +30,18 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
31
31
|
|
32
32
|
spec.add_dependency "ruby-jing"
|
33
|
-
spec.add_dependency "isodoc", "~> 1.
|
33
|
+
spec.add_dependency "isodoc", "~> 1.1.0"
|
34
34
|
spec.add_dependency "metanorma-standoc", "~> 1.4.0"
|
35
35
|
spec.add_dependency "tokenizer", "~> 0.3.0"
|
36
36
|
spec.add_dependency "twitter_cldr"
|
37
37
|
spec.add_dependency "mn2sts", "~> 1.2.0"
|
38
38
|
|
39
39
|
spec.add_development_dependency "byebug"
|
40
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
40
41
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
41
42
|
spec.add_development_dependency "guard", "~> 2.14"
|
42
43
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
43
|
-
spec.add_development_dependency "rake"
|
44
|
+
spec.add_development_dependency "rake" #, "~> 12.0"
|
44
45
|
spec.add_development_dependency "rspec", "~> 3.6"
|
45
46
|
spec.add_development_dependency "rubocop", "= 0.54.0"
|
46
47
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
@@ -547,7 +547,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
547
547
|
INPUT
|
548
548
|
#{BLANK_HDR}
|
549
549
|
<sections><formula id="_">
|
550
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><
|
550
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mi>or</mi><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
|
551
551
|
<dl id="_">
|
552
552
|
<dt>a</dt>
|
553
553
|
<dd>
|
@@ -150,7 +150,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
150
150
|
<tr>
|
151
151
|
<th rowspan="2" align="left">Defect</th>
|
152
152
|
<th colspan="4" align="center">Maximum permissible mass fraction of defects in husked rice<br/>
|
153
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>w</mi><
|
153
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>w</mi><mo>max</mo></msub></math></stem></th>
|
154
154
|
</tr>
|
155
155
|
<tr>
|
156
156
|
<th align="left">in husked rice</th>
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -160,7 +160,7 @@ RSpec.describe IsoDoc do
|
|
160
160
|
<p id="ISO3696" class="Biblio">[3]  ISO 3696, <i>Water for analytical laboratory use</i></p>
|
161
161
|
<p id="ref10" class="Biblio">[10]  <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
|
162
162
|
<p id="ref11" class="Biblio">[5]  IETF RFC 10, <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i></p>
|
163
|
-
<p id="ref12" class="Biblio">
|
163
|
+
<p id="ref12" class="Biblio">Citn  IETF RFC 20, CitationWorks. 2019. <i>How to cite a reference</i>.</p>
|
164
164
|
</div>
|
165
165
|
<aside id="fn:1" class="footnote">
|
166
166
|
<p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
|
@@ -15,7 +15,7 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
15
15
|
|
16
16
|
it "registers output formats against metanorma" do
|
17
17
|
expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
|
18
|
-
[[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:pdf, "pdf"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
18
|
+
[[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
19
19
|
OUTPUT
|
20
20
|
end
|
21
21
|
|
@@ -35,7 +35,7 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
35
35
|
|
36
36
|
it "generates HTML from IsoDoc XML" do
|
37
37
|
FileUtils.rm_f "test.xml"
|
38
|
-
processor.output(<<~"INPUT", "test.html", :html)
|
38
|
+
processor.output(<<~"INPUT", "test.xml", "test.html", :html)
|
39
39
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
40
40
|
<sections>
|
41
41
|
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
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.3
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-jing
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.1.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.
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metanorma-standoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: sassc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.4.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.4.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: equivalent-xml
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,16 +168,16 @@ dependencies:
|
|
154
168
|
name: rake
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - "
|
171
|
+
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
173
|
+
version: '0'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - "
|
178
|
+
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: rspec
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -295,19 +309,25 @@ files:
|
|
295
309
|
- lib/isodoc/iso/html/header.html
|
296
310
|
- lib/isodoc/iso/html/html_iso_intro.html
|
297
311
|
- lib/isodoc/iso/html/html_iso_titlepage.html
|
312
|
+
- lib/isodoc/iso/html/htmlstyle.css
|
298
313
|
- lib/isodoc/iso/html/htmlstyle.scss
|
314
|
+
- lib/isodoc/iso/html/isodoc.css
|
299
315
|
- lib/isodoc/iso/html/isodoc.scss
|
300
316
|
- lib/isodoc/iso/html/scripts.html
|
317
|
+
- lib/isodoc/iso/html/style-human.css
|
301
318
|
- lib/isodoc/iso/html/style-human.scss
|
319
|
+
- lib/isodoc/iso/html/style-iso.css
|
302
320
|
- lib/isodoc/iso/html/style-iso.scss
|
303
321
|
- lib/isodoc/iso/html/word_iso_intro.html
|
304
322
|
- lib/isodoc/iso/html/word_iso_titlepage.html
|
323
|
+
- lib/isodoc/iso/html/wordstyle.css
|
305
324
|
- lib/isodoc/iso/html/wordstyle.scss
|
306
325
|
- lib/isodoc/iso/html_convert.rb
|
307
326
|
- lib/isodoc/iso/iso.amendment.xsl
|
308
327
|
- lib/isodoc/iso/iso.international-standard.xsl
|
309
328
|
- lib/isodoc/iso/metadata.rb
|
310
329
|
- lib/isodoc/iso/pdf_convert.rb
|
330
|
+
- lib/isodoc/iso/presentation_xml_convert.rb
|
311
331
|
- lib/isodoc/iso/sections.rb
|
312
332
|
- lib/isodoc/iso/sts_convert.rb
|
313
333
|
- lib/isodoc/iso/word_convert.rb
|
@@ -375,7 +395,7 @@ homepage: https://github.com/metanorma/metanorma-iso
|
|
375
395
|
licenses:
|
376
396
|
- BSD-2-Clause
|
377
397
|
metadata: {}
|
378
|
-
post_install_message:
|
398
|
+
post_install_message:
|
379
399
|
rdoc_options: []
|
380
400
|
require_paths:
|
381
401
|
- lib
|
@@ -390,9 +410,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
410
|
- !ruby/object:Gem::Version
|
391
411
|
version: '0'
|
392
412
|
requirements: []
|
393
|
-
|
394
|
-
|
395
|
-
signing_key:
|
413
|
+
rubygems_version: 3.0.3
|
414
|
+
signing_key:
|
396
415
|
specification_version: 4
|
397
416
|
summary: metanorma-iso lets you write ISO standards in AsciiDoc.
|
398
417
|
test_files: []
|