metanorma-iso 2.1.1 → 2.1.2
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/lib/html2doc/lists.rb +142 -10
- data/lib/isodoc/iso/base_convert.rb +10 -0
- data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
- data/lib/isodoc/iso/html/isodoc-dis.css +170 -252
- data/lib/isodoc/iso/html/isodoc-dis.scss +170 -245
- data/lib/isodoc/iso/html/isodoc.css +38 -13
- data/lib/isodoc/iso/html/isodoc.scss +38 -12
- data/lib/isodoc/iso/html/style-human.css +14 -1
- data/lib/isodoc/iso/html/style-human.scss +10 -1
- data/lib/isodoc/iso/html/style-iso.css +35 -23
- data/lib/isodoc/iso/html/style-iso.scss +31 -23
- data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +6 -2
- data/lib/isodoc/iso/html_convert.rb +5 -0
- data/lib/isodoc/iso/i18n-en.yaml +32 -4
- data/lib/isodoc/iso/i18n-fr.yaml +29 -3
- data/lib/isodoc/iso/i18n-ru.yaml +32 -4
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
- data/lib/isodoc/iso/i18n.rb +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +332 -187
- data/lib/isodoc/iso/iso.international-standard.xsl +332 -187
- data/lib/isodoc/iso/metadata.rb +63 -63
- data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +14 -3
- data/lib/isodoc/iso/presentation_xref.rb +8 -2
- data/lib/isodoc/iso/sections.rb +1 -1
- data/lib/isodoc/iso/word_cleanup.rb +3 -0
- data/lib/isodoc/iso/word_convert.rb +6 -3
- data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
- data/lib/isodoc/iso/word_dis_convert.rb +47 -108
- data/lib/isodoc/iso/xref.rb +34 -6
- data/lib/metanorma/iso/base.rb +20 -1
- data/lib/metanorma/iso/biblio.rng +32 -34
- data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
- data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
- data/lib/metanorma/iso/boilerplate.xml +3 -0
- data/lib/metanorma/iso/cleanup.rb +28 -1
- data/lib/metanorma/iso/front.rb +31 -6
- data/lib/metanorma/iso/front_id.rb +2 -0
- data/lib/metanorma/iso/isodoc.rng +9 -0
- data/lib/metanorma/iso/isostandard.rng +30 -12
- data/lib/metanorma/iso/macros.rb +29 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/isodoc/amd_spec.rb +4 -30
- data/spec/isodoc/blocks_spec.rb +499 -2
- data/spec/isodoc/i18n_spec.rb +145 -80
- data/spec/isodoc/iso_spec.rb +50 -169
- data/spec/isodoc/metadata_spec.rb +224 -83
- data/spec/isodoc/postproc_spec.rb +41 -5
- data/spec/isodoc/section_spec.rb +12 -6
- data/spec/isodoc/word_dis_spec.rb +1273 -147
- data/spec/isodoc/xref_spec.rb +87 -13
- data/spec/metanorma/amd_spec.rb +53 -1
- data/spec/metanorma/base_spec.rb +185 -10
- data/spec/metanorma/blocks_spec.rb +54 -0
- data/spec/metanorma/lists_spec.rb +2 -2
- data/spec/metanorma/section_spec.rb +2 -2
- data/spec/spec_helper.rb +13 -4
- data/spec/vcr_cassettes/withdrawn_iso.yml +27 -27
- metadata +7 -8
- data/docs/asciiiso-syntax.adoc +0 -307
- data/docs/guidance.adoc +0 -487
- data/docs/navigation.adoc +0 -23
- data/docs/quickstart.adoc +0 -179
- data/lib/isodoc/iso/presentation_inline.rb +0 -90
@@ -1,16 +1,16 @@
|
|
1
|
+
require_relative "word_dis_cleanup"
|
2
|
+
|
1
3
|
module IsoDoc
|
2
4
|
module Iso
|
3
5
|
class WordDISConvert < WordConvert
|
4
6
|
def default_file_locations(_options)
|
5
|
-
{
|
6
|
-
wordstylesheet: html_doc_path("wordstyle-dis.scss"),
|
7
|
+
{ wordstylesheet: html_doc_path("wordstyle-dis.scss"),
|
7
8
|
standardstylesheet: html_doc_path("isodoc-dis.scss"),
|
8
9
|
header: html_doc_path("header-dis.html"),
|
9
10
|
wordcoverpage: html_doc_path("word_iso_titlepage-dis.html"),
|
10
11
|
wordintropage: html_doc_path("word_iso_intro-dis.html"),
|
11
12
|
ulstyle: "l3",
|
12
|
-
olstyle: "l2"
|
13
|
-
}
|
13
|
+
olstyle: "l2" }
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize(options)
|
@@ -19,56 +19,20 @@ module IsoDoc
|
|
19
19
|
super
|
20
20
|
end
|
21
21
|
|
22
|
-
def init_dis; end
|
22
|
+
def init_dis(options); end
|
23
23
|
|
24
|
-
def
|
24
|
+
def convert1(docxml, filename, dir)
|
25
|
+
update_coverpage(docxml)
|
25
26
|
super
|
26
|
-
dis_styles(docxml)
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
admonitiontitle: "AdmonitionTitle",
|
37
|
-
sourcetitle: "SourceTitle",
|
38
|
-
tabletitle: "TableTitle",
|
39
|
-
titlepagesbhead: "TablePageSubhead",
|
40
|
-
NormRef: "RefNorm",
|
41
|
-
Biblio: "BiblioEntry",
|
42
|
-
MsoNormal: "MsoBodyText",
|
43
|
-
FigureTitle: "Figuretitle",
|
44
|
-
zzwarning: "zzWarning",
|
45
|
-
zzwarninghdr: "zzWarningHdr",
|
46
|
-
quoteattribution: "QuoteAttribution",
|
47
|
-
}.freeze
|
48
|
-
|
49
|
-
def dis_styles(docxml)
|
50
|
-
STYLESMAP.each do |k, v|
|
51
|
-
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
52
|
-
end
|
53
|
-
docxml.xpath("//h1[@class = 'ForewordTitle' or @class = 'IntroTitle']")
|
54
|
-
.each { |h| h.name = "p" }
|
55
|
-
dis_styles1(docxml)
|
56
|
-
docxml.xpath("//p[not(@class)]").each { |p| p["class"] = "MsoBodyText" }
|
57
|
-
end
|
58
|
-
|
59
|
-
def dis_styles1(docxml)
|
60
|
-
code_style(docxml)
|
61
|
-
figure_style(docxml)
|
62
|
-
example_style(docxml)
|
63
|
-
end
|
64
|
-
|
65
|
-
def example_style(docxml)
|
66
|
-
docxml.xpath("//div[@class = 'Example']").each do |d|
|
67
|
-
d.xpath("./p").each_with_index do |p, i|
|
68
|
-
next if p["class"] && p["class"] != "Example"
|
69
|
-
|
70
|
-
p["class"] = (i.zero? ? "Example" : "Examplecontinued")
|
71
|
-
end
|
29
|
+
def update_coverpage(docxml)
|
30
|
+
stage = docxml.at(ns("//bibdata/status/stage"))&.text
|
31
|
+
substage = docxml.at(ns("//bibdata/status/substage"))&.text
|
32
|
+
if /^9/.match?(stage) || (stage == "60" && substage == "60")
|
33
|
+
@wordcoverpage = html_doc_path("word_iso_titlepage.html")
|
34
|
+
elsif stage == "60" && substage == "00"
|
35
|
+
@wordcoverpage = html_doc_path("word_iso_titlepage-prf.html")
|
72
36
|
end
|
73
37
|
end
|
74
38
|
|
@@ -80,13 +44,6 @@ module IsoDoc
|
|
80
44
|
{ class: "Tabletitle", style: "text-align:center;" }
|
81
45
|
end
|
82
46
|
|
83
|
-
def word_annex_cleanup1(docxml, lvl)
|
84
|
-
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
85
|
-
h2.name = "p"
|
86
|
-
h2["class"] = "a#{lvl}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
47
|
def span_parse(node, out)
|
91
48
|
out.span **{ class: node["class"] } do |x|
|
92
49
|
node.children.each { |n| parse(n, x) }
|
@@ -98,7 +55,7 @@ module IsoDoc
|
|
98
55
|
<span lang="EN-GB"><span
|
99
56
|
style='mso-element:field-begin'></span><span
|
100
57
|
style='mso-spacerun:yes'> </span>TOC \\o "2-#{level}" \\h \\z \\t
|
101
|
-
"Heading 1
|
58
|
+
"Heading 1,1,ANNEX,1,Biblio Title,1,Foreword Title,1,Intro Title,1,ANNEXN,1,ANNEXZ,1,na2,1,na3,1,na4,1,na5,1,na6,1,Title,1,Base_Heading,1,Box-title,1,Front Head,1,Index Head,1,AMEND Terms Heading,1,AMEND Heading 1 Unnumbered,1"
|
102
59
|
<span style='mso-element:field-separator'></span></span>
|
103
60
|
TOC
|
104
61
|
end
|
@@ -109,60 +66,10 @@ module IsoDoc
|
|
109
66
|
ret
|
110
67
|
end
|
111
68
|
|
112
|
-
FIGURE_NESTED_STYLES =
|
113
|
-
{ Note: "Figurenote", example: "Figureexample" }.freeze
|
114
|
-
|
115
|
-
def figure_style(docxml)
|
116
|
-
docxml.xpath("//div[@class = 'figure']").each do |f|
|
117
|
-
FIGURE_NESTED_STYLES.each do |k, v|
|
118
|
-
f.xpath(".//*[@class = '#{k}']").each { |n| n["class"] = v }
|
119
|
-
end
|
120
|
-
f.xpath("./img").each do |i|
|
121
|
-
i.replace("<p class='FigureGraphic'>#{i.to_xml}</p>")
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def code_style(doc)
|
127
|
-
span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
|
128
|
-
"ISOCodebold")
|
129
|
-
span_style((doc.xpath("//tt//i") - doc.xpath("//tt//b//i")),
|
130
|
-
"ISOCodeitalic")
|
131
|
-
span_style((doc.xpath("//b//tt") - doc.xpath("//b//i//tt")),
|
132
|
-
"ISOCodebold")
|
133
|
-
span_style((doc.xpath("//i//tt") - doc.xpath("//i//b//tt")),
|
134
|
-
"ISOCodeitalic")
|
135
|
-
span_style(doc.xpath("//tt"), "ISOCode")
|
136
|
-
end
|
137
|
-
|
138
|
-
def span_style(xpath, style)
|
139
|
-
xpath.each do |elem|
|
140
|
-
elem.name = "span"
|
141
|
-
elem["class"] = style
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
69
|
def make_tr_attr(cell, row, totalrows, header)
|
146
70
|
super.merge(header: header)
|
147
71
|
end
|
148
72
|
|
149
|
-
def word_cleanup(docxml)
|
150
|
-
word_table_cell_para(docxml)
|
151
|
-
super
|
152
|
-
end
|
153
|
-
|
154
|
-
def word_table_cell_para(docxml)
|
155
|
-
docxml.xpath("//td | //th").each do |t|
|
156
|
-
s = t["header"] == "true" ? "Tableheader" : "Tablebody"
|
157
|
-
t.delete("header")
|
158
|
-
if t.at("./p |./div")
|
159
|
-
t.xpath("./p | ./div").each { |p| p["class"] = s }
|
160
|
-
else
|
161
|
-
t.children = "<div class='#{s}'>#{t.children.to_xml}</div>"
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
73
|
def toWord(result, filename, dir, header)
|
167
74
|
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
168
75
|
.gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
|
@@ -178,6 +85,38 @@ module IsoDoc
|
|
178
85
|
header&.unlink
|
179
86
|
@wordstylesheet.unlink if @wordstylesheet.is_a?(Tempfile)
|
180
87
|
end
|
88
|
+
|
89
|
+
def middle_title(_isoxml, out)
|
90
|
+
middle_title_dis(out)
|
91
|
+
end
|
92
|
+
|
93
|
+
def middle_title_dis(out)
|
94
|
+
out.p(**{ class: "zzSTDTitle" }) do |p|
|
95
|
+
p << @meta.get[:doctitleintro]
|
96
|
+
@meta.get[:doctitleintro] && @meta.get[:doctitlemain] and p << " — "
|
97
|
+
p << @meta.get[:doctitlemain]
|
98
|
+
@meta.get[:doctitlemain] && @meta.get[:doctitlepart] and p << " — "
|
99
|
+
if @meta.get[:doctitlepart]
|
100
|
+
b = @meta.get[:doctitlepartlabel] and
|
101
|
+
p << "<span style='font-weight:normal'>#{b}</span> "
|
102
|
+
p << " #{@meta.get[:doctitlepart]}"
|
103
|
+
end
|
104
|
+
@meta.get[:doctitleamdlabel] || @meta.get[:doctitleamd] ||
|
105
|
+
@meta.get[:doctitlecorrlabel] and middle_title_dis_amd(p)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def middle_title_dis_amd(para)
|
110
|
+
para.span(**{ style: "font-weight:normal" }) do |p|
|
111
|
+
if a = @meta.get[:doctitleamdlabel]
|
112
|
+
p << " #{a}"
|
113
|
+
a = @meta.get[:doctitleamd] and p << ": #{a}"
|
114
|
+
end
|
115
|
+
if a = @meta.get[:doctitlecorrlabel]
|
116
|
+
p << " #{a}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
181
120
|
end
|
182
121
|
end
|
183
122
|
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -77,11 +77,10 @@ module IsoDoc
|
|
77
77
|
i = Counter.new
|
78
78
|
clause.xpath(ns("./appendix")).each do |c|
|
79
79
|
i.increment(c)
|
80
|
-
@anchors[c["id"]] =
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
@anchors[c["id"]][:container] = clause["id"]
|
80
|
+
@anchors[c["id"]] =
|
81
|
+
anchor_struct(i.print, nil, @labels["appendix"],
|
82
|
+
"clause").merge(level: 2, subtype: "annex",
|
83
|
+
container: clause["id"])
|
85
84
|
j = Counter.new
|
86
85
|
c.xpath(ns("./clause | ./references")).each do |c1|
|
87
86
|
j.increment(c1)
|
@@ -92,7 +91,7 @@ module IsoDoc
|
|
92
91
|
end
|
93
92
|
|
94
93
|
# subclauses are not prefixed with "Clause"
|
95
|
-
# retaining
|
94
|
+
# retaining subtype for the semantics
|
96
95
|
def section_names1(clause, num, level)
|
97
96
|
@anchors[clause["id"]] =
|
98
97
|
{ label: num, level: level, xref: num, subtype: "clause" }
|
@@ -189,6 +188,35 @@ module IsoDoc
|
|
189
188
|
def annex_name_lbl(clause, num)
|
190
189
|
super.sub(%r{<br/>(.*)$}, "<br/><span class='obligation'>\\1</span>")
|
191
190
|
end
|
191
|
+
|
192
|
+
def list_anchor_names(sections)
|
193
|
+
sections.each do |s|
|
194
|
+
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
195
|
+
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
196
|
+
c = Counter.new
|
197
|
+
notes.reject { |n| blank?(n["id"]) }.each do |n|
|
198
|
+
@anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
|
199
|
+
@labels["list"], "list", false)
|
200
|
+
list_item_anchor_names(n, @anchors[n["id"]], 1, "",
|
201
|
+
!single_ol_for_xrefs?(notes))
|
202
|
+
end
|
203
|
+
list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# all li in the ol in lists are consecutively numbered through @start
|
208
|
+
def single_ol_for_xrefs?(lists)
|
209
|
+
return true if lists.size == 1
|
210
|
+
|
211
|
+
start = 0
|
212
|
+
lists.each_with_index do |l, i|
|
213
|
+
next if i.zero?
|
214
|
+
|
215
|
+
start += lists[i - 1].xpath(ns("./li")).size
|
216
|
+
return false unless l["start"]&.to_i == start + 1
|
217
|
+
end
|
218
|
+
true
|
219
|
+
end
|
192
220
|
end
|
193
221
|
end
|
194
222
|
end
|
data/lib/metanorma/iso/base.rb
CHANGED
@@ -5,10 +5,16 @@ require "pathname"
|
|
5
5
|
require "open-uri"
|
6
6
|
require "isodoc"
|
7
7
|
require "fileutils"
|
8
|
+
require_relative "macros"
|
8
9
|
|
9
10
|
module Metanorma
|
10
11
|
module ISO
|
11
12
|
class Converter < Standoc::Converter
|
13
|
+
Asciidoctor::Extensions.register do
|
14
|
+
block Metanorma::ISO::EditorAdmonitionBlock
|
15
|
+
treeprocessor Metanorma::ISO::EditorInlineAdmonitionBlock
|
16
|
+
end
|
17
|
+
|
12
18
|
XML_ROOT_TAG = "iso-standard".freeze
|
13
19
|
XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
|
14
20
|
|
@@ -25,6 +31,10 @@ module Metanorma
|
|
25
31
|
IsoDoc::Iso::WordConvert.new(doc_extract_attributes(node))
|
26
32
|
end
|
27
33
|
|
34
|
+
def doc_extract_attributes(node)
|
35
|
+
super.merge(isowordtemplate: node.attr("iso-word-template"))
|
36
|
+
end
|
37
|
+
|
28
38
|
def pdf_converter(node)
|
29
39
|
return nil if node.attr("no-pdf")
|
30
40
|
|
@@ -49,7 +59,16 @@ module Metanorma
|
|
49
59
|
|
50
60
|
def ol_attrs(node)
|
51
61
|
attr_code(keep_attrs(node)
|
52
|
-
.merge(id: ::Metanorma::Utils::anchor_or_uuid(node)
|
62
|
+
.merge(id: ::Metanorma::Utils::anchor_or_uuid(node),
|
63
|
+
start: node.attr("start")))
|
64
|
+
end
|
65
|
+
|
66
|
+
def admonition_name(node)
|
67
|
+
name = super
|
68
|
+
a = node.attr("type") and ["editorial"].each do |t|
|
69
|
+
name = t if a.casecmp(t).zero?
|
70
|
+
end
|
71
|
+
name
|
53
72
|
end
|
54
73
|
|
55
74
|
def outputs(node, ret)
|
@@ -614,12 +614,12 @@
|
|
614
614
|
<optional>
|
615
615
|
<ref name="fetched"/>
|
616
616
|
</optional>
|
617
|
-
<
|
618
|
-
<oneOrMore>
|
619
|
-
<ref name="btitle"/>
|
620
|
-
</oneOrMore>
|
617
|
+
<optional>
|
621
618
|
<ref name="formattedref"/>
|
622
|
-
</
|
619
|
+
</optional>
|
620
|
+
<oneOrMore>
|
621
|
+
<ref name="btitle"/>
|
622
|
+
</oneOrMore>
|
623
623
|
<zeroOrMore>
|
624
624
|
<ref name="bsource"/>
|
625
625
|
</zeroOrMore>
|
@@ -986,36 +986,34 @@
|
|
986
986
|
<ref name="SeriesType"/>
|
987
987
|
</attribute>
|
988
988
|
</optional>
|
989
|
-
<
|
989
|
+
<optional>
|
990
990
|
<ref name="formattedref"/>
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
</group>
|
1018
|
-
</choice>
|
991
|
+
</optional>
|
992
|
+
<ref name="btitle"/>
|
993
|
+
<optional>
|
994
|
+
<ref name="bplace"/>
|
995
|
+
</optional>
|
996
|
+
<optional>
|
997
|
+
<ref name="seriesorganization"/>
|
998
|
+
</optional>
|
999
|
+
<optional>
|
1000
|
+
<ref name="abbreviation"/>
|
1001
|
+
</optional>
|
1002
|
+
<optional>
|
1003
|
+
<ref name="seriesfrom"/>
|
1004
|
+
</optional>
|
1005
|
+
<optional>
|
1006
|
+
<ref name="seriesto"/>
|
1007
|
+
</optional>
|
1008
|
+
<optional>
|
1009
|
+
<ref name="seriesnumber"/>
|
1010
|
+
</optional>
|
1011
|
+
<optional>
|
1012
|
+
<ref name="seriespartnumber"/>
|
1013
|
+
</optional>
|
1014
|
+
<optional>
|
1015
|
+
<ref name="seriesrun"/>
|
1016
|
+
</optional>
|
1019
1017
|
</element>
|
1020
1018
|
</define>
|
1021
1019
|
<define name="SeriesType">
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
+
{% if stage_int >= 40 %}
|
5
|
+
<title>DOCUMENT PROTÉGÉ PAR COPYRIGHT</title>
|
6
|
+
{% endif %}
|
4
7
|
<p id="boilerplate-year">© <span class="std_publisher">{{ agency }}</span> <span class="std_docNumber">{{ docyear }}</span></p>
|
5
8
|
|
6
9
|
<p id="boilerplate-message">
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
+
{% if stage_int >= 40 %}
|
5
|
+
<title>ДОКУМЕНТ, ОХРАНЯЕМЫЙ АВТОРСКИМ ПРАВОМ</title>
|
6
|
+
{% endif %}
|
4
7
|
<p id="boilerplate-year">© <span class="std_publisher">{{ agency }}</span> <span class="std_docNumber">{{ docyear }}</span></p>
|
5
8
|
|
6
9
|
<p id="boilerplate-message">
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
+
{% if stage_int >= 40 %}
|
5
|
+
<title>COPYRIGHT PROTECTED DOCUMENT</title>
|
6
|
+
{% endif %}
|
4
7
|
<p id="boilerplate-year">© <span class="std_publisher">{{ agency }}</span> <span class="std_docNumber">{{ docyear }}</span></p>
|
5
8
|
|
6
9
|
<p id="boilerplate-message">
|
@@ -40,7 +40,7 @@ module Metanorma
|
|
40
40
|
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']"\
|
41
41
|
"/organization").each_with_object([]) do |x, prefix|
|
42
42
|
x1 = x.at("abbreviation")&.text || x.at("name")&.text
|
43
|
-
#(x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
43
|
+
# (x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
44
44
|
prefix << x1
|
45
45
|
end
|
46
46
|
end
|
@@ -209,6 +209,33 @@ module Metanorma
|
|
209
209
|
@vocab and return
|
210
210
|
super
|
211
211
|
end
|
212
|
+
|
213
|
+
def bibdata_cleanup(xmldoc)
|
214
|
+
super
|
215
|
+
approval_groups_rename(xmldoc)
|
216
|
+
editorial_groups_agency(xmldoc)
|
217
|
+
end
|
218
|
+
|
219
|
+
def approval_groups_rename(xmldoc)
|
220
|
+
%w(technical-committee subcommittee workgroup).each do |v|
|
221
|
+
xmldoc.xpath("//bibdata//approval-#{v}").each do |a|
|
222
|
+
a.name = v
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def editorial_groups_agency(xmldoc)
|
228
|
+
pubs = xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']/"\
|
229
|
+
"organization").each_with_object([]) do |p, m|
|
230
|
+
x = p.at("./abbreviation") || p.at("./name") or next
|
231
|
+
m << x.text
|
232
|
+
end
|
233
|
+
xmldoc.xpath("//bibdata/ext/editorialgroup").each do |e|
|
234
|
+
pubs.reverse.each do |p|
|
235
|
+
e.children.first.previous = "<agency>#{p}</agency>"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
212
239
|
end
|
213
240
|
end
|
214
241
|
end
|
data/lib/metanorma/iso/front.rb
CHANGED
@@ -81,11 +81,35 @@ module Metanorma
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def metadata_committee(node, xml)
|
84
|
+
metadata_editorial_committee(node, xml)
|
85
|
+
metadata_approval_committee(node, xml)
|
86
|
+
end
|
87
|
+
|
88
|
+
def metadata_editorial_committee(node, xml)
|
84
89
|
xml.editorialgroup do |a|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
node.attr("secretariat")
|
90
|
+
%w(technical-committee subcommittee workgroup).each do |v|
|
91
|
+
committee_component(v, node, a)
|
92
|
+
end
|
93
|
+
node.attr("secretariat") and a.secretariat(node.attr("secretariat"))
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def metadata_approval_committee(node, xml)
|
98
|
+
types = %w(technical-committee subcommittee workgroup)
|
99
|
+
node.attr("approval-technical-committee-number") and
|
100
|
+
types = %w(approval-technical-committee approval-subcommittee
|
101
|
+
approval-workgroup)
|
102
|
+
xml.approvalgroup do |a|
|
103
|
+
metadata_approval_agency(a, node.attr("approval-agency")
|
104
|
+
&.split(%r{[/,;]}))
|
105
|
+
types.each { |v| committee_component(v, node, a) }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def metadata_approval_agency(xml, list)
|
110
|
+
list = ["ISO"] if list.nil? || list.empty?
|
111
|
+
list.each do |v|
|
112
|
+
xml.agency v
|
89
113
|
end
|
90
114
|
end
|
91
115
|
|
@@ -146,7 +170,8 @@ module Metanorma
|
|
146
170
|
end
|
147
171
|
|
148
172
|
def relaton_relations
|
149
|
-
super + %w(obsoletes successor-of manifestation-of related
|
173
|
+
super + %w(obsoletes successor-of manifestation-of related
|
174
|
+
annotation-of)
|
150
175
|
end
|
151
176
|
|
152
177
|
def relaton_relation_descriptions
|
@@ -162,7 +187,7 @@ module Metanorma
|
|
162
187
|
"identical-adopted-from" => "adoptedFrom",
|
163
188
|
"modified-adopted-from" => "adoptedFrom",
|
164
189
|
"related-directive" => "related",
|
165
|
-
"related-mandate" => "related"
|
190
|
+
"related-mandate" => "related"
|
166
191
|
)
|
167
192
|
end
|
168
193
|
end
|
@@ -202,6 +202,8 @@ module Metanorma
|
|
202
202
|
%w(40 50).include?(stage) && i = node.attr("iteration") and
|
203
203
|
itersuffix = ".#{i}"
|
204
204
|
return docnum if abbr.nil? || abbr.empty? # prefixes added in cleanup
|
205
|
+
|
206
|
+
typeabbr = "" if %w(DTS FDTS).include?(abbr.sub(/\s+$/, ""))
|
205
207
|
return "/#{abbr}#{typeabbr} #{docnum}#{itersuffix}" unless @amd
|
206
208
|
|
207
209
|
a = docnum.split(%r{/})
|
@@ -282,6 +282,9 @@
|
|
282
282
|
<ref name="MultilingualRenderingType"/>
|
283
283
|
</attribute>
|
284
284
|
</optional>
|
285
|
+
<optional>
|
286
|
+
<ref name="tname"/>
|
287
|
+
</optional>
|
285
288
|
<oneOrMore>
|
286
289
|
<ref name="ul_li"/>
|
287
290
|
</oneOrMore>
|
@@ -324,6 +327,9 @@
|
|
324
327
|
</choice>
|
325
328
|
</attribute>
|
326
329
|
</optional>
|
330
|
+
<optional>
|
331
|
+
<ref name="tname"/>
|
332
|
+
</optional>
|
327
333
|
<oneOrMore>
|
328
334
|
<ref name="li"/>
|
329
335
|
</oneOrMore>
|
@@ -360,6 +366,9 @@
|
|
360
366
|
<ref name="MultilingualRenderingType"/>
|
361
367
|
</attribute>
|
362
368
|
</optional>
|
369
|
+
<optional>
|
370
|
+
<ref name="tname"/>
|
371
|
+
</optional>
|
363
372
|
<oneOrMore>
|
364
373
|
<ref name="dt"/>
|
365
374
|
<ref name="dd"/>
|
@@ -45,6 +45,7 @@
|
|
45
45
|
<ref name="horizontal"/>
|
46
46
|
</optional>
|
47
47
|
<ref name="editorialgroup"/>
|
48
|
+
<ref name="approvalgroup"/>
|
48
49
|
<zeroOrMore>
|
49
50
|
<ref name="ics"/>
|
50
51
|
</zeroOrMore>
|
@@ -249,6 +250,7 @@
|
|
249
250
|
<value>warning</value>
|
250
251
|
<value>important</value>
|
251
252
|
<value>safety precautions</value>
|
253
|
+
<value>editorial</value>
|
252
254
|
</choice>
|
253
255
|
</define>
|
254
256
|
<define name="preface">
|
@@ -308,18 +310,7 @@
|
|
308
310
|
</define>
|
309
311
|
<define name="editorialgroup">
|
310
312
|
<element name="editorialgroup">
|
311
|
-
<
|
312
|
-
<ref name="technical-committee"/>
|
313
|
-
</oneOrMore>
|
314
|
-
<zeroOrMore>
|
315
|
-
<ref name="subcommittee"/>
|
316
|
-
</zeroOrMore>
|
317
|
-
<zeroOrMore>
|
318
|
-
<ref name="workgroup"/>
|
319
|
-
</zeroOrMore>
|
320
|
-
<optional>
|
321
|
-
<ref name="secretariat"/>
|
322
|
-
</optional>
|
313
|
+
<ref name="ISOProjectGroup"/>
|
323
314
|
</element>
|
324
315
|
</define>
|
325
316
|
<define name="Content-Section">
|
@@ -367,6 +358,33 @@
|
|
367
358
|
</define>
|
368
359
|
</include>
|
369
360
|
<!-- end overrides -->
|
361
|
+
<define name="ISOProjectGroup">
|
362
|
+
<zeroOrMore>
|
363
|
+
<ref name="agency"/>
|
364
|
+
</zeroOrMore>
|
365
|
+
<oneOrMore>
|
366
|
+
<ref name="technical-committee"/>
|
367
|
+
</oneOrMore>
|
368
|
+
<zeroOrMore>
|
369
|
+
<ref name="subcommittee"/>
|
370
|
+
</zeroOrMore>
|
371
|
+
<zeroOrMore>
|
372
|
+
<ref name="workgroup"/>
|
373
|
+
</zeroOrMore>
|
374
|
+
<optional>
|
375
|
+
<ref name="secretariat"/>
|
376
|
+
</optional>
|
377
|
+
</define>
|
378
|
+
<define name="approvalgroup">
|
379
|
+
<element name="approvalgroup">
|
380
|
+
<ref name="ISOProjectGroup"/>
|
381
|
+
</element>
|
382
|
+
</define>
|
383
|
+
<define name="agency">
|
384
|
+
<element name="agency">
|
385
|
+
<text/>
|
386
|
+
</element>
|
387
|
+
</define>
|
370
388
|
<!--
|
371
389
|
We display the Normative References between scope and terms; but to keep the
|
372
390
|
grammar simple, we keep the references together
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module ISO
|
3
|
+
class EditorAdmonitionBlock < Asciidoctor::Extensions::BlockProcessor
|
4
|
+
use_dsl
|
5
|
+
named :EDITOR
|
6
|
+
on_contexts :example, :paragraph
|
7
|
+
|
8
|
+
def process(parent, reader, attrs)
|
9
|
+
attrs["name"] = "editorial"
|
10
|
+
attrs["caption"] = "EDITOR"
|
11
|
+
create_block(parent, :admonition, reader.lines, attrs,
|
12
|
+
content_model: :compound)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class EditorInlineAdmonitionBlock < Asciidoctor::Extensions::Treeprocessor
|
17
|
+
def process(document)
|
18
|
+
(document.find_by context: :paragraph).each do |para|
|
19
|
+
next unless /^EDITOR: /.match? para.lines[0]
|
20
|
+
|
21
|
+
para.set_attr("name", "editorial")
|
22
|
+
para.set_attr("caption", "EDITOR")
|
23
|
+
para.lines[0].sub!(/^EDITOR: /, "")
|
24
|
+
para.context = :admonition
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|