metanorma-iso 2.5.3 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -3
- data/lib/isodoc/iso/html/html_iso_titlepage.html +4 -0
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +3 -0
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +3 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +4 -0
- data/lib/isodoc/iso/i18n-en.yaml +1 -0
- 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/init.rb +2 -2
- data/lib/isodoc/iso/iso.amendment.xsl +23 -2
- data/lib/isodoc/iso/iso.international-standard.xsl +23 -2
- data/lib/isodoc/iso/word_dis_cleanup.rb +20 -211
- data/lib/isodoc/iso/word_dis_styles.rb +233 -0
- data/lib/isodoc/iso/xref_section.rb +10 -15
- data/lib/metanorma/iso/basicdoc.rng +38 -35
- data/lib/metanorma/iso/biblio.rng +9 -0
- data/lib/metanorma/iso/boilerplate-fr.adoc +1 -1
- data/lib/metanorma/iso/boilerplate-ru.adoc +1 -1
- data/lib/metanorma/iso/boilerplate.adoc +1 -1
- data/lib/metanorma/iso/front_contributor.rb +46 -63
- data/lib/metanorma/iso/isodoc.rng +27 -1
- data/lib/metanorma/iso/isostandard.rng +3 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb4c2d0b884e8601efbd7d6d0bfa000846b52709fadbd38317e9398493ad8cd0
|
4
|
+
data.tar.gz: 8d7846f9bf8bfc5e684f66542f9ea6a166f99043edc9d982a4e61ad69b0a63a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40264b7b5e2b23244b502f8b0e63a9041ed06dfc6401c86ef3b418de8c38aae94187319f3e28852122b871d06e3fb122286cb575b2e0a6c3e60caaa571ccbc38
|
7
|
+
data.tar.gz: 5f0c03ecba1d00e25764620a02c345486d84b29b419d3749677810cc51672c695f4bab205cfa00d61bc01c59a4dff931209b3855912c90aeded9408c04214939
|
data/Gemfile
CHANGED
@@ -4,10 +4,12 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
group :development, :test do
|
8
|
+
gem "rspec"
|
9
|
+
end
|
10
10
|
|
11
11
|
if File.exist? "Gemfile.devel"
|
12
12
|
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
13
13
|
end
|
14
|
+
|
15
|
+
gemspec
|
@@ -11,6 +11,10 @@
|
|
11
11
|
<p class="coverpage_docnumber">{{ edition_display | capitalize }}</p>
|
12
12
|
{% endif %}
|
13
13
|
|
14
|
+
{% if correcteddate != "XXX" %}
|
15
|
+
<p class="coverpage_docnumber">{{ labels["corrected_version"] }} : {{ correcteddate }}</p>
|
16
|
+
{% endif %}
|
17
|
+
|
14
18
|
{% if revdate %}
|
15
19
|
<p class="coverpage_docnumber">{{ labels["date"]}}: {{ revdate }}</p>
|
16
20
|
{% endif %}
|
@@ -17,6 +17,9 @@
|
|
17
17
|
{% if doc_date %}
|
18
18
|
<p class="zzCover" align="right" style='text-align:right;font-weight:normal;'><span lang="EN-GB">Date: <span style='mso-no-proof:yes'>{{ doc_date }}</span></span></p>
|
19
19
|
{% endif %}
|
20
|
+
{% if correcteddate %}
|
21
|
+
<p class="zzCover">{{ labels["corrected_version"] }}: {{ correcteddate }}</p>
|
22
|
+
{% endif %}
|
20
23
|
|
21
24
|
<p class="zzCover" style='font-weight:normal;'><span lang="EN-GB">Reference number of project: {{ docnumber_undated }}{% if draftinfo %} {{ draftinfo }}{% endif %}</span></p>
|
22
25
|
|
@@ -13,6 +13,9 @@
|
|
13
13
|
{% if doc_date %}
|
14
14
|
<p class="zzCover" align="right" style='text-align:right'><span lang="EN-GB">Date: <span style='mso-no-proof:yes'><b>{{ doc_date }}</b></span></span></p>
|
15
15
|
{% endif %}
|
16
|
+
{% if correcteddate %}
|
17
|
+
<p class="zzCover">{{ labels["corrected_version"] }}: {{ correcteddate }}</p>
|
18
|
+
{% endif %}
|
16
19
|
|
17
20
|
<p class="zzCover" style='font-weight:normal;'><span lang="EN-GB">{{ editorialgroup}}</span></p>
|
18
21
|
|
@@ -33,6 +33,10 @@ style='mso-no-proof:yes'>{{ editorialgroup }}</span></p>
|
|
33
33
|
<p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB">{{ edition_display | capitalize }}</span></p>
|
34
34
|
{% endif %}
|
35
35
|
|
36
|
+
{% if correcteddate %}
|
37
|
+
<p class="MsoNormal" align="right" style='text-align:right'>{{ labels["corrected_version"] }}: {{ correcteddate }}</p>
|
38
|
+
{% endif %}
|
39
|
+
|
36
40
|
{% if revdate %}
|
37
41
|
<p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB">{{ labels["date"] }}: <span style='mso-no-proof:yes'>{{ revdate }}</span></span></p>
|
38
42
|
{% endif %}
|
data/lib/isodoc/iso/i18n-en.yaml
CHANGED
data/lib/isodoc/iso/i18n-fr.yaml
CHANGED
@@ -25,6 +25,7 @@ termsrelated: Termes liés
|
|
25
25
|
availablefrom: Disponible sur
|
26
26
|
voting_begins_on: Le vote commence le
|
27
27
|
voting_terminates_on: Le vote se termine le
|
28
|
+
corrected_version: Version corrigée
|
28
29
|
doctype_dict:
|
29
30
|
international-standard: Norme internationale
|
30
31
|
technical-specification: Spécification technique
|
data/lib/isodoc/iso/i18n-ru.yaml
CHANGED
@@ -26,6 +26,7 @@ termsrelated: Термины, связанные
|
|
26
26
|
availablefrom: Доступна с
|
27
27
|
voting_begins_on: Голосование начинается в
|
28
28
|
voting_terminates_on: Голосование заканчивается в
|
29
|
+
corrected_version: Исправленная версия
|
29
30
|
doctype_dict:
|
30
31
|
international-standard: Международный Стандарт
|
31
32
|
technical-specification: Техническая Спецификация
|
data/lib/isodoc/iso/init.rb
CHANGED
@@ -51,12 +51,12 @@ module IsoDoc
|
|
51
51
|
elsif /\p{Zs}/.match?(i) then i
|
52
52
|
else std_docid_semantic_full(i)
|
53
53
|
end
|
54
|
-
end.join
|
54
|
+
end.join.gsub(%r{</span>(\p{Zs}+)<}, "\\1</span><")
|
55
55
|
end
|
56
56
|
|
57
57
|
def std_docid_semantic_full(ident)
|
58
58
|
ident
|
59
|
-
.sub(/^([^0-9]+)(\
|
59
|
+
.sub(/^([^0-9]+)(\p{Zs}|$)/, "<span class='stdpublisher'>\\1</span>\\2")
|
60
60
|
.sub(/([0-9]+)/, "<span class='stddocNumber'>\\1</span>")
|
61
61
|
.sub(/-([0-9]+)/, "-<span class='stddocPartNumber'>\\1</span>")
|
62
62
|
.sub(/:([0-9]{4})(?!\d)/, ":<span class='stdyear'>\\1</span>")
|
@@ -919,6 +919,18 @@
|
|
919
919
|
</fo:block>
|
920
920
|
</fo:block>
|
921
921
|
</xsl:if>
|
922
|
+
<xsl:variable name="date_corrected" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:date[@type = 'corrected'])"/>
|
923
|
+
<xsl:if test="$date_corrected != ''">
|
924
|
+
<fo:block text-align="right" font-size="9.5pt">
|
925
|
+
<xsl:value-of select="$linebreak"/>
|
926
|
+
<xsl:value-of select="$linebreak"/>
|
927
|
+
<xsl:call-template name="getLocalizedString">
|
928
|
+
<xsl:with-param name="key">corrected_version</xsl:with-param>
|
929
|
+
</xsl:call-template>
|
930
|
+
<xsl:value-of select="$linebreak"/>
|
931
|
+
<xsl:value-of select="$date_corrected"/>
|
932
|
+
</fo:block>
|
933
|
+
</xsl:if>
|
922
934
|
</fo:table-cell>
|
923
935
|
</fo:table-row>
|
924
936
|
<fo:table-row height="17mm" role="SKIP">
|
@@ -6867,8 +6879,17 @@
|
|
6867
6879
|
<xsl:variable name="styles_">
|
6868
6880
|
<xsl:for-each select="xalan:nodeset($styles__)/item">
|
6869
6881
|
<xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
|
6870
|
-
<xsl:variable name="
|
6871
|
-
<xsl:
|
6882
|
+
<xsl:variable name="value_" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
|
6883
|
+
<xsl:variable name="value">
|
6884
|
+
<xsl:choose>
|
6885
|
+
<!-- if font-size is digits only -->
|
6886
|
+
<xsl:when test="$key = 'font-size' and translate($value_, '0123456789', '') = ''"><xsl:value-of select="$value_"/>pt</xsl:when>
|
6887
|
+
<xsl:otherwise>
|
6888
|
+
<xsl:value-of select="$value_"/>
|
6889
|
+
</xsl:otherwise>
|
6890
|
+
</xsl:choose>
|
6891
|
+
</xsl:variable>
|
6892
|
+
<xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
|
6872
6893
|
<style name="{$key}"><xsl:value-of select="$value"/></style>
|
6873
6894
|
</xsl:if>
|
6874
6895
|
</xsl:for-each>
|
@@ -919,6 +919,18 @@
|
|
919
919
|
</fo:block>
|
920
920
|
</fo:block>
|
921
921
|
</xsl:if>
|
922
|
+
<xsl:variable name="date_corrected" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:date[@type = 'corrected'])"/>
|
923
|
+
<xsl:if test="$date_corrected != ''">
|
924
|
+
<fo:block text-align="right" font-size="9.5pt">
|
925
|
+
<xsl:value-of select="$linebreak"/>
|
926
|
+
<xsl:value-of select="$linebreak"/>
|
927
|
+
<xsl:call-template name="getLocalizedString">
|
928
|
+
<xsl:with-param name="key">corrected_version</xsl:with-param>
|
929
|
+
</xsl:call-template>
|
930
|
+
<xsl:value-of select="$linebreak"/>
|
931
|
+
<xsl:value-of select="$date_corrected"/>
|
932
|
+
</fo:block>
|
933
|
+
</xsl:if>
|
922
934
|
</fo:table-cell>
|
923
935
|
</fo:table-row>
|
924
936
|
<fo:table-row height="17mm" role="SKIP">
|
@@ -6867,8 +6879,17 @@
|
|
6867
6879
|
<xsl:variable name="styles_">
|
6868
6880
|
<xsl:for-each select="xalan:nodeset($styles__)/item">
|
6869
6881
|
<xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
|
6870
|
-
<xsl:variable name="
|
6871
|
-
<xsl:
|
6882
|
+
<xsl:variable name="value_" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
|
6883
|
+
<xsl:variable name="value">
|
6884
|
+
<xsl:choose>
|
6885
|
+
<!-- if font-size is digits only -->
|
6886
|
+
<xsl:when test="$key = 'font-size' and translate($value_, '0123456789', '') = ''"><xsl:value-of select="$value_"/>pt</xsl:when>
|
6887
|
+
<xsl:otherwise>
|
6888
|
+
<xsl:value-of select="$value_"/>
|
6889
|
+
</xsl:otherwise>
|
6890
|
+
</xsl:choose>
|
6891
|
+
</xsl:variable>
|
6892
|
+
<xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
|
6872
6893
|
<style name="{$key}"><xsl:value-of select="$value"/></style>
|
6873
6894
|
</xsl:if>
|
6874
6895
|
</xsl:for-each>
|
@@ -1,127 +1,8 @@
|
|
1
|
+
require_relative "word_dis_styles"
|
2
|
+
|
1
3
|
module IsoDoc
|
2
4
|
module Iso
|
3
5
|
class WordDISConvert < WordConvert
|
4
|
-
STYLESMAP = {
|
5
|
-
AltTerms: "AdmittedTerm",
|
6
|
-
TableFootnote: "Tablefootnote",
|
7
|
-
formula: "Formula",
|
8
|
-
note: "Note",
|
9
|
-
example: "Example",
|
10
|
-
admonition: "Admonition",
|
11
|
-
admonitiontitle: "AdmonitionTitle",
|
12
|
-
sourcetitle: "SourceTitle",
|
13
|
-
TableTitle: "Tabletitle",
|
14
|
-
titlepagesbhead: "TablePageSubhead",
|
15
|
-
NormRef: "RefNorm",
|
16
|
-
Biblio: "BiblioEntry",
|
17
|
-
MsoNormal: "MsoBodyText",
|
18
|
-
FigureTitle: "Figuretitle",
|
19
|
-
zzwarning: "zzWarning",
|
20
|
-
zzwarninghdr: "zzWarningHdr",
|
21
|
-
quoteattribution: "QuoteAttribution",
|
22
|
-
Sourcecode: "Code",
|
23
|
-
zzSTDTitle1: "zzSTDTitle",
|
24
|
-
zzSTDTitle2: "zzSTDTitle",
|
25
|
-
zzCopyright1: "zzCopyright",
|
26
|
-
}.freeze
|
27
|
-
|
28
|
-
def new_styles(docxml)
|
29
|
-
STYLESMAP.each do |k, v|
|
30
|
-
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
31
|
-
end
|
32
|
-
docxml.xpath("//h1[@class = 'ForewordTitle' or @class = 'IntroTitle']")
|
33
|
-
.each { |h| h.name = "p" }
|
34
|
-
dis_styles1(docxml)
|
35
|
-
docxml.xpath("//p[not(@class)]").each { |p| p["class"] = "MsoBodyText" }
|
36
|
-
end
|
37
|
-
|
38
|
-
def sourcecode_style
|
39
|
-
"Code"
|
40
|
-
end
|
41
|
-
|
42
|
-
def dis_styles1(docxml)
|
43
|
-
amd_style(docxml)
|
44
|
-
middle_title_style(docxml)
|
45
|
-
code_style(docxml)
|
46
|
-
figure_style(docxml)
|
47
|
-
formula_style(docxml)
|
48
|
-
note_style(docxml)
|
49
|
-
example_style(docxml)
|
50
|
-
dis_style_interactions(docxml)
|
51
|
-
quote_style(docxml)
|
52
|
-
stripbgcolor(docxml)
|
53
|
-
end
|
54
|
-
|
55
|
-
def stripbgcolor(docxml)
|
56
|
-
@bgstripcolor == "true" or return
|
57
|
-
%w(aucollab audeg aufname aurole ausuffix ausurname bibarticle bibetal
|
58
|
-
bibfname bibfpage bibissue bibjournal biblpage bibnumber
|
59
|
-
biborganization bibsuppl bibsurname biburl bibvolume bibyear
|
60
|
-
citebib citeen citefig citefn citetbl bibextlink citeeq citetfn
|
61
|
-
auprefix citeapp citesec stddocNumber stddocPartNumber
|
62
|
-
stddocTitle aumember stdfootnote stdpublisher stdsection stdyear
|
63
|
-
stddocumentType bibalt-year bibbook bbichapterno bibchaptertitle
|
64
|
-
bibed-etal bibed-fname bibeditionno bibed-organization bibed-suffix
|
65
|
-
bibed-surname bibinstitution bibisbn biblocation bibpagecount
|
66
|
-
bibpatent bibpublisher bibreportnum bibschool bibseries bibseriesno
|
67
|
-
bibtrans stdsuppl citesection).each do |t|
|
68
|
-
docxml.xpath("//span[@class = '#{t}']").each do |s|
|
69
|
-
s["style"] ||= ""
|
70
|
-
s["style"] = "mso-pattern:none;#{s['style']}"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def middle_title_style(docxml)
|
76
|
-
docxml.xpath("//p[@class = 'zzSTDTitle2']").each do |p|
|
77
|
-
p1 = p.previous_element && p1.name == p &&
|
78
|
-
p1["class"] = "zzSTDTitle2" or next
|
79
|
-
p1 << " #{p.remove.children.to_xml}"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def dis_style_interactions(docxml)
|
84
|
-
docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or " \
|
85
|
-
"@class = 'Code--']" \
|
86
|
-
"[following::p[@class = 'Examplecontinued']]").each do |p|
|
87
|
-
p["style"] ||= ""
|
88
|
-
p["style"] = "margin-bottom:12pt;#{p['style']}"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def amd_style(docxml)
|
93
|
-
return unless @meta.get[:doctype] == "Amendment"
|
94
|
-
|
95
|
-
docxml.xpath("//div[@class = 'WordSection3']//h1").each do |h|
|
96
|
-
h.name = "p"
|
97
|
-
h["style"] = "font-style:italic;page-break-after:avoid;"
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def para_style_change(div, class1, class2)
|
102
|
-
s = class1 ? "@class = '#{class1}'" : "not(@class)"
|
103
|
-
div.xpath(".//p[#{s}]").each do |p|
|
104
|
-
p["class"] = class2
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def quote_style1(div)
|
109
|
-
para_style_change(div, nil, "BodyTextindent1")
|
110
|
-
para_style_change(div, "Code-", "Code--")
|
111
|
-
para_style_change(div, "Code", "Code-")
|
112
|
-
if div["class"] != "Example"
|
113
|
-
para_style_change(div, "Example", "Exampleindent")
|
114
|
-
para_style_change(div, "Examplecontinued", "Exampleindentcontinued")
|
115
|
-
end
|
116
|
-
if div["class"] != "Note"
|
117
|
-
para_style_change(div, "Note", "Noteindent")
|
118
|
-
para_style_change(div, "Notecontinued", "Noteindentcontinued")
|
119
|
-
end
|
120
|
-
div.xpath(".//table[@class = 'dl']").each do |t|
|
121
|
-
t["style"] = "margin-left: 1cm;"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
6
|
def remove_note_label(doc)
|
126
7
|
doc.xpath("//span[@class = 'note_label' or @class = 'example_label']")
|
127
8
|
.each do |s|
|
@@ -129,83 +10,6 @@ module IsoDoc
|
|
129
10
|
end
|
130
11
|
end
|
131
12
|
|
132
|
-
def note_style(docxml)
|
133
|
-
remove_note_label(docxml)
|
134
|
-
note_continued_style(docxml)
|
135
|
-
end
|
136
|
-
|
137
|
-
def example_style(docxml)
|
138
|
-
example_continued_style(docxml)
|
139
|
-
end
|
140
|
-
|
141
|
-
def example_continued_style(docxml)
|
142
|
-
docxml.xpath("//div[@class = 'Example']").each do |d|
|
143
|
-
d.xpath("./p").each_with_index do |p, i|
|
144
|
-
next if p["class"] && p["class"] != "Example"
|
145
|
-
|
146
|
-
p["class"] = (i.zero? ? "Example" : "Examplecontinued")
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def note_continued_style(docxml)
|
152
|
-
docxml.xpath("//div[@class = 'Note']").each do |d|
|
153
|
-
d.xpath("./p").each_with_index do |p, i|
|
154
|
-
next if p["class"] && p["class"] != "Note"
|
155
|
-
|
156
|
-
p["class"] = (i.zero? ? "Note" : "Notecontinued")
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
FIGURE_NESTED_STYLES =
|
162
|
-
{ Note: "Figurenote", example: "Figureexample" }.freeze
|
163
|
-
|
164
|
-
def figure_style(docxml)
|
165
|
-
docxml.xpath("//div[@class = 'figure']").each do |f|
|
166
|
-
FIGURE_NESTED_STYLES.each do |k, v|
|
167
|
-
f.xpath(".//*[@class = '#{k}']").each { |n| n["class"] = v }
|
168
|
-
end
|
169
|
-
f.xpath("./img").each do |i|
|
170
|
-
i.replace("<p class='FigureGraphic'>#{i.to_xml}</p>")
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
def formula_style(docxml)
|
176
|
-
docxml.xpath("//div[@class = 'Formula']").each do |f|
|
177
|
-
f.xpath(".//p[not(@class)]").each do |p|
|
178
|
-
p["class"] = "Formula"
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def code_style(doc)
|
184
|
-
span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
|
185
|
-
"ISOCodebold")
|
186
|
-
span_style((doc.xpath("//tt//i") - doc.xpath("//tt//b//i")),
|
187
|
-
"ISOCodeitalic")
|
188
|
-
span_style((doc.xpath("//b//tt") - doc.xpath("//b//i//tt")),
|
189
|
-
"ISOCodebold")
|
190
|
-
span_style((doc.xpath("//i//tt") - doc.xpath("//i//b//tt")),
|
191
|
-
"ISOCodeitalic")
|
192
|
-
span_style(doc.xpath("//tt"), "ISOCode")
|
193
|
-
end
|
194
|
-
|
195
|
-
def span_style(xpath, style)
|
196
|
-
xpath.each do |elem|
|
197
|
-
elem.name = "span"
|
198
|
-
elem["class"] = style
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
def word_annex_cleanup1(docxml, lvl)
|
203
|
-
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
204
|
-
h2.name = "p"
|
205
|
-
h2["class"] = "a#{lvl}"
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
13
|
def word_cleanup(docxml)
|
210
14
|
word_table_cell_para(docxml)
|
211
15
|
super
|
@@ -229,19 +33,24 @@ module IsoDoc
|
|
229
33
|
end
|
230
34
|
end
|
231
35
|
|
232
|
-
def
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
36
|
+
def stripbgcolor(docxml)
|
37
|
+
@bgstripcolor == "true" or return
|
38
|
+
%w(aucollab audeg aufname aurole ausuffix ausurname bibarticle bibetal
|
39
|
+
bibfname bibfpage bibissue bibjournal biblpage bibnumber
|
40
|
+
biborganization bibsuppl bibsurname biburl bibvolume bibyear
|
41
|
+
citebib citeen citefig citefn citetbl bibextlink citeeq citetfn
|
42
|
+
auprefix citeapp citesec stddocNumber stddocPartNumber
|
43
|
+
stddocTitle aumember stdfootnote stdpublisher stdsection stdyear
|
44
|
+
stddocumentType bibalt-year bibbook bbichapterno bibchaptertitle
|
45
|
+
bibed-etal bibed-fname bibeditionno bibed-organization bibed-suffix
|
46
|
+
bibed-surname bibinstitution bibisbn biblocation bibpagecount
|
47
|
+
bibpatent bibpublisher bibreportnum bibschool bibseries bibseriesno
|
48
|
+
bibtrans stdsuppl citesection).each do |t|
|
49
|
+
docxml.xpath("//span[@class = '#{t}']").each do |s|
|
50
|
+
s["style"] ||= ""
|
51
|
+
s["style"] = "mso-pattern:none;#{s['style']}"
|
52
|
+
end
|
53
|
+
end
|
245
54
|
end
|
246
55
|
end
|
247
56
|
end
|
@@ -0,0 +1,233 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
class WordDISConvert < WordConvert
|
4
|
+
STYLESMAP = {
|
5
|
+
AltTerms: "AdmittedTerm",
|
6
|
+
TableFootnote: "Tablefootnote",
|
7
|
+
formula: "Formula",
|
8
|
+
note: "Note",
|
9
|
+
example: "Example",
|
10
|
+
admonition: "Admonition",
|
11
|
+
admonitiontitle: "AdmonitionTitle",
|
12
|
+
sourcetitle: "SourceTitle",
|
13
|
+
TableTitle: "Tabletitle",
|
14
|
+
titlepagesbhead: "TablePageSubhead",
|
15
|
+
NormRef: "RefNorm",
|
16
|
+
Biblio: "BiblioEntry",
|
17
|
+
MsoNormal: "MsoBodyText",
|
18
|
+
FigureTitle: "Figuretitle",
|
19
|
+
zzwarning: "zzWarning",
|
20
|
+
zzwarninghdr: "zzWarningHdr",
|
21
|
+
quoteattribution: "QuoteAttribution",
|
22
|
+
Sourcecode: "Code",
|
23
|
+
zzSTDTitle1: "zzSTDTitle",
|
24
|
+
zzSTDTitle2: "zzSTDTitle",
|
25
|
+
zzCopyright1: "zzCopyright",
|
26
|
+
}.freeze
|
27
|
+
|
28
|
+
def new_styles(docxml)
|
29
|
+
STYLESMAP.each do |k, v|
|
30
|
+
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
31
|
+
end
|
32
|
+
docxml.xpath("//h1[@class = 'ForewordTitle' or @class = 'IntroTitle']")
|
33
|
+
.each { |h| h.name = "p" }
|
34
|
+
dis_styles1(docxml)
|
35
|
+
docxml.xpath("//p[not(@class)]").each { |p| p["class"] = "MsoBodyText" }
|
36
|
+
stripbgcolor(docxml)
|
37
|
+
end
|
38
|
+
|
39
|
+
def sourcecode_style
|
40
|
+
"Code"
|
41
|
+
end
|
42
|
+
|
43
|
+
def dis_styles1(docxml)
|
44
|
+
amd_style(docxml)
|
45
|
+
middle_title_style(docxml)
|
46
|
+
code_style(docxml)
|
47
|
+
figure_style(docxml)
|
48
|
+
formula_style(docxml)
|
49
|
+
note_style(docxml)
|
50
|
+
example_style(docxml)
|
51
|
+
dis_style_interactions(docxml)
|
52
|
+
quote_style(docxml)
|
53
|
+
smaller_code_style(docxml)
|
54
|
+
end
|
55
|
+
|
56
|
+
def middle_title_style(docxml)
|
57
|
+
docxml.xpath("//p[@class = 'zzSTDTitle2']").each do |p|
|
58
|
+
p1 = p.previous_element && p1.name == p &&
|
59
|
+
p1["class"] = "zzSTDTitle2" or next
|
60
|
+
p1 << " #{p.remove.children.to_xml}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def dis_style_interactions(docxml)
|
65
|
+
docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or " \
|
66
|
+
"@class = 'Code--']" \
|
67
|
+
"[following::p[@class = 'Examplecontinued']]").each do |p|
|
68
|
+
p["style"] ||= ""
|
69
|
+
p["style"] = "margin-bottom:12pt;#{p['style']}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def amd_style(docxml)
|
74
|
+
@meta.get[:doctype] == "Amendment" or return
|
75
|
+
docxml.xpath("//div[@class = 'WordSection3']//h1").each do |h|
|
76
|
+
h.name = "p"
|
77
|
+
h["style"] = "font-style:italic;page-break-after:avoid;"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def para_style_change(div, class1, class2)
|
82
|
+
s = class1 ? "@class = '#{class1}'" : "not(@class)"
|
83
|
+
div.xpath(".//p[#{s}]").each do |p|
|
84
|
+
p["class"] = class2
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def quote_style1(div)
|
89
|
+
para_style_change(div, nil, "BodyTextindent1")
|
90
|
+
para_style_change(div, "Code-", "Code--")
|
91
|
+
para_style_change(div, "Code", "Code-")
|
92
|
+
if div["class"] != "Example"
|
93
|
+
para_style_change(div, "Example", "Exampleindent")
|
94
|
+
para_style_change(div, "Examplecontinued", "Exampleindentcontinued")
|
95
|
+
end
|
96
|
+
if div["class"] != "Note"
|
97
|
+
para_style_change(div, "Note", "Noteindent")
|
98
|
+
para_style_change(div, "Notecontinued", "Noteindentcontinued")
|
99
|
+
end
|
100
|
+
div.xpath(".//table[@class = 'dl']").each do |t|
|
101
|
+
t["style"] = "margin-left: 1cm;"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def note_style(docxml)
|
106
|
+
remove_note_label(docxml)
|
107
|
+
note_continued_style(docxml)
|
108
|
+
end
|
109
|
+
|
110
|
+
def example_style(docxml)
|
111
|
+
example_continued_style(docxml)
|
112
|
+
end
|
113
|
+
|
114
|
+
def example_continued_style(docxml)
|
115
|
+
docxml.xpath("//div[@class = 'Example']").each do |d|
|
116
|
+
d.xpath("./p").each_with_index do |p, i|
|
117
|
+
p["class"] && p["class"] != "Example" and next
|
118
|
+
p["class"] = (i.zero? ? "Example" : "Examplecontinued")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def note_continued_style(docxml)
|
124
|
+
docxml.xpath("//div[@class = 'Note']").each do |d|
|
125
|
+
d.xpath("./p").each_with_index do |p, i|
|
126
|
+
p["class"] && p["class"] != "Note" and next
|
127
|
+
p["class"] = (i.zero? ? "Note" : "Notecontinued")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
FIGURE_NESTED_STYLES =
|
133
|
+
{ Note: "Figurenote", example: "Figureexample" }.freeze
|
134
|
+
|
135
|
+
def figure_style(docxml)
|
136
|
+
docxml.xpath("//div[@class = 'figure']").each do |f|
|
137
|
+
FIGURE_NESTED_STYLES.each do |k, v|
|
138
|
+
f.xpath(".//*[@class = '#{k}']").each { |n| n["class"] = v }
|
139
|
+
end
|
140
|
+
f.xpath("./img").each do |i|
|
141
|
+
i.replace("<p class='FigureGraphic'>#{i.to_xml}</p>")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def formula_style(docxml)
|
147
|
+
docxml.xpath("//div[@class = 'Formula']").each do |f|
|
148
|
+
f.xpath(".//p[not(@class)]").each do |p|
|
149
|
+
p["class"] = "Formula"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def code_style(doc)
|
155
|
+
span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
|
156
|
+
"ISOCodebold")
|
157
|
+
span_style((doc.xpath("//tt//i") - doc.xpath("//tt//b//i")),
|
158
|
+
"ISOCodeitalic")
|
159
|
+
span_style((doc.xpath("//b//tt") - doc.xpath("//b//i//tt")),
|
160
|
+
"ISOCodebold")
|
161
|
+
span_style((doc.xpath("//i//tt") - doc.xpath("//i//b//tt")),
|
162
|
+
"ISOCodeitalic")
|
163
|
+
span_style(doc.xpath("//tt"), "ISOCode")
|
164
|
+
end
|
165
|
+
|
166
|
+
def span_style(xpath, style)
|
167
|
+
xpath.each do |elem|
|
168
|
+
elem.name = "span"
|
169
|
+
elem["class"] = style
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def smaller_code_style(doc)
|
174
|
+
smaller_code_style_names(doc)
|
175
|
+
smaller_code_style_names2spans(doc)
|
176
|
+
end
|
177
|
+
|
178
|
+
# TODO read $smallerfonsize from CSS definitions
|
179
|
+
SMALL_FONT_CLASSES =
|
180
|
+
%w(pseudocode Note tablefootnote figdl MsoISOTable MsoTableGrid
|
181
|
+
TableISO Example Notecontinued Noteindent Noteindentcontinued
|
182
|
+
ListNumber5- ListContinue5- BodyTextIndent22 BodyTextIndent32
|
183
|
+
Exampleindent2 Exampleindent2continued Noteindent2continued
|
184
|
+
Noteindent2 example_label note_label Tablebody MsoNormalTable).freeze
|
185
|
+
|
186
|
+
INLINE_CODE_CLASSES = %w(ISOCodebold ISOCodeitalic ISOCode).freeze
|
187
|
+
|
188
|
+
def smaller_code_style_names(doc)
|
189
|
+
klass = SMALL_FONT_CLASSES.map { |x| "@class = '#{x}'" }.join(" or ")
|
190
|
+
doc.xpath("//*[#{klass}]") - doc.xpath("//*[#{klass}]//*[#{klass}]")
|
191
|
+
.each do |d|
|
192
|
+
INLINE_CODE_CLASSES.each do |n|
|
193
|
+
d.xpath(".//span[@class = '#{n}']").each do |s|
|
194
|
+
s["class"] += "-"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def smaller_code_style_names2spans(doc)
|
201
|
+
INLINE_CODE_CLASSES.each do |n|
|
202
|
+
doc.xpath("//span[@class = '#{n}-']").each do |s|
|
203
|
+
s["class"] = n
|
204
|
+
s.children =
|
205
|
+
"<span style='font-size: 9pt;'>#{s.children.to_xml}</span>"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def word_annex_cleanup1(docxml, lvl)
|
211
|
+
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
212
|
+
h2.name = "p"
|
213
|
+
h2["class"] = "a#{lvl}"
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def word_table_cell_para_style(cell)
|
218
|
+
ret = cell["header"] == "true" ? "Tableheader" : "Tablebody"
|
219
|
+
cell["class"] == "rouge-code" and ret = "Code"
|
220
|
+
ret
|
221
|
+
end
|
222
|
+
|
223
|
+
def table_toc_class
|
224
|
+
["Table title", "Tabletitle", "Annex Table Title", "AnnexTableTitle"] +
|
225
|
+
super
|
226
|
+
end
|
227
|
+
|
228
|
+
def figure_toc_class
|
229
|
+
["Figure Title", "Annex Figure Title", "AnnexFigureTitle"] + super
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -7,10 +7,9 @@ module IsoDoc
|
|
7
7
|
clause.at(ns("./clause")) and
|
8
8
|
@anchors[clause["id"]] = { label: nil, level: 1, type: "clause",
|
9
9
|
xref: clause.at(ns("./title"))&.text }
|
10
|
-
i = Counter.new
|
10
|
+
i = Counter.new(0, prefix: "0.")
|
11
11
|
clause.xpath(ns("./clause")).each do |c|
|
12
|
-
i.increment(c)
|
13
|
-
section_names1(c, "0.#{i.print}", 2)
|
12
|
+
section_names1(c, i.increment(c).print, 2)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -27,10 +26,9 @@ module IsoDoc
|
|
27
26
|
anchor_struct(i.print, nil, @labels["appendix"],
|
28
27
|
"clause").merge(level: 2, subtype: "annex",
|
29
28
|
container: clause["id"])
|
30
|
-
j = Counter.new
|
29
|
+
j = Counter.new(0, prefix: "#{i.print}.")
|
31
30
|
c.xpath(ns("./clause | ./references")).each do |c1|
|
32
|
-
j.increment(c1)
|
33
|
-
lbl = "#{@labels['appendix']} #{i.print}.#{j.print}"
|
31
|
+
lbl = "#{@labels['appendix']} #{j.increment(c1).print}"
|
34
32
|
appendix_names1(c1, l10n(lbl), 3, clause["id"])
|
35
33
|
end
|
36
34
|
end
|
@@ -41,32 +39,29 @@ module IsoDoc
|
|
41
39
|
def section_names1(clause, num, level)
|
42
40
|
@anchors[clause["id"]] =
|
43
41
|
{ label: num, level: level, xref: num, subtype: "clause" }
|
44
|
-
i = Counter.new
|
42
|
+
i = Counter.new(0, prefix: "#{num}.")
|
45
43
|
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | " \
|
46
44
|
"./references"))
|
47
45
|
.each do |c|
|
48
|
-
i.increment(c)
|
49
|
-
section_names1(c, "#{num}.#{i.print}", level + 1)
|
46
|
+
section_names1(c, i.increment(c).print, level + 1)
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
53
50
|
def annex_names1(clause, num, level)
|
54
51
|
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
55
52
|
subtype: "annex" }
|
56
|
-
i = Counter.new
|
53
|
+
i = Counter.new(0, prefix: "#{num}.")
|
57
54
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
58
|
-
i.increment(c)
|
59
|
-
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
55
|
+
annex_names1(c, i.increment(c).print, level + 1)
|
60
56
|
end
|
61
57
|
end
|
62
58
|
|
63
59
|
def appendix_names1(clause, num, level, container)
|
64
60
|
@anchors[clause["id"]] = { label: num, xref: num, level: level,
|
65
61
|
container: container }
|
66
|
-
i = Counter.new
|
62
|
+
i = Counter.new(0, prefix: "#{num}.")
|
67
63
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
68
|
-
i.increment(c)
|
69
|
-
appendix_names1(c, "#{num}.#{i.print}", level + 1, container)
|
64
|
+
appendix_names1(c, i.increment(c).print, level + 1, container)
|
70
65
|
end
|
71
66
|
end
|
72
67
|
|
@@ -914,44 +914,47 @@
|
|
914
914
|
-->
|
915
915
|
<define name="image">
|
916
916
|
<element name="image">
|
917
|
-
<
|
918
|
-
|
917
|
+
<ref name="Image"/>
|
918
|
+
</element>
|
919
|
+
</define>
|
920
|
+
<define name="Image">
|
921
|
+
<attribute name="id">
|
922
|
+
<data type="ID"/>
|
923
|
+
</attribute>
|
924
|
+
<attribute name="src">
|
925
|
+
<data type="anyURI"/>
|
926
|
+
</attribute>
|
927
|
+
<attribute name="mimetype"/>
|
928
|
+
<optional>
|
929
|
+
<attribute name="filename"/>
|
930
|
+
</optional>
|
931
|
+
<optional>
|
932
|
+
<attribute name="width">
|
933
|
+
<choice>
|
934
|
+
<data type="int"/>
|
935
|
+
<value>auto</value>
|
936
|
+
</choice>
|
919
937
|
</attribute>
|
920
|
-
|
938
|
+
</optional>
|
939
|
+
<optional>
|
940
|
+
<attribute name="height">
|
941
|
+
<choice>
|
942
|
+
<data type="int"/>
|
943
|
+
<value>auto</value>
|
944
|
+
</choice>
|
945
|
+
</attribute>
|
946
|
+
</optional>
|
947
|
+
<optional>
|
948
|
+
<attribute name="alt"/>
|
949
|
+
</optional>
|
950
|
+
<optional>
|
951
|
+
<attribute name="title"/>
|
952
|
+
</optional>
|
953
|
+
<optional>
|
954
|
+
<attribute name="longdesc">
|
921
955
|
<data type="anyURI"/>
|
922
956
|
</attribute>
|
923
|
-
|
924
|
-
<optional>
|
925
|
-
<attribute name="filename"/>
|
926
|
-
</optional>
|
927
|
-
<optional>
|
928
|
-
<attribute name="width">
|
929
|
-
<choice>
|
930
|
-
<data type="int"/>
|
931
|
-
<value>auto</value>
|
932
|
-
</choice>
|
933
|
-
</attribute>
|
934
|
-
</optional>
|
935
|
-
<optional>
|
936
|
-
<attribute name="height">
|
937
|
-
<choice>
|
938
|
-
<data type="int"/>
|
939
|
-
<value>auto</value>
|
940
|
-
</choice>
|
941
|
-
</attribute>
|
942
|
-
</optional>
|
943
|
-
<optional>
|
944
|
-
<attribute name="alt"/>
|
945
|
-
</optional>
|
946
|
-
<optional>
|
947
|
-
<attribute name="title"/>
|
948
|
-
</optional>
|
949
|
-
<optional>
|
950
|
-
<attribute name="longdesc">
|
951
|
-
<data type="anyURI"/>
|
952
|
-
</attribute>
|
953
|
-
</optional>
|
954
|
-
</element>
|
957
|
+
</optional>
|
955
958
|
</define>
|
956
959
|
<define name="video">
|
957
960
|
<element name="video">
|
@@ -348,6 +348,9 @@
|
|
348
348
|
<zeroOrMore>
|
349
349
|
<ref name="contact"/>
|
350
350
|
</zeroOrMore>
|
351
|
+
<optional>
|
352
|
+
<ref name="logo"/>
|
353
|
+
</optional>
|
351
354
|
</element>
|
352
355
|
</define>
|
353
356
|
<define name="orgname">
|
@@ -366,6 +369,11 @@
|
|
366
369
|
</choice>
|
367
370
|
</element>
|
368
371
|
</define>
|
372
|
+
<define name="logo">
|
373
|
+
<element name="logo">
|
374
|
+
<ref name="image"/>
|
375
|
+
</element>
|
376
|
+
</define>
|
369
377
|
<define name="NameWithVariants">
|
370
378
|
<element name="primary">
|
371
379
|
<ref name="LocalizedString"/>
|
@@ -942,6 +950,7 @@
|
|
942
950
|
<value>obsoleted</value>
|
943
951
|
<value>confirmed</value>
|
944
952
|
<value>updated</value>
|
953
|
+
<value>corrected</value>
|
945
954
|
<value>issued</value>
|
946
955
|
<value>transmitted</value>
|
947
956
|
<value>copied</value>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
=== {% if stage_int >= 40 %}DOCUMENT PROTÉGÉ PAR COPYRIGHT{%else%}{blank}{%endif%}
|
3
3
|
|
4
4
|
[[boilerplate-year]]
|
5
|
-
© span:std_publisher:[{{ agency }}]
|
5
|
+
© span:std_publisher:[{{ agency }}] span:std_docNumber[{{ docyear }}]
|
6
6
|
|
7
7
|
[[boilerplate-message]]
|
8
8
|
Droits de reproduction réservés. Sauf indication contraire, ou requise dans le cadre de sa mise en œuvre,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
=== {% if stage_int >= 40 %}ДОКУМЕНТ, ОХРАНЯЕМЫЙ АВТОРСКИМ ПРАВОМ{% else %}{blank}{% endif %}
|
4
4
|
|
5
5
|
[[boilerplate-year]]
|
6
|
-
© span:std_publisher[{{ agency }}]
|
6
|
+
© span:std_publisher[{{ agency }}] span:std_docNumber[{{ docyear }}]
|
7
7
|
|
8
8
|
[[boilerplate-message]]
|
9
9
|
Все права защищены. Если иначе не определено или не требуется в контексте его реализации, никакая часть этой публикации не может быть воспроизведена или использована иначе в любой форме или каким-либо образом, электронным или механическим, включая фотокопирование, или публикацию в Интернете или интранете, без предварительного письменного разрешения. Разрешение может быть запрошено ISO по адресу, указанному ниже, или у органа — члена ISO страны запрашивающего.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
=== {% if stage_int >= 40 %}COPYRIGHT PROTECTED DOCUMENT{% else %}{blank}{% endif %}
|
4
4
|
|
5
5
|
[[boilerplate-year]]
|
6
|
-
© span:std_publisher[{{ agency }}]
|
6
|
+
© span:std_publisher[{{ agency }}] span:std_docNumber[{{ docyear }}]
|
7
7
|
|
8
8
|
[[boilerplate-message]]
|
9
9
|
All rights reserved. Unless otherwise specified, or required in the context of its implementation,
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Metanorma
|
2
2
|
module ISO
|
3
3
|
class Converter < Standoc::Converter
|
4
|
-
def home_agency
|
4
|
+
# def home_agency
|
5
|
+
# "ISO"
|
6
|
+
# end
|
7
|
+
|
8
|
+
def default_publisher
|
5
9
|
"ISO"
|
6
10
|
end
|
7
11
|
|
@@ -11,47 +15,40 @@ module Metanorma
|
|
11
15
|
end
|
12
16
|
|
13
17
|
def metadata_author(node, xml)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
xml.contributor do |c|
|
25
|
-
c.role type: opt[:role] do |r|
|
26
|
-
opt[:desc] and r << opt[:desc]
|
27
|
-
end
|
28
|
-
c.organization do |a|
|
29
|
-
(opt[:committee] and
|
30
|
-
contrib_committee_build(a, opt[:agency],
|
31
|
-
{ name: p, id: opt[:ident] })) or
|
32
|
-
organization(a, p, opt[:role] == "publisher", node,
|
33
|
-
opt[:default_org])
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
18
|
+
org_contributor(node, xml,
|
19
|
+
{ source: ["publisher", "pub"], role: "author",
|
20
|
+
default: default_publisher })
|
21
|
+
committee_contributors(node, xml, false, default_publisher)
|
22
|
+
end
|
23
|
+
|
24
|
+
def org_organization(node, xml, org)
|
25
|
+
org[:committee] and
|
26
|
+
contrib_committee_build(xml, org[:agency], org) or
|
27
|
+
super
|
37
28
|
end
|
38
29
|
|
39
30
|
def committee_contributors(node, xml, approval, agency)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
default_org: false, committee: true, agency: agency,
|
48
|
-
desc: v.sub(/^approval-/, "").gsub("-", " ").capitalize }
|
49
|
-
)
|
31
|
+
metadata_approval_committee_types(approval ? node : nil).each do |v|
|
32
|
+
node.attr("#{v}-number") or next
|
33
|
+
node.attr(v) or node.set_attr(v, "")
|
34
|
+
o = { source: [v], role: approval ? "authorizer" : "author",
|
35
|
+
default_org: false, committee: true, agency: agency,
|
36
|
+
desc: v.sub(/^approval-/, "").gsub("-", " ").capitalize }
|
37
|
+
org_contributor(node, xml, o)
|
50
38
|
end
|
51
|
-
approval
|
52
|
-
|
53
|
-
|
54
|
-
|
39
|
+
approval or committee_contributors_approval(node, xml, agency)
|
40
|
+
end
|
41
|
+
|
42
|
+
def committee_contributors_approval(node, xml, agency)
|
43
|
+
o = { name: agency, role: "authorizer", default_org: false,
|
44
|
+
desc: "Agency", committee: false }
|
45
|
+
org_contributor(node, xml, o)
|
46
|
+
end
|
47
|
+
|
48
|
+
def extract_org_attrs_complex(node, opts, source, suffix)
|
49
|
+
n = node.attr("#{source}-number#{suffix}")
|
50
|
+
t = committee_abbrev(node.attr("#{source}-type#{suffix}"), n, source)
|
51
|
+
super.merge(ident: t).compact
|
55
52
|
end
|
56
53
|
|
57
54
|
def contrib_committee_build(xml, agency, committee)
|
@@ -59,7 +56,7 @@ module Metanorma
|
|
59
56
|
xml.name agency
|
60
57
|
xml.subdivision committee[:name]
|
61
58
|
committee[:abbr] and xml.abbreviation committee[:abbr]
|
62
|
-
committee[:
|
59
|
+
committee[:ident] and xml.identifier committee[:ident]
|
63
60
|
end
|
64
61
|
|
65
62
|
COMMITTEE_ABBREVS =
|
@@ -72,32 +69,18 @@ module Metanorma
|
|
72
69
|
"#{type} #{number}".strip
|
73
70
|
end
|
74
71
|
|
72
|
+
def org_attrs_parse(node, opts)
|
73
|
+
super&.map do |x|
|
74
|
+
x.merge(agency: opts[:agency], abbr: opts[:abbr],
|
75
|
+
committee: opts[:committee], default_org: opts[:default_org])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
75
79
|
def metadata_publisher(node, xml)
|
76
|
-
|
77
|
-
metadata_contrib_sdo(node, xml, publishers,
|
78
|
-
{ role: "publisher",
|
79
|
-
default_org: !node.attr("publisher") })
|
80
|
+
super
|
80
81
|
# approvals
|
81
82
|
committee_contributors(node, xml, true,
|
82
|
-
node.attr("approval-agency") ||
|
83
|
-
end
|
84
|
-
|
85
|
-
def metadata_copyright(node, xml)
|
86
|
-
publishers = node.attr("copyright-holder") || node.attr("publisher") ||
|
87
|
-
home_agency
|
88
|
-
csv_split(publishers).each do |p|
|
89
|
-
xml.copyright do |c|
|
90
|
-
c.from (node.attr("copyright-year") || Date.today.year)
|
91
|
-
c.owner do |owner|
|
92
|
-
owner.organization do |o|
|
93
|
-
organization(
|
94
|
-
o, p, true, node,
|
95
|
-
!(node.attr("copyright-holder") || node.attr("publisher"))
|
96
|
-
)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
83
|
+
node.attr("approval-agency") || default_publisher)
|
101
84
|
end
|
102
85
|
|
103
86
|
def metadata_committee(node, xml)
|
@@ -134,7 +117,7 @@ module Metanorma
|
|
134
117
|
end
|
135
118
|
|
136
119
|
def metadata_approval_agency(xml, list)
|
137
|
-
list = [
|
120
|
+
list = [default_publisher] if list.nil? || list.empty?
|
138
121
|
list.each do |v|
|
139
122
|
xml.agency v
|
140
123
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.8 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -1054,6 +1054,17 @@
|
|
1054
1054
|
<ref name="date_inline"/>
|
1055
1055
|
</choice>
|
1056
1056
|
</define>
|
1057
|
+
<define name="PureTextElement" combine="choice">
|
1058
|
+
<ref name="passthrough_inline"/>
|
1059
|
+
</define>
|
1060
|
+
<define name="passthrough_inline">
|
1061
|
+
<element name="passthrough">
|
1062
|
+
<optional>
|
1063
|
+
<attribute name="formats"/>
|
1064
|
+
</optional>
|
1065
|
+
<text/>
|
1066
|
+
</element>
|
1067
|
+
</define>
|
1057
1068
|
<define name="add">
|
1058
1069
|
<element name="add">
|
1059
1070
|
<choice>
|
@@ -1092,6 +1103,9 @@
|
|
1092
1103
|
<optional>
|
1093
1104
|
<attribute name="style"/>
|
1094
1105
|
</optional>
|
1106
|
+
<optional>
|
1107
|
+
<attribute name="custom-charset"/>
|
1108
|
+
</optional>
|
1095
1109
|
<oneOrMore>
|
1096
1110
|
<ref name="TextElement"/>
|
1097
1111
|
</oneOrMore>
|
@@ -1394,6 +1408,9 @@
|
|
1394
1408
|
<optional>
|
1395
1409
|
<attribute name="number"/>
|
1396
1410
|
</optional>
|
1411
|
+
<optional>
|
1412
|
+
<attribute name="branch-number"/>
|
1413
|
+
</optional>
|
1397
1414
|
<optional>
|
1398
1415
|
<attribute name="obligation">
|
1399
1416
|
<choice>
|
@@ -1617,6 +1634,9 @@
|
|
1617
1634
|
<optional>
|
1618
1635
|
<attribute name="number"/>
|
1619
1636
|
</optional>
|
1637
|
+
<optional>
|
1638
|
+
<attribute name="branch-number"/>
|
1639
|
+
</optional>
|
1620
1640
|
<optional>
|
1621
1641
|
<attribute name="type"/>
|
1622
1642
|
</optional>
|
@@ -1668,6 +1688,9 @@
|
|
1668
1688
|
<optional>
|
1669
1689
|
<attribute name="number"/>
|
1670
1690
|
</optional>
|
1691
|
+
<optional>
|
1692
|
+
<attribute name="branch-number"/>
|
1693
|
+
</optional>
|
1671
1694
|
<optional>
|
1672
1695
|
<ref name="section-title"/>
|
1673
1696
|
</optional>
|
@@ -1765,6 +1788,9 @@
|
|
1765
1788
|
<optional>
|
1766
1789
|
<attribute name="number"/>
|
1767
1790
|
</optional>
|
1791
|
+
<optional>
|
1792
|
+
<attribute name="branch-number"/>
|
1793
|
+
</optional>
|
1768
1794
|
<optional>
|
1769
1795
|
<attribute name="obligation">
|
1770
1796
|
<choice>
|
data/metanorma-iso.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
33
33
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
34
34
|
|
35
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
35
|
+
spec.add_dependency "metanorma-standoc", "~> 2.7.0"
|
36
36
|
spec.add_dependency "mnconvert", "~> 1.14"
|
37
37
|
spec.add_dependency "pubid-iso", "~> 0.6.0"
|
38
38
|
spec.add_dependency "ruby-jing"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mnconvert
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -361,6 +361,7 @@ files:
|
|
361
361
|
- lib/isodoc/iso/word_convert.rb
|
362
362
|
- lib/isodoc/iso/word_dis_cleanup.rb
|
363
363
|
- lib/isodoc/iso/word_dis_convert.rb
|
364
|
+
- lib/isodoc/iso/word_dis_styles.rb
|
364
365
|
- lib/isodoc/iso/xref.rb
|
365
366
|
- lib/isodoc/iso/xref_section.rb
|
366
367
|
- lib/metanorma-iso.rb
|