metanorma-jis 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/jis/base_convert.rb +2 -2
- data/lib/isodoc/jis/jis.international-standard.xsl +59 -33
- data/lib/isodoc/jis/presentation_xml_convert.rb +0 -17
- data/lib/isodoc/jis/word_convert.rb +2 -2
- data/lib/isodoc/jis/xref.rb +36 -11
- data/lib/metanorma/jis/front.rb +106 -18
- data/lib/metanorma/jis/isodoc.rng +4 -1
- data/lib/metanorma/jis/version.rb +1 -1
- data/metanorma-jis.gemspec +1 -3
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4366e5bb7877d5bf27560046213279fdac21ff1b21a7cfcf2cb1456f39a03091
|
|
4
|
+
data.tar.gz: fdc359c5a0d15c34f767b6d7529a6837ef5e9b8a394edfeed15c9e6726e9f4b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92ccc85ff096d361680d9736b684adc199547be3a4edabdcbd923b1ff5d03af47f255ebc33602efc5b2d03085d2aa0a09f064dfec756e8093c7f0474d97796fa
|
|
7
|
+
data.tar.gz: bffef6682d58e65c5f85614a80baf4d0c99449b20e5a4b90200592dcaa05f64c597383b8a095e441597a1fe2bc859ef3c49bbb4dd254ea73d98ed91c07439d4d
|
|
@@ -33,7 +33,7 @@ module IsoDoc
|
|
|
33
33
|
|
|
34
34
|
def annex(node, out)
|
|
35
35
|
node["commentary"] = "true" and return commentary(node, out)
|
|
36
|
-
amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
|
36
|
+
amd?(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
|
37
37
|
page_break(out)
|
|
38
38
|
out.div **attr_code(annex_attrs(node)) do |s|
|
|
39
39
|
node.elements.each do |c1|
|
|
@@ -41,7 +41,7 @@ module IsoDoc
|
|
|
41
41
|
else parse(c1, s) end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
-
amd(isoxml) and @suppressheadingnumbers = true
|
|
44
|
+
amd?(isoxml) and @suppressheadingnumbers = true
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def commentary(node, out)
|
|
@@ -653,16 +653,22 @@
|
|
|
653
653
|
<fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline>
|
|
654
654
|
<fo:inline font-family="Times New Roman" font-size="10pt"><xsl:value-of select="$docidentifier_year"/></fo:inline></fo:inline>
|
|
655
655
|
</fo:block>
|
|
656
|
-
<fo:block font-family="Arial" font-size="14pt" margin-top="12mm"
|
|
656
|
+
<fo:block font-family="Arial" font-size="14pt" margin-top="12mm">
|
|
657
|
+
<fo:inline font-family="IPAexMincho">(</fo:inline>
|
|
658
|
+
<!-- JSA -->
|
|
659
|
+
<xsl:value-of select="/*/jis:bibdata/jis:copyright/jis:owner/jis:organization/jis:abbreviation"/>
|
|
660
|
+
<fo:inline font-family="IPAexMincho">)</fo:inline></fo:block>
|
|
657
661
|
</fo:block-container>
|
|
658
662
|
|
|
659
663
|
<fo:block-container absolute-position="fixed" left="0mm" top="200mm" height="69mm" text-align="center" display-align="after" font-family="IPAexMincho">
|
|
660
664
|
<!-- Revised on July 22, 2019 -->
|
|
661
665
|
<fo:block font-size="9pt">令和元年<fo:inline font-family="Times New Roman"> 7 </fo:inline>月<fo:inline font-family="Times New Roman"> 22 </fo:inline>日 改正</fo:block>
|
|
662
666
|
<!-- Japan Industrial Standards Survey Council deliberations -->
|
|
663
|
-
|
|
667
|
+
<!-- 日本産業標準調査会 -->
|
|
668
|
+
<fo:block font-size="14pt" margin-top="7mm"><xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'authorizer']/jis:organization/jis:name/jis:variant[@language = 'ja']"/> 審議</fo:block>
|
|
664
669
|
<!-- (Issued by the Japan Standards Association) -->
|
|
665
|
-
|
|
670
|
+
<!-- 日本規格協会 -->
|
|
671
|
+
<fo:block font-size="9pt" margin-top="6.5mm">(<xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'publisher']/jis:organization/jis:name/jis:variant[@language = 'ja']"/> 発行)</fo:block>
|
|
666
672
|
</fo:block-container>
|
|
667
673
|
</fo:flow>
|
|
668
674
|
</fo:page-sequence>
|
|
@@ -1912,11 +1918,26 @@
|
|
|
1912
1918
|
<xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
|
|
1913
1919
|
</xsl:if>
|
|
1914
1920
|
|
|
1915
|
-
<xsl:
|
|
1921
|
+
<xsl:variable name="font_family" select="."/>
|
|
1916
1922
|
|
|
1917
|
-
<xsl:
|
|
1918
|
-
<xsl:
|
|
1919
|
-
|
|
1923
|
+
<xsl:choose>
|
|
1924
|
+
<xsl:when test="$additional_fonts = ''">
|
|
1925
|
+
<xsl:value-of select="$font_family"/>
|
|
1926
|
+
</xsl:when>
|
|
1927
|
+
<xsl:otherwise> <!-- $additional_fonts != '' -->
|
|
1928
|
+
<xsl:choose>
|
|
1929
|
+
<xsl:when test="contains($font_family, ',')">
|
|
1930
|
+
<xsl:value-of select="substring-before($font_family, ',')"/>
|
|
1931
|
+
<xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
|
|
1932
|
+
<xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
|
|
1933
|
+
</xsl:when>
|
|
1934
|
+
<xsl:otherwise>
|
|
1935
|
+
<xsl:value-of select="$font_family"/>
|
|
1936
|
+
<xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
|
|
1937
|
+
</xsl:otherwise>
|
|
1938
|
+
</xsl:choose>
|
|
1939
|
+
</xsl:otherwise>
|
|
1940
|
+
</xsl:choose>
|
|
1920
1941
|
</xsl:attribute>
|
|
1921
1942
|
</xsl:when>
|
|
1922
1943
|
<xsl:otherwise>
|
|
@@ -2144,6 +2165,7 @@
|
|
|
2144
2165
|
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
|
2145
2166
|
|
|
2146
2167
|
<xsl:attribute name="font-size">9pt</xsl:attribute>
|
|
2168
|
+
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
|
|
2147
2169
|
|
|
2148
2170
|
</xsl:attribute-set> <!-- table-container-style -->
|
|
2149
2171
|
|
|
@@ -2307,6 +2329,10 @@
|
|
|
2307
2329
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
|
2308
2330
|
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
|
|
2309
2331
|
|
|
2332
|
+
<xsl:attribute name="font-size">inherit</xsl:attribute>
|
|
2333
|
+
<xsl:attribute name="margin-bottom">1pt</xsl:attribute>
|
|
2334
|
+
<xsl:attribute name="margin-left"><xsl:value-of select="$text_indent"/></xsl:attribute>
|
|
2335
|
+
|
|
2310
2336
|
</xsl:attribute-set><!-- table-note-style -->
|
|
2311
2337
|
|
|
2312
2338
|
<xsl:template name="refine_table-note-style">
|
|
@@ -2317,7 +2343,7 @@
|
|
|
2317
2343
|
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
|
|
2318
2344
|
|
|
2319
2345
|
<xsl:attribute name="font-size">inherit</xsl:attribute>
|
|
2320
|
-
<xsl:attribute name="margin-bottom">
|
|
2346
|
+
<xsl:attribute name="margin-bottom">1pt</xsl:attribute>
|
|
2321
2347
|
|
|
2322
2348
|
</xsl:attribute-set> <!-- table-fn-style -->
|
|
2323
2349
|
|
|
@@ -2329,7 +2355,7 @@
|
|
|
2329
2355
|
<xsl:attribute name="font-size">67%</xsl:attribute>
|
|
2330
2356
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
|
2331
2357
|
<xsl:attribute name="vertical-align">super</xsl:attribute>
|
|
2332
|
-
<xsl:attribute name="padding-right">
|
|
2358
|
+
<xsl:attribute name="padding-right">0mm</xsl:attribute>
|
|
2333
2359
|
|
|
2334
2360
|
</xsl:attribute-set> <!-- table-fn-number-style -->
|
|
2335
2361
|
|
|
@@ -4119,11 +4145,7 @@
|
|
|
4119
4145
|
|
|
4120
4146
|
<!-- except gb and bsi -->
|
|
4121
4147
|
|
|
4122
|
-
<xsl:apply-templates select="../*[local-name()='p']"/>
|
|
4123
|
-
<xsl:apply-templates select="../*[local-name()='dl']"/>
|
|
4124
|
-
<xsl:apply-templates select="../*[local-name()='note']"/>
|
|
4125
|
-
<xsl:apply-templates select="../*[local-name()='example']"/>
|
|
4126
|
-
<xsl:apply-templates select="../*[local-name()='source']"/>
|
|
4148
|
+
<xsl:apply-templates select="../*[local-name()='p' or local-name()='dl' or local-name()='note' or local-name()='example' or local-name()='source']"/>
|
|
4127
4149
|
|
|
4128
4150
|
<xsl:variable name="isDisplayRowSeparator">
|
|
4129
4151
|
|
|
@@ -4394,21 +4416,21 @@
|
|
|
4394
4416
|
|
|
4395
4417
|
<xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
|
|
4396
4418
|
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4419
|
+
<fo:list-block id="{@id}" xsl:use-attribute-sets="table-note-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
|
|
4420
|
+
<fo:list-item>
|
|
4421
|
+
<fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
|
|
4422
|
+
<fo:block>
|
|
4423
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
|
4424
|
+
</fo:block>
|
|
4425
|
+
</fo:list-item-label>
|
|
4426
|
+
<fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">
|
|
4427
|
+
<fo:block>
|
|
4428
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
|
4429
|
+
</fo:block>
|
|
4430
|
+
</fo:list-item-body>
|
|
4431
|
+
</fo:list-item>
|
|
4432
|
+
</fo:list-block>
|
|
4433
|
+
<!-- jis -->
|
|
4412
4434
|
|
|
4413
4435
|
</xsl:template> <!-- table/note -->
|
|
4414
4436
|
|
|
@@ -4611,7 +4633,7 @@
|
|
|
4611
4633
|
<xsl:variable name="reference" select="@reference"/>
|
|
4612
4634
|
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
|
4613
4635
|
|
|
4614
|
-
<fo:list-block id="{@id}" xsl:use-attribute-sets="table-fn-style" provisional-distance-between-starts="{
|
|
4636
|
+
<fo:list-block id="{@id}" xsl:use-attribute-sets="table-fn-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
|
|
4615
4637
|
<fo:list-item>
|
|
4616
4638
|
<fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
|
|
4617
4639
|
<fo:block>
|
|
@@ -4627,7 +4649,7 @@
|
|
|
4627
4649
|
</fo:inline>
|
|
4628
4650
|
</fo:block>
|
|
4629
4651
|
</fo:list-item-label>
|
|
4630
|
-
<fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style"
|
|
4652
|
+
<fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">
|
|
4631
4653
|
<fo:block>
|
|
4632
4654
|
<xsl:copy-of select="./node()"/>
|
|
4633
4655
|
</fo:block>
|
|
@@ -7537,8 +7559,12 @@
|
|
|
7537
7559
|
<xsl:variable name="isAdded" select="../@added"/>
|
|
7538
7560
|
<xsl:variable name="isDeleted" select="../@deleted"/>
|
|
7539
7561
|
<xsl:choose>
|
|
7540
|
-
<xsl:when test="ancestor::*[local-name() = 'title']">
|
|
7562
|
+
<xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
|
|
7541
7563
|
<fo:inline padding-left="1mm" padding-right="1mm">
|
|
7564
|
+
<xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
|
|
7565
|
+
<xsl:attribute name="padding-left">0mm</xsl:attribute>
|
|
7566
|
+
<xsl:attribute name="padding-right">0mm</xsl:attribute>
|
|
7567
|
+
</xsl:if>
|
|
7542
7568
|
<xsl:variable name="src">
|
|
7543
7569
|
<xsl:call-template name="image_src"/>
|
|
7544
7570
|
</xsl:variable>
|
|
@@ -7571,7 +7597,7 @@
|
|
|
7571
7597
|
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
|
|
7572
7598
|
<xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
|
|
7573
7599
|
|
|
7574
|
-
<xsl:if test="@width != '' and @width != 'auto'">
|
|
7600
|
+
<xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
|
|
7575
7601
|
<xsl:attribute name="width">
|
|
7576
7602
|
<xsl:value-of select="@width"/>
|
|
7577
7603
|
</xsl:attribute>
|
|
@@ -172,23 +172,6 @@ module IsoDoc
|
|
|
172
172
|
elem.previous = ret
|
|
173
173
|
end
|
|
174
174
|
|
|
175
|
-
def display_order(docxml)
|
|
176
|
-
i = 0
|
|
177
|
-
i = display_order_xpath(docxml, "//preface/*", i)
|
|
178
|
-
i = display_order_at(docxml, "//sections/introduction", i)
|
|
179
|
-
i = display_order_at(docxml, "//clause[@type = 'scope']", i)
|
|
180
|
-
i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
|
|
181
|
-
i = display_order_at(docxml, "//sections/terms | " \
|
|
182
|
-
"//sections/clause[descendant::terms]", i)
|
|
183
|
-
i = display_order_at(docxml, "//sections/definitions", i)
|
|
184
|
-
i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
|
|
185
|
-
i = display_order_xpath(docxml, "//annex[not(@commentary = 'true')]", i)
|
|
186
|
-
i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
|
|
187
|
-
i = display_order_xpath(docxml, "//annex[@commentary = 'true']", i)
|
|
188
|
-
i = display_order_xpath(docxml, "//indexsect", i)
|
|
189
|
-
display_order_xpath(docxml, "//colophon/*", i)
|
|
190
|
-
end
|
|
191
|
-
|
|
192
175
|
def tablesource(elem)
|
|
193
176
|
while elem&.next_element&.name == "source"
|
|
194
177
|
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
|
@@ -132,11 +132,11 @@ module IsoDoc
|
|
|
132
132
|
|
|
133
133
|
def annex(node, out)
|
|
134
134
|
node["commentary"] == "true" and return commentary(node, out)
|
|
135
|
-
amd(node.document.root) and
|
|
135
|
+
amd?(node.document.root) and
|
|
136
136
|
@suppressheadingnumbers = @oldsuppressheadingnumbers
|
|
137
137
|
page_break(out)
|
|
138
138
|
render_annex(out, node)
|
|
139
|
-
amd(node.document.root) and @suppressheadingnumbers = true
|
|
139
|
+
amd?(node.document.root) and @suppressheadingnumbers = true
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
def commentary(node, out)
|
data/lib/isodoc/jis/xref.rb
CHANGED
|
@@ -25,23 +25,48 @@ module IsoDoc
|
|
|
25
25
|
l10n("#{title} #{num}<br/>#{obl}")
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
def clause_order_main(docxml)
|
|
29
|
+
[
|
|
30
|
+
{ path: "//sections/introduction" },
|
|
31
|
+
{ path: "//clause[@type = 'scope']" },
|
|
32
|
+
{ path: @klass.norm_ref_xpath },
|
|
33
|
+
{ path: "//sections/terms | " \
|
|
34
|
+
"//sections/clause[descendant::terms]" },
|
|
35
|
+
{ path: "//sections/definitions | " \
|
|
36
|
+
"//sections/clause[descendant::definitions][not(descendant::terms)]" },
|
|
37
|
+
{ path: @klass.middle_clause(docxml), multi: true },
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def clause_order_annex(_docxml)
|
|
42
|
+
[{ path: "//annex[not(@commentary = 'true')]", multi: true }]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def clause_order_back(_docxml)
|
|
46
|
+
[
|
|
47
|
+
{ path: @klass.bibliography_xpath },
|
|
48
|
+
{ path: "//annex[@commentary = 'true']", multi: true },
|
|
49
|
+
{ path: "//indexsect", multi: true },
|
|
50
|
+
{ path: "//colophon/*", multi: true },
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def section_names(clause, num, lvl)
|
|
55
|
+
clause&.name == "introduction" and clause["unnumbered"] = "true"
|
|
56
|
+
super
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def back_clauses_anchor_names(xml)
|
|
60
|
+
clause_order_back(xml).each do |a|
|
|
61
|
+
xml.xpath(ns(a[:path])).each do |c|
|
|
32
62
|
if c["commentary"] == "true"
|
|
33
63
|
commentary_names(c)
|
|
34
64
|
else
|
|
35
|
-
|
|
65
|
+
preface_names(c)
|
|
36
66
|
end
|
|
67
|
+
a[:multi] or break
|
|
37
68
|
end
|
|
38
|
-
xml.xpath(ns(@klass.bibliography_xpath)).each do |b|
|
|
39
|
-
preface_names(b)
|
|
40
|
-
end
|
|
41
|
-
xml.xpath(ns("//colophon/clause")).each { |b| preface_names(b) }
|
|
42
|
-
xml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
|
|
43
69
|
end
|
|
44
|
-
references(xml) if @parse_settings.empty? || @parse_settings[:refs]
|
|
45
70
|
end
|
|
46
71
|
|
|
47
72
|
def commentary_names(clause)
|
data/lib/metanorma/jis/front.rb
CHANGED
|
@@ -7,42 +7,130 @@ module Metanorma
|
|
|
7
7
|
super.merge("Japanese Industrial Standards" => "JIS")
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
def home_agency
|
|
11
|
+
"JIS"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Like the ISO code, but multilingual
|
|
10
15
|
def metadata_author(node, xml)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
xml.contributor do |c|
|
|
14
|
-
c.role type: "author"
|
|
15
|
-
c.organization do |a|
|
|
16
|
-
organization(a, p, false, node, !node.attr("publisher"))
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
16
|
+
metadata_contrib_sdo(node, xml, JIS_HASH,
|
|
17
|
+
{ role: "author", sourcerole: "publisher" })
|
|
20
18
|
node.attr("doctype") == "expert-commentary" and
|
|
21
19
|
personal_author(node, xml)
|
|
22
20
|
end
|
|
23
21
|
|
|
24
22
|
def metadata_publisher(node, xml)
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
metadata_contrib_sdo(node, xml, JIS_HASH,
|
|
24
|
+
{ role: "publisher", sourcerole: "publisher" })
|
|
25
|
+
metadata_contrib_sdo(node, xml, nil,
|
|
26
|
+
{ role: "authorizer",
|
|
27
|
+
sourcerole: "investigative-organization",
|
|
28
|
+
desc: "Investigative organization" })
|
|
29
|
+
metadata_contrib_sdo(node, xml, nil,
|
|
30
|
+
{ role: "authorizer",
|
|
31
|
+
sourcerole: "investigative-committee",
|
|
32
|
+
desc: "Investigative committee" })
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
LANGS = %w(ja en).freeze
|
|
36
|
+
|
|
37
|
+
JIS_HASH =
|
|
38
|
+
{ "ja" => "日本工業規格", "en" => "Japanese Industrial Standards" }.freeze
|
|
39
|
+
|
|
40
|
+
def metadata_contrib_sdo(node, xml, default_value, opt)
|
|
41
|
+
pub, default = metadata_contrib_extract(node, opt[:sourcerole], default_value)
|
|
42
|
+
metadata_contrib_sdo_build(node, xml, pub, default, opt)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def metadata_contrib_sdo_build(node, xml, pub, default, opt)
|
|
46
|
+
pub&.each do |p|
|
|
27
47
|
xml.contributor do |c|
|
|
28
|
-
c.role type:
|
|
48
|
+
c.role type: opt[:role] do |r|
|
|
49
|
+
opt[:desc] and r.description opt[:desc]
|
|
50
|
+
end
|
|
29
51
|
c.organization do |a|
|
|
30
|
-
organization(a, p,
|
|
52
|
+
organization(a, p, opt[:role] == "publisher", node, default)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def metadata_contrib_extract(node, role, default_value)
|
|
59
|
+
pub, default = multiling_docattr_csv(node, role, LANGS, default_value)
|
|
60
|
+
a = node.attr("#{role}-abbr") and abbr = a # one abbrev for all languages
|
|
61
|
+
[pub&.map { |p| { name: p, abbr: abbr } }, default]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def multiling_docattr(node, attr, langs)
|
|
65
|
+
ret = node.attr(attr) and return ret
|
|
66
|
+
ret = langs.each_with_object({}).each do |l, m|
|
|
67
|
+
x = node.attr("#{attr}-#{l}") and m[l] = x
|
|
68
|
+
end.compact
|
|
69
|
+
ret.empty? and return nil
|
|
70
|
+
ret
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def multiling_docattr_csv(node, attr, langs, default)
|
|
74
|
+
ret = multiling_docattr(node, attr, langs)
|
|
75
|
+
not_found = ret.nil?
|
|
76
|
+
ret ||= default
|
|
77
|
+
ret &&= if ret.is_a?(Hash) then interleave_multiling_docattr(ret)
|
|
78
|
+
else csv_split(ret)
|
|
79
|
+
end
|
|
80
|
+
[ret, not_found]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# TODO abort if CSV count different between different languages
|
|
84
|
+
def interleave_multiling_docattr(ret)
|
|
85
|
+
h = ret.transform_values { |v| csv_split(v) }
|
|
86
|
+
h.each_with_object([]) do |(k, v), m|
|
|
87
|
+
v.each_with_index do |v1, i|
|
|
88
|
+
m[i] ||= {}
|
|
89
|
+
m[i][k] = v1
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def multiling_noko_value(value, tag, xml)
|
|
95
|
+
if value.is_a?(Hash)
|
|
96
|
+
xml.send tag do |t|
|
|
97
|
+
value.each do |k, v|
|
|
98
|
+
t.variant v, language: k
|
|
31
99
|
end
|
|
32
100
|
end
|
|
101
|
+
elsif value.is_a?(Array)
|
|
102
|
+
value.each { |a| xml.send tag, a }
|
|
103
|
+
else xml.send tag, value
|
|
33
104
|
end
|
|
34
105
|
end
|
|
35
106
|
|
|
107
|
+
def organization(xml, org, _is_pub, node = nil, default_org = nil)
|
|
108
|
+
org.is_a?(Hash) or org = { name: org }
|
|
109
|
+
abbrevs = org_abbrev
|
|
110
|
+
name_str = org[:name].is_a?(Hash) ? org[:name]["en"] : org[:name]
|
|
111
|
+
n = abbrevs.invert[org[:name]] and org = { name: n, abbr: org[:name] }
|
|
112
|
+
multiling_noko_value(org[:name], "name", xml)
|
|
113
|
+
default_org && a = multiling_docattr(node, "subdivision", LANGS) and
|
|
114
|
+
multiling_noko_value(a, "subdivision", xml)
|
|
115
|
+
abbr = org[:abbr]
|
|
116
|
+
abbr ||= org_abbrev[name_str]
|
|
117
|
+
default_org && b = node.attr("subdivision-abbr") and abbr = b
|
|
118
|
+
abbr and xml.abbreviation abbr
|
|
119
|
+
# is_pub && node and org_address(node, org) # should refactor into struct, like abbr
|
|
120
|
+
end
|
|
121
|
+
|
|
36
122
|
def metadata_copyright(node, xml)
|
|
37
|
-
pub = node
|
|
38
|
-
|
|
123
|
+
pub, default = metadata_contrib_extract(node, "copyright-holder", nil)
|
|
124
|
+
if default
|
|
125
|
+
pub, default = metadata_contrib_extract(node, "publisher", JIS_HASH)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
pub&.each do |p|
|
|
39
129
|
xml.copyright do |c|
|
|
40
130
|
c.from (node.attr("copyright-year") || Date.today.year)
|
|
41
131
|
c.owner do |owner|
|
|
42
132
|
owner.organization do |o|
|
|
43
|
-
organization(o, p, true, node,
|
|
44
|
-
!node.attr("copyright-holder") ||
|
|
45
|
-
node.attr("publisher"))
|
|
133
|
+
organization(o, p, true, node, default)
|
|
46
134
|
end
|
|
47
135
|
end
|
|
48
136
|
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.4 -->
|
|
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">
|
|
@@ -2068,6 +2068,9 @@
|
|
|
2068
2068
|
</define>
|
|
2069
2069
|
<define name="termdefinition">
|
|
2070
2070
|
<element name="definition">
|
|
2071
|
+
<optional>
|
|
2072
|
+
<attribute name="type"/>
|
|
2073
|
+
</optional>
|
|
2071
2074
|
<choice>
|
|
2072
2075
|
<ref name="verbaldefinition"/>
|
|
2073
2076
|
<ref name="nonverbalrep"/>
|
data/metanorma-jis.gemspec
CHANGED
|
@@ -30,9 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
31
31
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
32
32
|
|
|
33
|
-
spec.add_dependency "metanorma-iso", "~> 2.5.
|
|
34
|
-
#spec.add_dependency "relaton-bipm", "~> 1.14.8"
|
|
35
|
-
#spec.add_dependency "relaton-iho", "~> 1.14.3"
|
|
33
|
+
spec.add_dependency "metanorma-iso", "~> 2.5.1"
|
|
36
34
|
spec.add_dependency "pubid-jis"
|
|
37
35
|
|
|
38
36
|
spec.add_development_dependency "debug"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-jis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
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-08-
|
|
11
|
+
date: 2023-08-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-iso
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.5.
|
|
19
|
+
version: 2.5.1
|
|
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.5.
|
|
26
|
+
version: 2.5.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: pubid-jis
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|