metanorma-iso 2.0.7 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iso/base.rb +0 -1
- data/lib/asciidoctor/iso/cleanup.rb +0 -1
- data/lib/asciidoctor/iso/converter.rb +0 -1
- data/lib/asciidoctor/iso/deprecated.rb +4 -2
- data/lib/asciidoctor/iso/front.rb +0 -1
- data/lib/asciidoctor/iso/front_id.rb +0 -1
- data/lib/asciidoctor/iso/section.rb +0 -1
- data/lib/asciidoctor/iso/validate.rb +0 -1
- data/lib/asciidoctor/iso/validate_image.rb +0 -1
- data/lib/asciidoctor/iso/validate_requirements.rb +0 -1
- data/lib/asciidoctor/iso/validate_section.rb +0 -1
- data/lib/asciidoctor/iso/validate_style.rb +0 -1
- data/lib/asciidoctor/iso/validate_title.rb +0 -1
- data/lib/html2doc/lists.rb +37 -0
- data/lib/isodoc/iso/html/html_iso_titlepage.html +7 -2
- data/lib/isodoc/iso/html/isodoc-dis.css +196 -156
- data/lib/isodoc/iso/html/isodoc-dis.scss +193 -156
- data/lib/isodoc/iso/html/word_iso_intro-dis.html +7 -0
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +3 -2
- data/lib/isodoc/iso/html/word_iso_titlepage.html +8 -2
- data/lib/isodoc/iso/html/wordstyle-dis.css +204 -34
- data/lib/isodoc/iso/html/wordstyle-dis.scss +198 -34
- data/lib/isodoc/iso/i18n-en.yaml +2 -1
- data/lib/isodoc/iso/i18n-fr.yaml +1 -0
- data/lib/isodoc/iso/i18n-ru.yaml +1 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/iso/index.rb +1 -1
- data/lib/isodoc/iso/init.rb +17 -1
- data/lib/isodoc/iso/iso.amendment.xsl +726 -299
- data/lib/isodoc/iso/iso.international-standard.xsl +726 -299
- data/lib/isodoc/iso/metadata.rb +75 -63
- data/lib/isodoc/iso/presentation_inline.rb +90 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +39 -100
- data/lib/isodoc/iso/presentation_xref.rb +126 -0
- data/lib/isodoc/iso/word_cleanup.rb +16 -2
- data/lib/isodoc/iso/word_convert.rb +27 -10
- data/lib/isodoc/iso/word_dis_convert.rb +174 -0
- data/lib/isodoc/iso/xref.rb +50 -30
- data/lib/metanorma/iso/biblio.rng +62 -10
- data/lib/metanorma/iso/boilerplate-fr.xml +1 -1
- data/lib/metanorma/iso/boilerplate-ru.xml +1 -3
- data/lib/metanorma/iso/boilerplate.xml +1 -3
- data/lib/metanorma/iso/cleanup.rb +7 -6
- data/lib/metanorma/iso/front_id.rb +28 -11
- data/lib/metanorma/iso/isodoc.rng +56 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma-iso.rb +1 -0
- data/lib/relaton/render/config.yml +4 -0
- data/lib/relaton/render/general.rb +13 -0
- data/metanorma-iso.gemspec +1 -1
- data/spec/isodoc/amd_spec.rb +15 -14
- data/spec/isodoc/blocks_spec.rb +286 -179
- data/spec/isodoc/i18n_spec.rb +296 -133
- data/spec/isodoc/inline_spec.rb +35 -42
- data/spec/isodoc/iso_spec.rb +43 -27
- data/spec/isodoc/postproc_spec.rb +25 -0
- data/spec/isodoc/ref_spec.rb +66 -69
- data/spec/isodoc/section_spec.rb +78 -76
- data/spec/isodoc/table_spec.rb +2 -2
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/word_dis_spec.rb +760 -0
- data/spec/isodoc/xref_spec.rb +51 -51
- data/spec/metanorma/amd_spec.rb +39 -16
- data/spec/metanorma/base_spec.rb +17 -9
- data/spec/metanorma/blocks_spec.rb +4 -4
- data/spec/metanorma/cleanup_spec.rb +11 -11
- data/spec/metanorma/section_spec.rb +3 -3
- data/spec/spec_helper.rb +5 -2
- data/spec/vcr_cassettes/withdrawn_iso.yml +26 -26
- metadata +11 -5
- data/spec/vcr_cassettes/docrels.yml +0 -385
@@ -2,6 +2,7 @@ require_relative "base_convert"
|
|
2
2
|
require "isodoc"
|
3
3
|
require_relative "init"
|
4
4
|
require_relative "word_cleanup"
|
5
|
+
require_relative "word_dis_convert"
|
5
6
|
|
6
7
|
module IsoDoc
|
7
8
|
module Iso
|
@@ -13,6 +14,11 @@ module IsoDoc
|
|
13
14
|
@wordToClevels = 3 if @wordToClevels.zero?
|
14
15
|
@htmlToClevels = options[:htmltoclevels].to_i
|
15
16
|
@htmlToClevels = 3 if @htmlToClevels.zero?
|
17
|
+
init_dis
|
18
|
+
end
|
19
|
+
|
20
|
+
def init_dis
|
21
|
+
@dis = ::IsoDoc::Iso::WordDISConvert.new(options)
|
16
22
|
end
|
17
23
|
|
18
24
|
def font_choice(options)
|
@@ -45,16 +51,16 @@ module IsoDoc
|
|
45
51
|
olstyle: "l2" }
|
46
52
|
end
|
47
53
|
|
48
|
-
def
|
49
|
-
|
50
|
-
if
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
@
|
55
|
-
|
54
|
+
def convert(input_filename, file = nil, debug = false,
|
55
|
+
output_filename = nil)
|
56
|
+
file = File.read(input_filename, encoding: "utf-8") if file.nil?
|
57
|
+
docxml = Nokogiri::XML(file) { |config| config.huge }
|
58
|
+
if @dis &&
|
59
|
+
/^[45].$/.match?(docxml&.at(ns("//bibdata/status/stage"))&.text)
|
60
|
+
@dis.convert(input_filename, file, debug, output_filename)
|
61
|
+
else
|
62
|
+
super
|
56
63
|
end
|
57
|
-
super
|
58
64
|
end
|
59
65
|
|
60
66
|
def make_body(xml, docxml)
|
@@ -171,11 +177,22 @@ module IsoDoc
|
|
171
177
|
|
172
178
|
name&.at(ns("./strong"))&.remove # supplied by CSS list numbering
|
173
179
|
div.h1 **{ class: "Annex" } do |t|
|
174
|
-
name
|
180
|
+
annex_name1(name, t)
|
175
181
|
clause_parse_subtitle(name, t)
|
176
182
|
end
|
177
183
|
end
|
178
184
|
|
185
|
+
def annex_name1(name, out)
|
186
|
+
name.children.each do |c2|
|
187
|
+
if c2.name == "span" && c2["class"] == "obligation"
|
188
|
+
out.span **{ style: "font-weight:normal;" } do |s|
|
189
|
+
c2.children.each { |c3| parse(c3, s) }
|
190
|
+
end
|
191
|
+
else parse(c2, out)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
179
196
|
include BaseConvert
|
180
197
|
include Init
|
181
198
|
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
class WordDISConvert < WordConvert
|
4
|
+
def default_file_locations(_options)
|
5
|
+
{
|
6
|
+
wordstylesheet: html_doc_path("wordstyle-dis.scss"),
|
7
|
+
standardstylesheet: html_doc_path("isodoc-dis.scss"),
|
8
|
+
header: html_doc_path("header-dis.html"),
|
9
|
+
wordcoverpage: html_doc_path("word_iso_titlepage-dis.html"),
|
10
|
+
wordintropage: html_doc_path("word_iso_intro-dis.html"),
|
11
|
+
ulstyle: "l3",
|
12
|
+
olstyle: "l2",
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(options)
|
17
|
+
@libdir ||= File.dirname(__FILE__) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor
|
18
|
+
options.merge!(default_file_locations(options))
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def init_dis; end
|
23
|
+
|
24
|
+
def style_cleanup(docxml)
|
25
|
+
super
|
26
|
+
dis_styles(docxml)
|
27
|
+
end
|
28
|
+
|
29
|
+
STYLESMAP = {
|
30
|
+
AltTerms: "AdmittedTerm",
|
31
|
+
TableFootnote: "Tablefootnote",
|
32
|
+
formula: "Formula",
|
33
|
+
note: "Note",
|
34
|
+
NormRef: "RefNorm",
|
35
|
+
biblio: "BiblioEntry",
|
36
|
+
MsoNormal: "MsoBodyText",
|
37
|
+
FigureTitle: "Figuretitle",
|
38
|
+
}.freeze
|
39
|
+
|
40
|
+
def dis_styles(docxml)
|
41
|
+
STYLESMAP.each do |k, v|
|
42
|
+
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
43
|
+
end
|
44
|
+
docxml.xpath("//h1[@class = 'ForewordTitle' or @class = 'IntroTitle']")
|
45
|
+
.each { |h| h.name = "p" }
|
46
|
+
dis_styles1(docxml)
|
47
|
+
docxml.xpath("//p[not(@class)]").each { |p| p["class"] = "MsoBodyText" }
|
48
|
+
end
|
49
|
+
|
50
|
+
def dis_styles1(docxml)
|
51
|
+
code_style(docxml)
|
52
|
+
figure_style(docxml)
|
53
|
+
example_style(docxml)
|
54
|
+
end
|
55
|
+
|
56
|
+
def example_style(docxml)
|
57
|
+
docxml.xpath("//div[@class = 'Example']").each do |d|
|
58
|
+
d.xpath("./p").each_with_index do |p, i|
|
59
|
+
next if p["class"] && p["class"] != "Example"
|
60
|
+
|
61
|
+
p["class"] = (i.zero? ? "Example" : "Examplecontinued")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def figure_name_attrs(_node)
|
67
|
+
{ class: "FigureTitle", style: "text-align:center;" }
|
68
|
+
end
|
69
|
+
|
70
|
+
def table_title_attrs(_node)
|
71
|
+
{ class: "Tabletitle", style: "text-align:center;" }
|
72
|
+
end
|
73
|
+
|
74
|
+
def word_annex_cleanup1(docxml, lvl)
|
75
|
+
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
76
|
+
h2.name = "p"
|
77
|
+
h2["class"] = "a#{lvl}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def span_parse(node, out)
|
82
|
+
out.span **{ class: node["class"] } do |x|
|
83
|
+
node.children.each { |n| parse(n, x) }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def word_toc_preface(level)
|
88
|
+
<<~TOC.freeze
|
89
|
+
<span lang="EN-GB"><span
|
90
|
+
style='mso-element:field-begin'></span><span
|
91
|
+
style='mso-spacerun:yes'> </span>TOC \\o "2-#{level}" \\h \\z \\t
|
92
|
+
"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"
|
93
|
+
<span style='mso-element:field-separator'></span></span>
|
94
|
+
TOC
|
95
|
+
end
|
96
|
+
|
97
|
+
def render_identifier(ident)
|
98
|
+
ret = super
|
99
|
+
ret[:sdo] = std_docid_semantic(ret[:sdo])
|
100
|
+
ret
|
101
|
+
end
|
102
|
+
|
103
|
+
FIGURE_NESTED_STYLES =
|
104
|
+
{ Note: "Figurenote", example: "Figureexample" }.freeze
|
105
|
+
|
106
|
+
def figure_style(docxml)
|
107
|
+
docxml.xpath("//div[@class = 'figure']").each do |f|
|
108
|
+
FIGURE_NESTED_STYLES.each do |k, v|
|
109
|
+
f.xpath(".//*[@class = '#{k}']").each { |n| n["class"] = v }
|
110
|
+
end
|
111
|
+
f.xpath("./img").each do |i|
|
112
|
+
i.replace("<p class='FigureGraphic'>#{i.to_xml}</p>")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def code_style(doc)
|
118
|
+
span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
|
119
|
+
"ISOCodebold")
|
120
|
+
span_style((doc.xpath("//tt//i") - doc.xpath("//tt//b//i")),
|
121
|
+
"ISOCodeitalic")
|
122
|
+
span_style((doc.xpath("//b//tt") - doc.xpath("//b//i//tt")),
|
123
|
+
"ISOCodebold")
|
124
|
+
span_style((doc.xpath("//i//tt") - doc.xpath("//i//b//tt")),
|
125
|
+
"ISOCodeitalic")
|
126
|
+
span_style(doc.xpath("//tt"), "ISOCode")
|
127
|
+
end
|
128
|
+
|
129
|
+
def span_style(xpath, style)
|
130
|
+
xpath.each do |elem|
|
131
|
+
elem.name = "span"
|
132
|
+
elem["class"] = style
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def make_tr_attr(cell, row, totalrows, header)
|
137
|
+
super.merge(header: header)
|
138
|
+
end
|
139
|
+
|
140
|
+
def word_cleanup(docxml)
|
141
|
+
word_table_cell_para(docxml)
|
142
|
+
super
|
143
|
+
end
|
144
|
+
|
145
|
+
def word_table_cell_para(docxml)
|
146
|
+
docxml.xpath("//td | //th").each do |t|
|
147
|
+
s = t["header"] == "true" ? "Tableheader" : "Tablebody"
|
148
|
+
t.delete("header")
|
149
|
+
if t.at("./p |./div")
|
150
|
+
t.xpath("./p | ./div").each { |p| p["class"] = s }
|
151
|
+
else
|
152
|
+
t.children = "<div class='#{s}'>#{t.children.to_xml}</div>"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def toWord(result, filename, dir, header)
|
158
|
+
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
159
|
+
.gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
|
160
|
+
@wordstylesheet = wordstylesheet_update
|
161
|
+
::Html2Doc::IsoDIS.new(
|
162
|
+
filename: filename,
|
163
|
+
imagedir: @localdir,
|
164
|
+
stylesheet: @wordstylesheet&.path,
|
165
|
+
header_file: header&.path, dir: dir,
|
166
|
+
asciimathdelims: [@openmathdelim, @closemathdelim],
|
167
|
+
liststyles: { ul: @ulstyle, ol: @olstyle }
|
168
|
+
).process(result)
|
169
|
+
header&.unlink
|
170
|
+
@wordstylesheet.unlink if @wordstylesheet.is_a?(Tempfile)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -10,36 +10,48 @@ module IsoDoc
|
|
10
10
|
else
|
11
11
|
initial_anchor_names1(doc)
|
12
12
|
end
|
13
|
-
|
13
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
14
|
+
introduction_names(doc.at(ns("//introduction")))
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
18
|
def initial_anchor_names_amd(doc)
|
17
|
-
|
18
|
-
|
19
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
20
|
+
doc.xpath(ns("//preface/*")).each do |c|
|
21
|
+
c.element? and preface_names(c)
|
22
|
+
end
|
23
|
+
doc.xpath(ns("//sections/clause")).each do |c|
|
24
|
+
c.element? and preface_names(c)
|
25
|
+
end
|
19
26
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
27
|
+
if @parse_settings.empty?
|
28
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
29
|
+
middle_section_asset_names(doc)
|
30
|
+
termnote_anchor_names(doc)
|
31
|
+
termexample_anchor_names(doc)
|
23
32
|
end
|
24
|
-
middle_section_asset_names(doc)
|
25
|
-
termnote_anchor_names(doc)
|
26
|
-
termexample_anchor_names(doc)
|
27
33
|
end
|
28
34
|
|
29
35
|
def initial_anchor_names1(doc)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
n = section_names(
|
36
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
37
|
+
doc.xpath(ns("//preface/*")).each do |c|
|
38
|
+
c.element? and preface_names(c)
|
39
|
+
end
|
40
|
+
# potentially overridden in middle_section_asset_names()
|
41
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
42
|
+
n = Counter.new
|
43
|
+
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
44
|
+
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
45
|
+
doc.xpath(ns("//sections/clause[not(@type = 'scope')] | "\
|
46
|
+
"//sections/terms | //sections/definitions")).each do |c|
|
47
|
+
n = section_names(c, n, 1)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if @parse_settings.empty?
|
51
|
+
middle_section_asset_names(doc)
|
52
|
+
termnote_anchor_names(doc)
|
53
|
+
termexample_anchor_names(doc)
|
39
54
|
end
|
40
|
-
middle_section_asset_names(doc)
|
41
|
-
termnote_anchor_names(doc)
|
42
|
-
termexample_anchor_names(doc)
|
43
55
|
end
|
44
56
|
|
45
57
|
# we can reference 0-number clauses in introduction
|
@@ -68,6 +80,7 @@ module IsoDoc
|
|
68
80
|
@anchors[c["id"]] = anchor_struct(i.print, nil, @labels["appendix"],
|
69
81
|
"clause")
|
70
82
|
@anchors[c["id"]][:level] = 2
|
83
|
+
@anchors[c["id"]][:subtype] = "annex"
|
71
84
|
@anchors[c["id"]][:container] = clause["id"]
|
72
85
|
j = Counter.new
|
73
86
|
c.xpath(ns("./clause | ./references")).each do |c1|
|
@@ -78,10 +91,11 @@ module IsoDoc
|
|
78
91
|
end
|
79
92
|
end
|
80
93
|
|
94
|
+
# subclauses are not prefixed with "Clause"
|
95
|
+
# retaining sybtupe for the semantics
|
81
96
|
def section_names1(clause, num, level)
|
82
97
|
@anchors[clause["id"]] =
|
83
|
-
{ label: num, level: level, xref: num }
|
84
|
-
# subclauses are not prefixed with "Clause"
|
98
|
+
{ label: num, level: level, xref: num, subtype: "clause" }
|
85
99
|
i = Counter.new
|
86
100
|
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
87
101
|
"./references"))
|
@@ -92,7 +106,8 @@ module IsoDoc
|
|
92
106
|
end
|
93
107
|
|
94
108
|
def annex_names1(clause, num, level)
|
95
|
-
@anchors[clause["id"]] = { label: num, xref: num, level: level
|
109
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
110
|
+
subtype: "annex" }
|
96
111
|
i = Counter.new
|
97
112
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
98
113
|
i.increment(c)
|
@@ -113,7 +128,7 @@ module IsoDoc
|
|
113
128
|
def hierarchical_formula_names(clause, num)
|
114
129
|
c = IsoDoc::XrefGen::Counter.new
|
115
130
|
clause.xpath(ns(".//formula")).each do |t|
|
116
|
-
next if
|
131
|
+
next if blank?(t["id"])
|
117
132
|
|
118
133
|
@anchors[t["id"]] = anchor_struct(
|
119
134
|
"#{num}#{hiersep}#{c.increment(t).print}", t,
|
@@ -133,13 +148,12 @@ module IsoDoc
|
|
133
148
|
end
|
134
149
|
|
135
150
|
def sequential_figure_names(clause)
|
136
|
-
c = IsoDoc::XrefGen::Counter.new
|
137
151
|
j = 0
|
138
152
|
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
|
139
|
-
.
|
153
|
+
.each_with_object(IsoDoc::XrefGen::Counter.new) do |t, c|
|
140
154
|
j = subfigure_increment(j, c, t)
|
141
155
|
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
142
|
-
next if
|
156
|
+
next if blank?(t["id"])
|
143
157
|
|
144
158
|
figure_anchor(t, sublabel, c.print)
|
145
159
|
end
|
@@ -153,7 +167,7 @@ module IsoDoc
|
|
153
167
|
j = subfigure_increment(j, c, t)
|
154
168
|
label = "#{num}#{hiersep}#{c.print}"
|
155
169
|
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
156
|
-
next if
|
170
|
+
next if blank?(t["id"])
|
157
171
|
|
158
172
|
figure_anchor(t, sublabel, label)
|
159
173
|
end
|
@@ -167,7 +181,13 @@ module IsoDoc
|
|
167
181
|
|
168
182
|
def back_anchor_names(docxml)
|
169
183
|
super
|
170
|
-
|
184
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
185
|
+
docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def annex_name_lbl(clause, num)
|
190
|
+
super.sub(%r{<br/>(.*)$}, "<br/><span class='obligation'>\\1</span>")
|
171
191
|
end
|
172
192
|
end
|
173
193
|
end
|
@@ -527,7 +527,7 @@
|
|
527
527
|
</define>
|
528
528
|
<define name="LocalityType">
|
529
529
|
<data type="string">
|
530
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
530
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
531
531
|
</data>
|
532
532
|
</define>
|
533
533
|
<define name="referenceFrom">
|
@@ -677,6 +677,9 @@
|
|
677
677
|
<zeroOrMore>
|
678
678
|
<ref name="extent"/>
|
679
679
|
</zeroOrMore>
|
680
|
+
<optional>
|
681
|
+
<ref name="bibliographic_size"/>
|
682
|
+
</optional>
|
680
683
|
<zeroOrMore>
|
681
684
|
<ref name="accesslocation"/>
|
682
685
|
</zeroOrMore>
|
@@ -848,17 +851,46 @@
|
|
848
851
|
</define>
|
849
852
|
<define name="bplace">
|
850
853
|
<element name="place">
|
851
|
-
<
|
852
|
-
<
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<group>
|
857
|
+
<ref name="bibliocity"/>
|
858
|
+
<zeroOrMore>
|
859
|
+
<ref name="biblioregion"/>
|
860
|
+
</zeroOrMore>
|
861
|
+
<zeroOrMore>
|
862
|
+
<ref name="bibliocountry"/>
|
863
|
+
</zeroOrMore>
|
864
|
+
</group>
|
865
|
+
</choice>
|
866
|
+
</element>
|
867
|
+
</define>
|
868
|
+
<define name="bibliocity">
|
869
|
+
<element name="city">
|
859
870
|
<text/>
|
860
871
|
</element>
|
861
872
|
</define>
|
873
|
+
<define name="biblioregion">
|
874
|
+
<element name="region">
|
875
|
+
<ref name="RegionType"/>
|
876
|
+
</element>
|
877
|
+
</define>
|
878
|
+
<define name="bibliocountry">
|
879
|
+
<element name="country">
|
880
|
+
<ref name="RegionType"/>
|
881
|
+
</element>
|
882
|
+
</define>
|
883
|
+
<define name="RegionType">
|
884
|
+
<optional>
|
885
|
+
<attribute name="iso"/>
|
886
|
+
</optional>
|
887
|
+
<optional>
|
888
|
+
<attribute name="recommended">
|
889
|
+
<data type="boolean"/>
|
890
|
+
</attribute>
|
891
|
+
</optional>
|
892
|
+
<text/>
|
893
|
+
</define>
|
862
894
|
<define name="bprice">
|
863
895
|
<element name="price">
|
864
896
|
<attribute name="currency"/>
|
@@ -922,9 +954,29 @@
|
|
922
954
|
<text/>
|
923
955
|
</element>
|
924
956
|
</define>
|
957
|
+
<define name="sizevalue">
|
958
|
+
<element name="value">
|
959
|
+
<attribute name="type"/>
|
960
|
+
<text/>
|
961
|
+
</element>
|
962
|
+
</define>
|
963
|
+
<define name="bibliographic_size">
|
964
|
+
<element name="size">
|
965
|
+
<oneOrMore>
|
966
|
+
<ref name="sizevalue"/>
|
967
|
+
</oneOrMore>
|
968
|
+
</element>
|
969
|
+
</define>
|
925
970
|
<define name="extent">
|
926
971
|
<element name="extent">
|
927
|
-
<
|
972
|
+
<choice>
|
973
|
+
<zeroOrMore>
|
974
|
+
<ref name="locality"/>
|
975
|
+
</zeroOrMore>
|
976
|
+
<zeroOrMore>
|
977
|
+
<ref name="localityStack"/>
|
978
|
+
</zeroOrMore>
|
979
|
+
</choice>
|
928
980
|
</element>
|
929
981
|
</define>
|
930
982
|
<define name="series">
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
-
|
4
|
+
<p id="boilerplate-year">© <span class="std_publisher">{{ agency }}</span> <span class="std_docNumber">{{ docyear }}</span></p>
|
5
5
|
|
6
6
|
<p id="boilerplate-message">
|
7
7
|
Droits de reproduction réservés. Sauf indication contraire, ou requise dans le cadre de sa mise en œuvre,
|
@@ -1,9 +1,7 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
-
|
5
|
-
© {{ agency }} {{ docyear }}
|
6
|
-
</p>
|
4
|
+
<p id="boilerplate-year">© <span class="std_publisher">{{ agency }}</span> <span class="std_docNumber">{{ docyear }}</span></p>
|
7
5
|
|
8
6
|
<p id="boilerplate-message">
|
9
7
|
Все права защищены. Если иначе не определено или не требуется в контексте его реализации, никакая часть этой публикации не может быть воспроизведена или использована иначе в любой форме или каким-либо образом, электронным или механическим, включая фотокопирование, или публикацию в Интернете или интранете, без предварительного письменного разрешения. Разрешение может быть запрошено ISO по адресу, указанному ниже, или у органа — члена ISO страны запрашивающего.
|
@@ -1,9 +1,7 @@
|
|
1
1
|
<boilerplate>
|
2
2
|
<copyright-statement>
|
3
3
|
<clause>
|
4
|
-
|
5
|
-
© {{ agency }} {{ docyear }}
|
6
|
-
</p>
|
4
|
+
<p id="boilerplate-year">© <span class="std_publisher">{{ agency }}</span> <span class="std_docNumber">{{ docyear }}</span></p>
|
7
5
|
|
8
6
|
<p id="boilerplate-message">
|
9
7
|
All rights
|
@@ -40,7 +40,8 @@ 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
|
+
prefix << x1
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
@@ -51,10 +52,10 @@ module Metanorma
|
|
51
52
|
id.content = id_prefix(prefix, id)
|
52
53
|
id = xmldoc.at("//bibdata/ext/structuredidentifier/project-number") and
|
53
54
|
id.content = id_prefix(prefix, id)
|
54
|
-
|
55
|
-
id
|
56
|
-
|
57
|
-
|
55
|
+
%w(iso-with-lang iso-reference iso-undated).each do |t|
|
56
|
+
id = xmldoc.at("//bibdata/docidentifier[@type = '#{t}']") and
|
57
|
+
id.content = id_prefix(prefix, id)
|
58
|
+
end
|
58
59
|
end
|
59
60
|
|
60
61
|
def format_ref(ref, type)
|
@@ -140,7 +141,7 @@ module Metanorma
|
|
140
141
|
xmldoc.xpath("//bibitem/note[@type = 'Unpublished-Status']").each do |n|
|
141
142
|
e = xmldoc.at("//eref[@bibitemid = '#{n.parent['id']}']") or next
|
142
143
|
fn = n.children.to_xml
|
143
|
-
n
|
144
|
+
n.elements&.first&.name == "p" or fn = "<p>#{fn}</p>"
|
144
145
|
e.next = "<fn>#{fn}</fn>"
|
145
146
|
end
|
146
147
|
end
|
@@ -73,13 +73,19 @@ module Metanorma
|
|
73
73
|
(!@amd && node.attr("docnumber")) || (@amd && node.attr("updates")) or
|
74
74
|
return
|
75
75
|
|
76
|
-
dn = iso_id1(node)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
dn = id_stage_prefix(iso_id1(node), node)
|
77
|
+
dns = [id_year(dn, node, mode: :default),
|
78
|
+
id_year(dn, node, mode: :force),
|
79
|
+
id_year(dn, node, mode: :strip)]
|
80
|
+
iso_id_out(node, xml, dns)
|
81
|
+
end
|
82
|
+
|
83
|
+
def iso_id_out(node, xml, dns)
|
84
|
+
xml.docidentifier dns[0], **attr_code(type: "ISO")
|
85
|
+
xml.docidentifier dns[2], **attr_code(type: "iso-undated")
|
86
|
+
xml.docidentifier(id_langsuffix(dns[0], node),
|
81
87
|
**attr_code(type: "iso-with-lang"))
|
82
|
-
xml.docidentifier(id_langsuffix(
|
88
|
+
xml.docidentifier(id_langsuffix(dns[1], node),
|
83
89
|
**attr_code(type: "iso-reference"))
|
84
90
|
end
|
85
91
|
|
@@ -160,14 +166,14 @@ module Metanorma
|
|
160
166
|
def cover_stage_abbr(node)
|
161
167
|
stage = get_stage(node)
|
162
168
|
abbr = id_stage_abbr(get_stage(node), get_substage(node), node, true)
|
163
|
-
typeabbr = get_typeabbr(node, true)
|
169
|
+
typeabbr = get_typeabbr(node, amd: true)
|
164
170
|
if stage.to_i > 50 || (stage.to_i == 60 && get_substage(node).to_i < 60)
|
165
171
|
typeabbr = ""
|
166
172
|
end
|
167
173
|
"#{abbr}#{typeabbr}".strip
|
168
174
|
end
|
169
175
|
|
170
|
-
def id_stage_prefix(docnum, node
|
176
|
+
def id_stage_prefix(docnum, node)
|
171
177
|
stage = get_stage(node)
|
172
178
|
typeabbr = get_typeabbr(node)
|
173
179
|
if stage && (stage.to_i < 60)
|
@@ -175,11 +181,22 @@ module Metanorma
|
|
175
181
|
elsif typeabbr == "DIR " then docnum = "#{typeabbr}#{docnum}"
|
176
182
|
elsif typeabbr && !@amd then docnum = "/#{typeabbr}#{docnum}"
|
177
183
|
end
|
178
|
-
(force_year || !(stage && (stage.to_i < 60))) and
|
179
|
-
docnum = id_add_year(docnum, node)
|
180
184
|
docnum
|
181
185
|
end
|
182
186
|
|
187
|
+
def id_year(docnum, node, mode: :default)
|
188
|
+
case mode
|
189
|
+
when :strip then docnum.sub(/:(19|20)\d\d(?!\d)/, "")
|
190
|
+
when :force then id_add_year(docnum, node)
|
191
|
+
else
|
192
|
+
stage = get_stage(node)
|
193
|
+
if stage && (stage.to_i < 60)
|
194
|
+
docnum
|
195
|
+
else id_add_year(docnum, node)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
183
200
|
def unpub_stage_prefix(docnum, stage, typeabbr, node)
|
184
201
|
abbr = id_stage_abbr(stage, get_substage(node), node)
|
185
202
|
%w(40 50).include?(stage) && i = node.attr("iteration") and
|
@@ -213,7 +230,7 @@ module Metanorma
|
|
213
230
|
ret
|
214
231
|
end
|
215
232
|
|
216
|
-
def get_typeabbr(node, amd
|
233
|
+
def get_typeabbr(node, amd: false)
|
217
234
|
case doctype(node)
|
218
235
|
when "directive" then "DIR "
|
219
236
|
when "technical-report" then "TR "
|