metanorma-iso 2.1.1 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html2doc/lists.rb +145 -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 +173 -257
- data/lib/isodoc/iso/html/isodoc-dis.scss +173 -249
- 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 +750 -307
- data/lib/isodoc/iso/iso.international-standard.xsl +750 -307
- 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 +15 -4
- 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 +243 -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 +14 -1
- data/lib/metanorma/iso/biblio.rng +134 -39
- 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 +53 -13
- data/lib/metanorma/iso/front.rb +38 -6
- data/lib/metanorma/iso/front_id.rb +2 -0
- data/lib/metanorma/iso/isodoc.rng +32 -0
- data/lib/metanorma/iso/isostandard.rng +32 -12
- data/lib/metanorma/iso/validate_section.rb +0 -12
- 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 +223 -83
- data/spec/isodoc/postproc_spec.rb +41 -5
- data/spec/isodoc/section_spec.rb +9 -9
- data/spec/isodoc/word_dis_spec.rb +1332 -146
- data/spec/isodoc/xref_spec.rb +87 -13
- data/spec/metanorma/amd_spec.rb +39 -23
- data/spec/metanorma/base_spec.rb +174 -44
- data/spec/metanorma/blocks_spec.rb +21 -0
- data/spec/metanorma/cleanup_spec.rb +196 -196
- data/spec/metanorma/lists_spec.rb +2 -2
- data/spec/metanorma/section_spec.rb +2 -2
- data/spec/metanorma/validate_spec.rb +8 -19
- data/spec/spec_helper.rb +10 -7
- data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
- metadata +6 -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
@@ -25,6 +25,10 @@ module Metanorma
|
|
25
25
|
IsoDoc::Iso::WordConvert.new(doc_extract_attributes(node))
|
26
26
|
end
|
27
27
|
|
28
|
+
def doc_extract_attributes(node)
|
29
|
+
super.merge(isowordtemplate: node.attr("iso-word-template"))
|
30
|
+
end
|
31
|
+
|
28
32
|
def pdf_converter(node)
|
29
33
|
return nil if node.attr("no-pdf")
|
30
34
|
|
@@ -49,7 +53,16 @@ module Metanorma
|
|
49
53
|
|
50
54
|
def ol_attrs(node)
|
51
55
|
attr_code(keep_attrs(node)
|
52
|
-
.merge(id: ::Metanorma::Utils::anchor_or_uuid(node)
|
56
|
+
.merge(id: ::Metanorma::Utils::anchor_or_uuid(node),
|
57
|
+
start: node.attr("start")))
|
58
|
+
end
|
59
|
+
|
60
|
+
def admonition_name(node)
|
61
|
+
name = super
|
62
|
+
a = node.attr("type") and ["editorial"].each do |t|
|
63
|
+
name = t if a.casecmp(t).zero?
|
64
|
+
end
|
65
|
+
name
|
53
66
|
end
|
54
67
|
|
55
68
|
def outputs(node, ret)
|
@@ -614,12 +614,103 @@
|
|
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
|
+
<zeroOrMore>
|
624
|
+
<ref name="bsource"/>
|
625
|
+
</zeroOrMore>
|
626
|
+
<oneOrMore>
|
627
|
+
<ref name="docidentifier"/>
|
628
|
+
</oneOrMore>
|
629
|
+
<optional>
|
630
|
+
<ref name="docnumber"/>
|
631
|
+
</optional>
|
632
|
+
<zeroOrMore>
|
633
|
+
<ref name="bdate"/>
|
634
|
+
</zeroOrMore>
|
635
|
+
<zeroOrMore>
|
636
|
+
<ref name="contributor"/>
|
637
|
+
</zeroOrMore>
|
638
|
+
<optional>
|
639
|
+
<ref name="edition"/>
|
640
|
+
</optional>
|
641
|
+
<zeroOrMore>
|
642
|
+
<ref name="version"/>
|
643
|
+
</zeroOrMore>
|
644
|
+
<zeroOrMore>
|
645
|
+
<ref name="biblionote"/>
|
646
|
+
</zeroOrMore>
|
647
|
+
<zeroOrMore>
|
648
|
+
<ref name="language"/>
|
649
|
+
</zeroOrMore>
|
650
|
+
<zeroOrMore>
|
651
|
+
<ref name="script"/>
|
652
|
+
</zeroOrMore>
|
653
|
+
<zeroOrMore>
|
654
|
+
<ref name="bibabstract"/>
|
655
|
+
</zeroOrMore>
|
656
|
+
<optional>
|
657
|
+
<ref name="status"/>
|
658
|
+
</optional>
|
659
|
+
<zeroOrMore>
|
660
|
+
<ref name="copyright"/>
|
661
|
+
</zeroOrMore>
|
662
|
+
<zeroOrMore>
|
663
|
+
<ref name="docrelation"/>
|
664
|
+
</zeroOrMore>
|
665
|
+
<zeroOrMore>
|
666
|
+
<ref name="series"/>
|
667
|
+
</zeroOrMore>
|
668
|
+
<optional>
|
669
|
+
<ref name="medium"/>
|
670
|
+
</optional>
|
671
|
+
<zeroOrMore>
|
672
|
+
<ref name="bplace"/>
|
673
|
+
</zeroOrMore>
|
674
|
+
<zeroOrMore>
|
675
|
+
<ref name="bprice"/>
|
676
|
+
</zeroOrMore>
|
677
|
+
<zeroOrMore>
|
678
|
+
<ref name="extent"/>
|
679
|
+
</zeroOrMore>
|
680
|
+
<optional>
|
681
|
+
<ref name="bibliographic_size"/>
|
682
|
+
</optional>
|
683
|
+
<zeroOrMore>
|
684
|
+
<ref name="accesslocation"/>
|
685
|
+
</zeroOrMore>
|
686
|
+
<zeroOrMore>
|
687
|
+
<ref name="license"/>
|
688
|
+
</zeroOrMore>
|
689
|
+
<zeroOrMore>
|
690
|
+
<ref name="bclassification"/>
|
691
|
+
</zeroOrMore>
|
692
|
+
<zeroOrMore>
|
693
|
+
<ref name="bkeyword"/>
|
694
|
+
</zeroOrMore>
|
695
|
+
<optional>
|
696
|
+
<ref name="validity"/>
|
697
|
+
</optional>
|
698
|
+
</define>
|
699
|
+
<define name="ReducedBibliographicItem">
|
700
|
+
<optional>
|
701
|
+
<attribute name="type">
|
702
|
+
<ref name="BibItemType"/>
|
703
|
+
</attribute>
|
704
|
+
</optional>
|
705
|
+
<optional>
|
706
|
+
<ref name="fetched"/>
|
707
|
+
</optional>
|
708
|
+
<optional>
|
709
|
+
<ref name="formattedref"/>
|
710
|
+
</optional>
|
711
|
+
<zeroOrMore>
|
712
|
+
<ref name="btitle"/>
|
713
|
+
</zeroOrMore>
|
623
714
|
<zeroOrMore>
|
624
715
|
<ref name="bsource"/>
|
625
716
|
</zeroOrMore>
|
@@ -638,9 +729,9 @@
|
|
638
729
|
<optional>
|
639
730
|
<ref name="edition"/>
|
640
731
|
</optional>
|
641
|
-
<
|
732
|
+
<zeroOrMore>
|
642
733
|
<ref name="version"/>
|
643
|
-
</
|
734
|
+
</zeroOrMore>
|
644
735
|
<zeroOrMore>
|
645
736
|
<ref name="biblionote"/>
|
646
737
|
</zeroOrMore>
|
@@ -833,6 +924,12 @@
|
|
833
924
|
<data type="boolean"/>
|
834
925
|
</attribute>
|
835
926
|
</optional>
|
927
|
+
<optional>
|
928
|
+
<attribute name="language"/>
|
929
|
+
</optional>
|
930
|
+
<optional>
|
931
|
+
<attribute name="script"/>
|
932
|
+
</optional>
|
836
933
|
<text/>
|
837
934
|
</element>
|
838
935
|
</define>
|
@@ -986,36 +1083,34 @@
|
|
986
1083
|
<ref name="SeriesType"/>
|
987
1084
|
</attribute>
|
988
1085
|
</optional>
|
989
|
-
<
|
1086
|
+
<optional>
|
990
1087
|
<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>
|
1088
|
+
</optional>
|
1089
|
+
<ref name="btitle"/>
|
1090
|
+
<optional>
|
1091
|
+
<ref name="bplace"/>
|
1092
|
+
</optional>
|
1093
|
+
<optional>
|
1094
|
+
<ref name="seriesorganization"/>
|
1095
|
+
</optional>
|
1096
|
+
<optional>
|
1097
|
+
<ref name="abbreviation"/>
|
1098
|
+
</optional>
|
1099
|
+
<optional>
|
1100
|
+
<ref name="seriesfrom"/>
|
1101
|
+
</optional>
|
1102
|
+
<optional>
|
1103
|
+
<ref name="seriesto"/>
|
1104
|
+
</optional>
|
1105
|
+
<optional>
|
1106
|
+
<ref name="seriesnumber"/>
|
1107
|
+
</optional>
|
1108
|
+
<optional>
|
1109
|
+
<ref name="seriespartnumber"/>
|
1110
|
+
</optional>
|
1111
|
+
<optional>
|
1112
|
+
<ref name="seriesrun"/>
|
1113
|
+
</optional>
|
1019
1114
|
</element>
|
1020
1115
|
</define>
|
1021
1116
|
<define name="SeriesType">
|
@@ -1174,7 +1269,7 @@
|
|
1174
1269
|
</element>
|
1175
1270
|
</optional>
|
1176
1271
|
<element name="bibitem">
|
1177
|
-
<ref name="
|
1272
|
+
<ref name="ReducedBibliographicItem"/>
|
1178
1273
|
</element>
|
1179
1274
|
<choice>
|
1180
1275
|
<zeroOrMore>
|
@@ -1199,9 +1294,9 @@
|
|
1199
1294
|
<optional>
|
1200
1295
|
<ref name="revision-date"/>
|
1201
1296
|
</optional>
|
1202
|
-
<
|
1297
|
+
<optional>
|
1203
1298
|
<ref name="draft"/>
|
1204
|
-
</
|
1299
|
+
</optional>
|
1205
1300
|
</element>
|
1206
1301
|
</define>
|
1207
1302
|
<define name="vedition">
|
@@ -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">
|
@@ -1,8 +1,5 @@
|
|
1
1
|
require "date"
|
2
|
-
require "nokogiri"
|
3
2
|
require "htmlentities"
|
4
|
-
require "json"
|
5
|
-
require "pathname"
|
6
3
|
|
7
4
|
module Metanorma
|
8
5
|
module ISO
|
@@ -15,8 +12,7 @@ module Metanorma
|
|
15
12
|
|
16
13
|
POST_NORMREF_FOOTNOTES =
|
17
14
|
"//sections//clause[not(@type = 'scope')]//fn | "\
|
18
|
-
"//annex//fn | "
|
19
|
-
"//references[@normative = 'false']//fn".freeze
|
15
|
+
"//annex//fn | //references[@normative = 'false']//fn".freeze
|
20
16
|
|
21
17
|
def other_footnote_renumber(xmldoc)
|
22
18
|
seen = {}
|
@@ -40,7 +36,7 @@ module Metanorma
|
|
40
36
|
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']"\
|
41
37
|
"/organization").each_with_object([]) do |x, prefix|
|
42
38
|
x1 = x.at("abbreviation")&.text || x.at("name")&.text
|
43
|
-
#(x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
39
|
+
# (x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
44
40
|
prefix << x1
|
45
41
|
end
|
46
42
|
end
|
@@ -80,7 +76,8 @@ module Metanorma
|
|
80
76
|
return 2 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
|
81
77
|
return 2 if bib.at("#{PUBLISHER}[name = 'International "\
|
82
78
|
"Electrotechnical Commission']")
|
83
|
-
return 3 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]")
|
79
|
+
return 3 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]") ||
|
80
|
+
bib.at("./docidentifier[not(@type)]")
|
84
81
|
|
85
82
|
4
|
86
83
|
end
|
@@ -102,7 +99,8 @@ module Metanorma
|
|
102
99
|
def sort_biblio_key(bib)
|
103
100
|
pubclass = pub_class(bib)
|
104
101
|
num = bib&.at("./docnumber")&.text
|
105
|
-
id = bib&.at("./docidentifier[
|
102
|
+
id = bib&.at("./docidentifier[@primary]") ||
|
103
|
+
bib&.at("./docidentifier[not(#{OTHERIDS})]")
|
106
104
|
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
|
107
105
|
abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
|
108
106
|
/\d-(?<partid>\d+)/ =~ id&.text
|
@@ -118,9 +116,7 @@ module Metanorma
|
|
118
116
|
super
|
119
117
|
return unless @amd
|
120
118
|
|
121
|
-
xml.xpath("//*[@inline-header]").each
|
122
|
-
h.delete("inline-header")
|
123
|
-
end
|
119
|
+
xml.xpath("//*[@inline-header]").each { |h| h.delete("inline-header") }
|
124
120
|
end
|
125
121
|
|
126
122
|
def boilerplate_file(_xmldoc)
|
@@ -170,8 +166,7 @@ module Metanorma
|
|
170
166
|
|
171
167
|
if id = replacement_standard(b)
|
172
168
|
insert_unpub_note(b, @i18n.cancelled_and_replaced.sub(/%/, id))
|
173
|
-
else
|
174
|
-
insert_unpub_note(b, @i18n.withdrawn)
|
169
|
+
else insert_unpub_note(b, @i18n.withdrawn)
|
175
170
|
end
|
176
171
|
end
|
177
172
|
end
|
@@ -209,6 +204,51 @@ module Metanorma
|
|
209
204
|
@vocab and return
|
210
205
|
super
|
211
206
|
end
|
207
|
+
|
208
|
+
def bibdata_cleanup(xmldoc)
|
209
|
+
super
|
210
|
+
approval_groups_rename(xmldoc)
|
211
|
+
editorial_groups_agency(xmldoc)
|
212
|
+
editorial_group_types(xmldoc)
|
213
|
+
end
|
214
|
+
|
215
|
+
def approval_groups_rename(xmldoc)
|
216
|
+
%w(technical-committee subcommittee workgroup).each do |v|
|
217
|
+
xmldoc.xpath("//bibdata//approval-#{v}").each { |a| a.name = v }
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def editorial_groups_agency(xmldoc)
|
222
|
+
pubs = extract_publishers(xmldoc)
|
223
|
+
xmldoc.xpath("//bibdata/ext/editorialgroup").each do |e|
|
224
|
+
pubs.reverse.each do |p|
|
225
|
+
if e.children.empty? then e << "<agency>#{p}</agency>"
|
226
|
+
else e.children.first.previous = "<agency>#{p}</agency>"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def extract_publishers(xmldoc)
|
233
|
+
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']/"\
|
234
|
+
"organization").each_with_object([]) do |p, m|
|
235
|
+
x = p.at("./abbreviation") || p.at("./name") or next
|
236
|
+
m << x.text
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
DEFAULT_EDGROUP_TYPE = { "technical-committee": "TC",
|
241
|
+
subcommittee: "SC", workgroup: "WG" }.freeze
|
242
|
+
|
243
|
+
def editorial_group_types(xmldoc)
|
244
|
+
%w(technical-committee subcommittee workgroup).each do |v|
|
245
|
+
xmldoc.xpath("//bibdata//#{v} | //bibdata//approval-#{v}").each do |g|
|
246
|
+
next if g["type"]
|
247
|
+
|
248
|
+
g["type"] = DEFAULT_EDGROUP_TYPE[v.to_sym]
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
212
252
|
end
|
213
253
|
end
|
214
254
|
end
|