metanorma-iso 1.3.24 → 1.4.1
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 +8 -1
- data/.github/workflows/ubuntu.yml +14 -3
- data/.github/workflows/windows.yml +8 -1
- data/lib/asciidoctor/iso/base.rb +21 -13
- data/lib/asciidoctor/iso/biblio.rng +36 -6
- data/lib/asciidoctor/iso/cleanup.rb +10 -1
- data/lib/asciidoctor/iso/front.rb +16 -110
- data/lib/asciidoctor/iso/front_id.rb +196 -0
- data/lib/asciidoctor/iso/isodoc.rng +444 -1
- data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
- data/lib/asciidoctor/iso/isostandard.rng +12 -1
- data/lib/asciidoctor/iso/reqt.rng +23 -0
- data/lib/asciidoctor/iso/section.rb +12 -0
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +7 -10
- data/lib/asciidoctor/iso/validate.rb +40 -23
- data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
- data/lib/asciidoctor/iso/validate_style.rb +6 -5
- data/lib/asciidoctor/iso/validate_title.rb +1 -1
- data/lib/isodoc/iso/base_convert.rb +68 -87
- data/lib/isodoc/iso/html/header.html +5 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +25 -16
- data/lib/isodoc/iso/html/isodoc.scss +25 -0
- data/lib/isodoc/iso/html/scripts.html +18 -0
- data/lib/isodoc/iso/html/style-human.scss +23 -0
- data/lib/isodoc/iso/html/style-iso.scss +18 -0
- data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
- data/lib/isodoc/iso/html/wordstyle.scss +45 -4
- data/lib/isodoc/iso/iso.amendment.xsl +5082 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +1226 -530
- data/lib/isodoc/iso/metadata.rb +67 -23
- data/lib/isodoc/iso/pdf_convert.rb +5 -11
- data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
- data/lib/isodoc/iso/sections.rb +66 -0
- data/lib/isodoc/iso/sts_convert.rb +31 -0
- data/lib/isodoc/iso/xref.rb +111 -0
- data/lib/metanorma-iso.rb +2 -0
- data/lib/metanorma/iso/processor.rb +20 -9
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +5 -2
- data/spec/asciidoctor-iso/amd_spec.rb +726 -0
- data/spec/asciidoctor-iso/base_spec.rb +24 -20
- data/spec/asciidoctor-iso/cleanup_spec.rb +2 -2
- data/spec/asciidoctor-iso/macros_spec.rb +33 -17
- data/spec/asciidoctor-iso/refs_spec.rb +1 -1
- data/spec/asciidoctor-iso/table_spec.rb +1 -1
- data/spec/isodoc/amd_spec.rb +652 -0
- data/spec/isodoc/blocks_spec.rb +112 -27
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/metadata_spec.rb +88 -4
- data/spec/isodoc/postproc_spec.rb +11 -11
- data/spec/isodoc/ref_spec.rb +7 -7
- data/spec/isodoc/section_spec.rb +28 -1
- data/spec/isodoc/table_spec.rb +29 -29
- data/spec/isodoc/terms_spec.rb +4 -4
- data/spec/isodoc/xref_spec.rb +32 -26
- data/spec/metanorma/processor_spec.rb +2 -2
- data/spec/spec_helper.rb +11 -0
- metadata +61 -11
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -6,19 +6,25 @@ module IsoDoc
|
|
6
6
|
def initialize(lang, script, labels)
|
7
7
|
super
|
8
8
|
@metadata = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
tc: "XXXX",
|
10
|
+
sc: "XXXX",
|
11
|
+
wg: "XXXX",
|
12
|
+
editorialgroup: [],
|
13
|
+
secretariat: "XXXX",
|
14
|
+
obsoletes: nil,
|
15
|
+
obsoletes_part: nil
|
16
|
+
}
|
17
17
|
end
|
18
18
|
|
19
|
-
def status_abbrev(stage, substage, iter, draft)
|
19
|
+
def status_abbrev(stage, substage, iter, draft, doctype)
|
20
20
|
return "" unless stage
|
21
|
-
|
21
|
+
if %w(technical-report technical-specification).include?(doctype)
|
22
|
+
stage = "DTS" if stage == "DIS"
|
23
|
+
stage = "FDTS" if stage == "FDIS"
|
24
|
+
end
|
25
|
+
if %w(PWI NWIP WD CD).include?(stage)
|
26
|
+
stage += iter if iter
|
27
|
+
end
|
22
28
|
stage = "Pre" + stage if draft =~ /^0\./
|
23
29
|
stage
|
24
30
|
end
|
@@ -33,7 +39,8 @@ module IsoDoc
|
|
33
39
|
set(:statusabbr, status_abbrev(docstatus["abbreviation"] || "??",
|
34
40
|
isoxml&.at(ns("//bibdata/status/substage"))&.text,
|
35
41
|
isoxml&.at(ns("//bibdata/status/iteration"))&.text,
|
36
|
-
isoxml&.at(ns("//version/draft"))&.text
|
42
|
+
isoxml&.at(ns("//version/draft"))&.text,
|
43
|
+
isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
|
37
44
|
unpublished(docstatus.text) and
|
38
45
|
set(:stageabbr, docstatus["abbreviation"])
|
39
46
|
end
|
@@ -46,7 +53,7 @@ module IsoDoc
|
|
46
53
|
end
|
47
54
|
|
48
55
|
def docid(isoxml, _out)
|
49
|
-
dn = isoxml.at(ns("//bibdata/docidentifier[@type = '
|
56
|
+
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ISO']"))
|
50
57
|
set(:docnumber, dn&.text)
|
51
58
|
tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
|
52
59
|
set(:tc_docnumber, tcdn.map { |n| n.text })
|
@@ -65,6 +72,20 @@ module IsoDoc
|
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
75
|
+
def amd_label(lang)
|
76
|
+
case lang
|
77
|
+
when "en" then "AMENDMENT"
|
78
|
+
when "fr" then "AMENDMENT"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def corr_label(lang)
|
83
|
+
case lang
|
84
|
+
when "en" then "TECHNICAL CORRIGENDUM"
|
85
|
+
when "fr" then "RECTIFICATIF TECHNIQUE"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
68
89
|
def part_title(part, partnum, subpartnum, lang)
|
69
90
|
return "" unless part
|
70
91
|
suffix = @c.encode(part.text, :hexadecimal)
|
@@ -78,6 +99,14 @@ module IsoDoc
|
|
78
99
|
"#{part_label(lang)} #{partnum}"
|
79
100
|
end
|
80
101
|
|
102
|
+
def amd_prefix(num, lang)
|
103
|
+
"#{amd_label(lang)} #{num}"
|
104
|
+
end
|
105
|
+
|
106
|
+
def corr_prefix(num, lang)
|
107
|
+
"#{corr_label(lang)} #{num}"
|
108
|
+
end
|
109
|
+
|
81
110
|
def compose_title(main, intro, part, partnum, subpartnum, lang)
|
82
111
|
main = main.nil? ? "" : @c.encode(main.text, :hexadecimal)
|
83
112
|
intro &&
|
@@ -89,12 +118,23 @@ module IsoDoc
|
|
89
118
|
main
|
90
119
|
end
|
91
120
|
|
121
|
+
def title_nums(isoxml)
|
122
|
+
[isoxml.at(ns("//bibdata//project-number/@part")),
|
123
|
+
isoxml.at(ns("//bibdata//project-number/@subpart")),
|
124
|
+
isoxml.at(ns("//bibdata//project-number/@amendment")),
|
125
|
+
isoxml.at(ns("//bibdata//project-number/@corrigendum"))]
|
126
|
+
end
|
127
|
+
|
128
|
+
def title_parts(isoxml, lang)
|
129
|
+
[isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='#{lang}']")),
|
130
|
+
isoxml.at(ns("//bibdata//title[@type='title-main' and @language='#{lang}']")),
|
131
|
+
isoxml.at(ns("//bibdata//title[@type='title-part' and @language='#{lang}']")),
|
132
|
+
isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='#{lang}']"))]
|
133
|
+
end
|
134
|
+
|
92
135
|
def title(isoxml, _out)
|
93
|
-
intro = isoxml
|
94
|
-
|
95
|
-
part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='en']"))
|
96
|
-
partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
|
97
|
-
subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
|
136
|
+
intro, main, part, amd = title_parts(isoxml, "en")
|
137
|
+
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
98
138
|
|
99
139
|
set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
100
140
|
main = compose_title(main, intro, part, partnumber, subpartnumber, "en")
|
@@ -102,20 +142,24 @@ module IsoDoc
|
|
102
142
|
set(:doctitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
|
103
143
|
set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, "en"))
|
104
144
|
set(:doctitlepart, @c.encode(part.text, :hexadecimal)) if part
|
145
|
+
set(:doctitleamdlabel, amd_prefix(amdnumber, "en")) if amdnumber
|
146
|
+
set(:doctitleamd, @c.encode(amd.text, :hexadecimal)) if amd
|
147
|
+
set(:doctitlecorrlabel, corr_prefix(corrnumber, "en")) if corrnumber
|
105
148
|
end
|
106
149
|
|
107
150
|
def subtitle(isoxml, _out)
|
108
|
-
intro = isoxml
|
109
|
-
|
110
|
-
|
111
|
-
partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
|
112
|
-
subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
|
151
|
+
intro, main, part, amd = title_parts(isoxml, "fr")
|
152
|
+
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
153
|
+
|
113
154
|
set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
114
155
|
main = compose_title(main, intro, part, partnumber, subpartnumber, "fr")
|
115
156
|
set(:docsubtitle, main)
|
116
157
|
set(:docsubtitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
|
117
158
|
set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, "fr"))
|
118
159
|
set(:docsubtitlepart, @c.encode(part.text, :hexadecimal)) if part
|
160
|
+
set(:docsubtitleamdlabel, amd_prefix(amdnumber, "fr")) if amdnumber
|
161
|
+
set(:docsubtitleamd, @c.encode(amd.text, :hexadecimal)) if amd
|
162
|
+
set(:docsubtitlecorrlabel, corr_prefix(corrnumber, "fr")) if corrnumber
|
119
163
|
end
|
120
164
|
|
121
165
|
def author(xml, _out)
|
@@ -166,7 +210,7 @@ module IsoDoc
|
|
166
210
|
super
|
167
211
|
ics = []
|
168
212
|
isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
|
169
|
-
set(:ics, ics.empty? ?
|
213
|
+
set(:ics, ics.empty? ? nil : ics.join(", "))
|
170
214
|
end
|
171
215
|
end
|
172
216
|
end
|
@@ -13,18 +13,12 @@ module IsoDoc
|
|
13
13
|
super
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
f.write file
|
22
|
-
f.path
|
16
|
+
def pdf_stylesheet(docxml)
|
17
|
+
case doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
18
|
+
when "amendment", "technical-corrigendum" then "iso.amendment.xsl"
|
19
|
+
else
|
20
|
+
"iso.international-standard.xsl"
|
23
21
|
end
|
24
|
-
FileUtils.rm_rf dir
|
25
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
26
|
-
filename, outname_html + ".pdf",
|
27
|
-
File.join(@libdir, "iso.international-standard.xsl"))
|
28
22
|
end
|
29
23
|
end
|
30
24
|
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
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
module BaseConvert
|
4
|
+
def middle_title(out)
|
5
|
+
middle_title_main(out)
|
6
|
+
middle_title_amd(out)
|
7
|
+
end
|
8
|
+
|
9
|
+
def middle_title_main(out)
|
10
|
+
out.p(**{ class: "zzSTDTitle1" }) do |p|
|
11
|
+
p << @meta.get[:doctitleintro]
|
12
|
+
p << " — " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
|
13
|
+
p << @meta.get[:doctitlemain]
|
14
|
+
p << " — " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
|
15
|
+
end
|
16
|
+
a = @meta.get[:doctitlepart] and out.p(**{ class: "zzSTDTitle2" }) do |p|
|
17
|
+
b = @meta.get[:doctitlepartlabel] and p << "#{b}: "
|
18
|
+
p << "<br/><b>#{a}</b>"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def middle_title_amd(out)
|
23
|
+
a = @meta.get[:doctitleamdlabel] and out.p(**{ class: "zzSTDTitle2" }) do |p|
|
24
|
+
p << a
|
25
|
+
a = @meta.get[:doctitleamd] and p << ": #{a}"
|
26
|
+
end
|
27
|
+
a = @meta.get[:doctitlecorrlabel] and out.p(**{ class: "zzSTDTitle2" }) do |p|
|
28
|
+
p << a
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def annex(isoxml, out)
|
33
|
+
amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
34
|
+
super
|
35
|
+
amd(isoxml) and @suppressheadingnumbers = true
|
36
|
+
end
|
37
|
+
|
38
|
+
def introduction(isoxml, out)
|
39
|
+
f = isoxml.at(ns("//introduction")) || return
|
40
|
+
num = f.at(ns(".//clause")) ? "0" : nil
|
41
|
+
title_attr = { class: "IntroTitle" }
|
42
|
+
page_break(out)
|
43
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
44
|
+
clause_name(num, @introduction_lbl, div, title_attr)
|
45
|
+
f.elements.each do |e|
|
46
|
+
parse(e, div) unless e.name == "title"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def foreword(isoxml, out)
|
52
|
+
f = isoxml.at(ns("//foreword")) || return
|
53
|
+
page_break(out)
|
54
|
+
out.div **attr_code(id: f["id"]) do |s|
|
55
|
+
s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl }
|
56
|
+
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def clause_parse_title(node, div, c1, out)
|
61
|
+
return inline_header_title(out, node, c1) if c1.nil?
|
62
|
+
super
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require "mn2sts"
|
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 StsConvert < IsoDoc::XslfoPdfConvert
|
11
|
+
def initialize(options)
|
12
|
+
@libdir = File.dirname(__FILE__)
|
13
|
+
@format = :sts
|
14
|
+
@suffix = "sts.xml"
|
15
|
+
end
|
16
|
+
|
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|
|
22
|
+
f.write file
|
23
|
+
f.path
|
24
|
+
end
|
25
|
+
FileUtils.rm_rf dir
|
26
|
+
Mn2sts.convert(input_filename, output_filename || "#{filename}.#{@suffix}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
class Xref < IsoDoc::Xref
|
4
|
+
def parse(docxml)
|
5
|
+
if @klass.amd(docxml)
|
6
|
+
back_anchor_names(docxml)
|
7
|
+
note_anchor_names(docxml.xpath(ns("//annex//table | //annex//figure")))
|
8
|
+
note_anchor_names(docxml.xpath(ns("//annex")))
|
9
|
+
example_anchor_names(docxml.xpath(ns("//annex")))
|
10
|
+
list_anchor_names(docxml.xpath(ns("//annex")))
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initial_anchor_names(d)
|
17
|
+
super
|
18
|
+
introduction_names(d.at(ns("//introduction")))
|
19
|
+
end
|
20
|
+
|
21
|
+
# we can reference 0-number clauses in introduction
|
22
|
+
def introduction_names(clause)
|
23
|
+
return if clause.nil?
|
24
|
+
clause.xpath(ns("./clause")).each_with_index do |c, i|
|
25
|
+
section_names1(c, "0.#{i + 1}", 2)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def annex_names(clause, num)
|
30
|
+
appendix_names(clause, num)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def appendix_names(clause, num)
|
35
|
+
clause.xpath(ns("./appendix")).each_with_index do |c, i|
|
36
|
+
@anchors[c["id"]] = anchor_struct(i + 1, nil, @labels["appendix"], "clause")
|
37
|
+
@anchors[c["id"]][:level] = 2
|
38
|
+
@anchors[c["id"]][:container] = clause["id"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def section_names1(clause, num, level)
|
43
|
+
@anchors[clause["id"]] =
|
44
|
+
{ label: num, level: level, xref: num }
|
45
|
+
# subclauses are not prefixed with "Clause"
|
46
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
47
|
+
"./references")).
|
48
|
+
each_with_index do |c, i|
|
49
|
+
section_names1(c, "#{num}.#{i + 1}", level + 1)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def annex_names1(clause, num, level)
|
54
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level }
|
55
|
+
clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
|
56
|
+
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def hierarchical_formula_names(clause, num)
|
61
|
+
c = IsoDoc::XrefGen::Counter.new
|
62
|
+
clause.xpath(ns(".//formula")).each do |t|
|
63
|
+
next if t["id"].nil? || t["id"].empty?
|
64
|
+
@anchors[t["id"]] =
|
65
|
+
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
|
66
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
67
|
+
"formula", t["unnumbered"])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def figure_anchor(t, sublabel, label)
|
72
|
+
@anchors[t["id"]] = anchor_struct(
|
73
|
+
(sublabel ? "#{label} #{sublabel}" : label),
|
74
|
+
nil, @labels["figure"], "figure", t["unnumbered"])
|
75
|
+
sublabel && t["unnumbered"] != "true" and
|
76
|
+
@anchors[t["id"]][:label] = sublabel
|
77
|
+
end
|
78
|
+
|
79
|
+
def sequential_figure_names(clause)
|
80
|
+
c = IsoDoc::XrefGen::Counter.new
|
81
|
+
j = 0
|
82
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
|
83
|
+
each do |t|
|
84
|
+
j = subfigure_increment(j, c, t)
|
85
|
+
sublabel = j.zero? ? nil : "#{(j+96).chr})"
|
86
|
+
next if t["id"].nil? || t["id"].empty?
|
87
|
+
figure_anchor(t, sublabel, c.print)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def hierarchical_figure_names(clause, num)
|
92
|
+
c = IsoDoc::XrefGen::Counter.new
|
93
|
+
j = 0
|
94
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
|
95
|
+
each do |t|
|
96
|
+
j = subfigure_increment(j, c, t)
|
97
|
+
label = "#{num}#{hiersep}#{c.print}"
|
98
|
+
sublabel = j.zero? ? nil : "#{(j+96).chr})"
|
99
|
+
next if t["id"].nil? || t["id"].empty?
|
100
|
+
figure_anchor(t, sublabel, label)
|
101
|
+
end
|
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
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/metanorma-iso.rb
CHANGED
@@ -4,6 +4,8 @@ require_relative "metanorma/iso/version"
|
|
4
4
|
require_relative "isodoc/iso/html_convert"
|
5
5
|
require_relative "isodoc/iso/word_convert"
|
6
6
|
require_relative "isodoc/iso/pdf_convert"
|
7
|
+
require_relative "isodoc/iso/sts_convert"
|
8
|
+
require_relative "isodoc/iso/presentation_xml_convert"
|
7
9
|
require "asciidoctor/extensions"
|
8
10
|
|
9
11
|
if defined? Metanorma
|
@@ -3,7 +3,12 @@ require "metanorma/processor"
|
|
3
3
|
module Metanorma
|
4
4
|
module Iso
|
5
5
|
def self.fonts_used
|
6
|
-
|
6
|
+
{
|
7
|
+
html: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
8
|
+
html_alt: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
9
|
+
doc: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
10
|
+
pdf: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
11
|
+
}
|
7
12
|
end
|
8
13
|
|
9
14
|
class Processor < Metanorma::Processor
|
@@ -19,7 +24,8 @@ module Metanorma
|
|
19
24
|
html: "html",
|
20
25
|
html_alt: "alt.html",
|
21
26
|
doc: "doc",
|
22
|
-
pdf: "pdf"
|
27
|
+
pdf: "pdf",
|
28
|
+
sts: "sts.xml"
|
23
29
|
)
|
24
30
|
end
|
25
31
|
|
@@ -27,20 +33,25 @@ module Metanorma
|
|
27
33
|
"Metanorma::ISO #{Metanorma::ISO::VERSION}"
|
28
34
|
end
|
29
35
|
|
30
|
-
def
|
31
|
-
|
36
|
+
def use_presentation_xml(ext)
|
37
|
+
return true if ext == :html_alt
|
38
|
+
super
|
32
39
|
end
|
33
40
|
|
34
|
-
def output(isodoc_node, outname, format, options={})
|
41
|
+
def output(isodoc_node, inname, outname, format, options={})
|
35
42
|
case format
|
36
43
|
when :html
|
37
|
-
IsoDoc::Iso::HtmlConvert.new(options).convert(
|
44
|
+
IsoDoc::Iso::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
38
45
|
when :html_alt
|
39
|
-
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(
|
46
|
+
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(inname, isodoc_node, nil, outname)
|
40
47
|
when :doc
|
41
|
-
IsoDoc::Iso::WordConvert.new(options).convert(
|
48
|
+
IsoDoc::Iso::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
42
49
|
when :pdf
|
43
|
-
IsoDoc::Iso::PdfConvert.new(options).convert(
|
50
|
+
IsoDoc::Iso::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
51
|
+
when :sts
|
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)
|
44
55
|
else
|
45
56
|
super
|
46
57
|
end
|