metanorma-jis 0.3.0 → 0.3.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/i18n-en.yaml +3 -0
- data/lib/isodoc/jis/i18n-ja.yaml +3 -0
- data/lib/isodoc/jis/jis.international-standard.xsl +124 -69
- data/lib/isodoc/jis/metadata.rb +10 -7
- data/lib/isodoc/jis/presentation_section.rb +48 -4
- data/lib/metanorma/jis/front.rb +9 -8
- data/lib/metanorma/jis/version.rb +1 -1
- data/lib/relaton/render-jis/parse.rb +3 -2
- data/metanorma-jis.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3c4ae85ab16813c1ea6df1c84c0f35eed81c3cfced1a6847f24c18ee4d3d15a
|
|
4
|
+
data.tar.gz: 6cd56b9042872341a10daa7a420eeb2fc253b36316d487ee40e0b863b1cd34fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 917d400c63d026ef24f46382369e4c0d0789060e85938bff493143045219ed36b256aa92d19f7dbfa74f06640f031a7ea231f44adfa1abf196ce9b32e8d0472a
|
|
7
|
+
data.tar.gz: 21a50c365f2107c6dc1fde249ff28453c2fcbf3d9d2c6c9064d6881738fbfc9d8a858bd9c7cc412b59e0be7ff643a27bdcb64c5843975b7158c1b4dd664ef0de
|
data/lib/isodoc/jis/i18n-en.yaml
CHANGED
|
@@ -6,6 +6,9 @@ commentary_page: Comm.
|
|
|
6
6
|
JIS: 日本工業規格
|
|
7
7
|
permission_footer: Duplication, reprinting, etc. without permission is prohibited by copyright law.
|
|
8
8
|
chairperson: chairperson
|
|
9
|
+
membership_table: Membership Table
|
|
10
|
+
full_name: Full Name
|
|
11
|
+
affiliation: Affiliation
|
|
9
12
|
doctype_dict:
|
|
10
13
|
international-standard: International standard
|
|
11
14
|
japanese-industrial-standard: International standard
|
data/lib/isodoc/jis/i18n-ja.yaml
CHANGED
|
@@ -185,6 +185,11 @@
|
|
|
185
185
|
<xsl:apply-templates mode="update_xml_step1"/>
|
|
186
186
|
</xsl:variable>
|
|
187
187
|
<!-- DEBUG: updated_xml_step1=<xsl:copy-of select="$updated_xml_step1"/> -->
|
|
188
|
+
<!-- <xsl:message>start redirect</xsl:message>
|
|
189
|
+
<redirect:write file="update_xml_step1.xml">
|
|
190
|
+
<xsl:copy-of select="$updated_xml_step1"/>
|
|
191
|
+
</redirect:write>
|
|
192
|
+
<xsl:message>end redirect</xsl:message> -->
|
|
188
193
|
|
|
189
194
|
<xsl:variable name="updated_xml_step2_">
|
|
190
195
|
<xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
|
|
@@ -246,87 +251,99 @@
|
|
|
246
251
|
<!-- Contents and preface pages -->
|
|
247
252
|
<!-- ========================== -->
|
|
248
253
|
|
|
249
|
-
<
|
|
254
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
|
255
|
+
<xsl:sort select="@displayorder" data-type="number"/>
|
|
250
256
|
|
|
251
|
-
<xsl:
|
|
252
|
-
<xsl:
|
|
253
|
-
|
|
254
|
-
<xsl:with-param name="section">preface</xsl:with-param>
|
|
255
|
-
<xsl:with-param name="section_title">
|
|
256
|
-
<fo:inline font-family="IPAexGothic">
|
|
257
|
-
<xsl:text> </xsl:text>
|
|
258
|
-
<xsl:call-template name="getLocalizedString">
|
|
259
|
-
<xsl:with-param name="key">table_of_contents</xsl:with-param>
|
|
260
|
-
</xsl:call-template>
|
|
261
|
-
</fo:inline>
|
|
262
|
-
</xsl:with-param>
|
|
263
|
-
</xsl:call-template>
|
|
264
|
-
|
|
265
|
-
<fo:flow flow-name="xsl-region-body">
|
|
257
|
+
<xsl:choose>
|
|
258
|
+
<xsl:when test="local-name() = 'clause' and @type = 'toc'">
|
|
259
|
+
<fo:page-sequence master-reference="document_toc" force-page-count="no-force">
|
|
266
260
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
contents=<xsl:copy-of select="$contents"/>
|
|
271
|
-
<xsl:text disable-output-escaping="yes">--></xsl:text>
|
|
272
|
-
</xsl:if>
|
|
261
|
+
<xsl:if test="position() = 1">
|
|
262
|
+
<xsl:attribute name="initial-page-number">1</xsl:attribute>
|
|
263
|
+
</xsl:if>
|
|
273
264
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
265
|
+
<xsl:call-template name="insertHeaderFooter">
|
|
266
|
+
<xsl:with-param name="docidentifier" select="$docidentifier"/>
|
|
267
|
+
<xsl:with-param name="copyrightText" select="$copyrightText"/>
|
|
268
|
+
<xsl:with-param name="section">preface</xsl:with-param>
|
|
269
|
+
<xsl:with-param name="section_title">
|
|
270
|
+
<fo:inline font-family="IPAexGothic">
|
|
271
|
+
<xsl:text> </xsl:text>
|
|
272
|
+
<xsl:call-template name="getLocalizedString">
|
|
273
|
+
<xsl:with-param name="key">table_of_contents</xsl:with-param>
|
|
274
|
+
</xsl:call-template>
|
|
275
|
+
</fo:inline>
|
|
276
|
+
</xsl:with-param>
|
|
277
|
+
</xsl:call-template>
|
|
277
278
|
|
|
278
|
-
|
|
279
|
-
<fo:block><!-- prevent fop error for empty document --></fo:block>
|
|
280
|
-
</xsl:if>
|
|
279
|
+
<fo:flow flow-name="xsl-region-body">
|
|
281
280
|
|
|
282
|
-
|
|
281
|
+
<!-- <xsl:if test="$debug = 'true'">
|
|
282
|
+
<redirect:write file="contents_.xml">
|
|
283
|
+
<xsl:copy-of select="$contents"/>
|
|
284
|
+
</redirect:write>
|
|
285
|
+
</xsl:if> -->
|
|
283
286
|
|
|
284
|
-
|
|
287
|
+
<xsl:apply-templates select=".">
|
|
288
|
+
<xsl:with-param name="num" select="$num"/>
|
|
289
|
+
</xsl:apply-templates>
|
|
285
290
|
|
|
286
|
-
|
|
291
|
+
<!-- <xsl:if test="not(/*/*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc'])">
|
|
292
|
+
<fo:block> --><!-- prevent fop error for empty document --><!-- </fo:block>
|
|
293
|
+
</xsl:if> -->
|
|
287
294
|
|
|
288
|
-
|
|
295
|
+
</fo:flow>
|
|
289
296
|
|
|
290
|
-
|
|
297
|
+
</fo:page-sequence>
|
|
298
|
+
</xsl:when><!-- end ToC -->
|
|
299
|
+
<xsl:otherwise>
|
|
300
|
+
<xsl:variable name="structured_xml_preface">
|
|
301
|
+
<xsl:apply-templates select="." mode="linear_xml"/>
|
|
302
|
+
</xsl:variable>
|
|
291
303
|
|
|
292
|
-
|
|
304
|
+
<xsl:variable name="paged_xml_preface_">
|
|
305
|
+
<xsl:call-template name="makePagedXML">
|
|
306
|
+
<xsl:with-param name="structured_xml" select="$structured_xml_preface"/>
|
|
307
|
+
</xsl:call-template>
|
|
308
|
+
</xsl:variable>
|
|
309
|
+
<xsl:variable name="paged_xml_preface" select="xalan:nodeset($paged_xml_preface_)"/>
|
|
293
310
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
</xsl:call-template>
|
|
298
|
-
</xsl:variable>
|
|
299
|
-
<xsl:variable name="paged_xml_preface" select="xalan:nodeset($paged_xml_preface_)"/>
|
|
311
|
+
<xsl:if test="$paged_xml_preface/*[local-name()='page'] and count($paged_xml_preface/*[local-name()='page']/*) != 0">
|
|
312
|
+
<!-- Preface pages -->
|
|
313
|
+
<fo:page-sequence master-reference="document_preface" force-page-count="no-force">
|
|
300
314
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
315
|
+
<xsl:if test="position() = 1">
|
|
316
|
+
<xsl:attribute name="initial-page-number">1</xsl:attribute>
|
|
317
|
+
</xsl:if>
|
|
304
318
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
319
|
+
<fo:static-content flow-name="xsl-footnote-separator">
|
|
320
|
+
<fo:block text-align="center" margin-bottom="6pt">
|
|
321
|
+
<fo:leader leader-pattern="rule" leader-length="80mm"/>
|
|
322
|
+
</fo:block>
|
|
323
|
+
</fo:static-content>
|
|
310
324
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
325
|
+
<xsl:call-template name="insertHeaderFooter">
|
|
326
|
+
<xsl:with-param name="docidentifier" select="$docidentifier"/>
|
|
327
|
+
<xsl:with-param name="copyrightText" select="$copyrightText"/>
|
|
328
|
+
<xsl:with-param name="section">preface</xsl:with-param>
|
|
329
|
+
</xsl:call-template>
|
|
316
330
|
|
|
317
|
-
|
|
331
|
+
<fo:flow flow-name="xsl-region-body">
|
|
318
332
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
333
|
+
<fo:block>
|
|
334
|
+
<xsl:for-each select="$paged_xml_preface/*[local-name()='page']">
|
|
335
|
+
<xsl:if test="position() != 1">
|
|
336
|
+
<fo:block break-after="page"/>
|
|
337
|
+
</xsl:if>
|
|
338
|
+
<xsl:apply-templates select="*" mode="page"/>
|
|
339
|
+
</xsl:for-each>
|
|
340
|
+
</fo:block>
|
|
341
|
+
</fo:flow>
|
|
342
|
+
</fo:page-sequence> <!-- END Preface pages -->
|
|
343
|
+
</xsl:if>
|
|
344
|
+
</xsl:otherwise>
|
|
345
|
+
</xsl:choose>
|
|
346
|
+
</xsl:for-each>
|
|
330
347
|
|
|
331
348
|
<!-- Document type rendering -->
|
|
332
349
|
<fo:page-sequence master-reference="document_preface" force-page-count="no-force">
|
|
@@ -400,7 +417,12 @@
|
|
|
400
417
|
<xsl:copy-of select="./*"/>
|
|
401
418
|
</xsl:for-each>
|
|
402
419
|
</xsl:variable>
|
|
403
|
-
|
|
420
|
+
|
|
421
|
+
<!-- <xsl:if test="$debug = 'true'">
|
|
422
|
+
<redirect:write file="structured_xml_.xml">
|
|
423
|
+
<xsl:copy-of select="$structured_xml"/>
|
|
424
|
+
</redirect:write>
|
|
425
|
+
</xsl:if> -->
|
|
404
426
|
|
|
405
427
|
<xsl:variable name="paged_xml">
|
|
406
428
|
<xsl:call-template name="makePagedXML">
|
|
@@ -1102,6 +1124,12 @@
|
|
|
1102
1124
|
</xsl:choose>
|
|
1103
1125
|
</xsl:template>
|
|
1104
1126
|
|
|
1127
|
+
<xsl:template match="*[local-name() = 'introduction']">
|
|
1128
|
+
<fo:block id="{@id}">
|
|
1129
|
+
<xsl:apply-templates/>
|
|
1130
|
+
</fo:block>
|
|
1131
|
+
</xsl:template>
|
|
1132
|
+
|
|
1105
1133
|
<xsl:template match="*[local-name() = 'annex']" priority="2">
|
|
1106
1134
|
<fo:block id="{@id}">
|
|
1107
1135
|
</fo:block>
|
|
@@ -7639,18 +7667,33 @@
|
|
|
7639
7667
|
|
|
7640
7668
|
<xsl:template match="*[local-name()='localityStack']"/>
|
|
7641
7669
|
|
|
7670
|
+
<xsl:variable name="pdfAttachmentsList_">
|
|
7671
|
+
<xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
|
|
7672
|
+
<attachment filename="{@name}"/>
|
|
7673
|
+
</xsl:for-each>
|
|
7674
|
+
</xsl:variable>
|
|
7675
|
+
<xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
|
|
7676
|
+
|
|
7642
7677
|
<xsl:template match="*[local-name()='link']" name="link">
|
|
7678
|
+
<xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
|
|
7679
|
+
<xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
|
|
7643
7680
|
<xsl:variable name="target">
|
|
7644
7681
|
<xsl:choose>
|
|
7645
7682
|
<xsl:when test="@updatetype = 'true'">
|
|
7646
7683
|
<xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
|
|
7647
7684
|
</xsl:when>
|
|
7685
|
+
<!-- link to the PDF attachment -->
|
|
7686
|
+
<xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
|
|
7687
|
+
<xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
|
|
7688
|
+
</xsl:when>
|
|
7689
|
+
<!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
|
|
7690
|
+
<xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
|
|
7691
|
+
</xsl:when>
|
|
7648
7692
|
<xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
|
|
7649
|
-
<!-- link to the PDF attachment -->
|
|
7650
7693
|
<xsl:variable name="target_" select="translate(@target, '\', '/')"/>
|
|
7651
7694
|
<xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
|
|
7652
7695
|
<xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
|
|
7653
|
-
</xsl:when>
|
|
7696
|
+
</xsl:when> -->
|
|
7654
7697
|
<xsl:otherwise>
|
|
7655
7698
|
<xsl:value-of select="normalize-space(@target)"/>
|
|
7656
7699
|
</xsl:otherwise>
|
|
@@ -12244,6 +12287,17 @@
|
|
|
12244
12287
|
<xsl:copy-of select="."/>
|
|
12245
12288
|
</xsl:template>
|
|
12246
12289
|
|
|
12290
|
+
<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
|
|
12291
|
+
<xsl:copy>
|
|
12292
|
+
<xsl:copy-of select="@*"/>
|
|
12293
|
+
<xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
|
|
12294
|
+
<xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
|
|
12295
|
+
<xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
|
|
12296
|
+
<xsl:value-of select="."/>
|
|
12297
|
+
</xsl:if>
|
|
12298
|
+
</xsl:copy>
|
|
12299
|
+
</xsl:template>
|
|
12300
|
+
|
|
12247
12301
|
<!-- add @id, mandatory for table auto-layout algorithm -->
|
|
12248
12302
|
<xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
|
|
12249
12303
|
<xsl:copy>
|
|
@@ -13225,7 +13279,8 @@
|
|
|
13225
13279
|
</xsl:when>
|
|
13226
13280
|
<xsl:otherwise>
|
|
13227
13281
|
<!-- _{filename}_attachments -->
|
|
13228
|
-
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
|
|
13282
|
+
<!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
|
|
13283
|
+
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
|
|
13229
13284
|
<pdf:embedded-file src="{$url}" filename="{@name}"/>
|
|
13230
13285
|
</xsl:otherwise>
|
|
13231
13286
|
</xsl:choose>
|
data/lib/isodoc/jis/metadata.rb
CHANGED
|
@@ -73,20 +73,23 @@ module IsoDoc
|
|
|
73
73
|
investigative_committee(xml)
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
+
def extract_role(role, desc)
|
|
77
|
+
<<~XPATH
|
|
78
|
+
//bibdata/contributor[xmlns:role/@type = '#{role}'][xmlns:role/description = '#{desc}' or xmlns:role/description = '#{desc.downcase}']
|
|
79
|
+
XPATH
|
|
80
|
+
end
|
|
81
|
+
|
|
76
82
|
def investigative_organisation(xml)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
org = xml.at(ns(xpath))
|
|
83
|
+
p = extract_role("authorizer", "Investigative organization")
|
|
84
|
+
org = xml.at(ns("#{p}/organization/name[@language = '#{@lang}']"))
|
|
85
|
+
org ||= xml.at(ns("#{p}/organization/name"))
|
|
81
86
|
if org then set_encoded(:"investigative-organization", org)
|
|
82
87
|
else set(:"investigative-organization", get[:publisher])
|
|
83
88
|
end
|
|
84
89
|
end
|
|
85
90
|
|
|
86
91
|
def investigative_committee(xml)
|
|
87
|
-
xpath = "
|
|
88
|
-
"[xmlns:role/@type = 'authorizer'][xmlns:role/description = " \
|
|
89
|
-
"'investigative committee']"
|
|
92
|
+
xpath = extract_role("authorizer", "Investigative committee")
|
|
90
93
|
if o = xml.at(ns("#{xpath}/organization/name"))
|
|
91
94
|
set_encoded(:"investigative-committee", o)
|
|
92
95
|
elsif p = xml.at(ns("#{xpath}/person"))
|
|
@@ -22,7 +22,7 @@ module IsoDoc
|
|
|
22
22
|
docxml.at(ns("//annex[@commentary = 'true']")) or return
|
|
23
23
|
b = docxml.at(ns("//bibliography")) ||
|
|
24
24
|
docxml.at(ns("//annex[last()]")).after(" ").next
|
|
25
|
-
docxml.xpath(ns("//annex[@commentary = 'true']")).
|
|
25
|
+
docxml.xpath(ns("//annex[@commentary = 'true']")).reverse_each do |x|
|
|
26
26
|
b.next = x.remove
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -42,17 +42,22 @@ module IsoDoc
|
|
|
42
42
|
elem.previous = ret
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
46
|
-
|
|
45
|
+
def make_preface(docxml)
|
|
46
|
+
docxml.at(ns("//preface")) ||
|
|
47
47
|
docxml.at(ns("//sections | //annex | //bibliography"))
|
|
48
48
|
&.before("<preface> </preface>")
|
|
49
|
-
&.previous_element
|
|
49
|
+
&.previous_element
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def toc_title_insert_pt(docxml)
|
|
53
|
+
ins = make_preface(docxml) or return nil
|
|
50
54
|
ins.children.last.after(" ").next
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
def preface_rearrange(doc)
|
|
54
58
|
move_introduction(doc)
|
|
55
59
|
super
|
|
60
|
+
move_participants(doc)
|
|
56
61
|
end
|
|
57
62
|
|
|
58
63
|
def move_introduction(doc)
|
|
@@ -63,6 +68,45 @@ module IsoDoc
|
|
|
63
68
|
dest.children.first.next = source
|
|
64
69
|
end
|
|
65
70
|
|
|
71
|
+
def move_participants(doc)
|
|
72
|
+
p = doc.at(ns("//clause[@type = 'participants']")) or return
|
|
73
|
+
t = participant_table(p) or return
|
|
74
|
+
p.remove
|
|
75
|
+
ins = make_preface(doc) or return nil
|
|
76
|
+
ins.children.first.previous = t
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def participant_table(clause)
|
|
80
|
+
s = clause.at(ns("./sourcecode")) or return nil
|
|
81
|
+
y = YAML.safe_load(s.children.to_xml(encoding: "UTF-8")) or return nil
|
|
82
|
+
y.is_a?(Array) or return nil
|
|
83
|
+
out1 = <<~OUTPUT
|
|
84
|
+
<clause id='_#{UUIDTools::UUID.random_create}'><title>#{@meta.get[:"investigative-committee"]} #{@i18n.membership_table}</title>
|
|
85
|
+
<table unnumbered='true'>
|
|
86
|
+
<thead>
|
|
87
|
+
<tr><th/><th>#{@i18n.full_name}</th><th>#{@i18n.affiliation}</th></tr>
|
|
88
|
+
</thead>
|
|
89
|
+
<tbody>
|
|
90
|
+
OUTPUT
|
|
91
|
+
out2 = <<~OUTPUT
|
|
92
|
+
</tbody></table></clause>
|
|
93
|
+
OUTPUT
|
|
94
|
+
"#{out1}#{participant_rows(y)}#{out2}"
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def participant_rows(yaml)
|
|
98
|
+
yaml.map do |y|
|
|
99
|
+
r = y["role"] ? @i18n.l10n("(#{y['role']})") : ""
|
|
100
|
+
n = y["name"]
|
|
101
|
+
if n.is_a?(Hash)
|
|
102
|
+
n =
|
|
103
|
+
if @lang == "ja" then "#{n['surname']} #{n['givenname']}"
|
|
104
|
+
else "#{n['givenname']} #{n['surname']}" end
|
|
105
|
+
end
|
|
106
|
+
"<tr><td>#{r}</rd><td>#{n}</td><td>#{y['affiliation']}</td></tr>"
|
|
107
|
+
end.join("\n")
|
|
108
|
+
end
|
|
109
|
+
|
|
66
110
|
def middle_title(docxml)
|
|
67
111
|
s = docxml.at(ns("//sections")) or return
|
|
68
112
|
elem = s.children.first
|
data/lib/metanorma/jis/front.rb
CHANGED
|
@@ -14,12 +14,12 @@ module Metanorma
|
|
|
14
14
|
def metadata_author(node, xml)
|
|
15
15
|
org_contributor(node, xml,
|
|
16
16
|
{ source: ["publisher", "pub"], role: "author",
|
|
17
|
-
default:
|
|
17
|
+
default: pub_hash })
|
|
18
18
|
personal_author(node, xml)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def metadata_publisher(node, xml)
|
|
22
|
-
[{ source: ["publisher", "pub"], role: "publisher", default:
|
|
22
|
+
[{ source: ["publisher", "pub"], role: "publisher", default: pub_hash },
|
|
23
23
|
{ role: "authorizer",
|
|
24
24
|
source: ["investigative-organization"],
|
|
25
25
|
desc: "Investigative organization" },
|
|
@@ -32,8 +32,9 @@ module Metanorma
|
|
|
32
32
|
|
|
33
33
|
LANGS = %w(ja en).freeze
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
{ "ja" => "日本工業規格", "en" => "Japanese Industrial Standards" }
|
|
35
|
+
def pub_hash
|
|
36
|
+
{ "ja" => "日本工業規格", "en" => "Japanese Industrial Standards" }
|
|
37
|
+
end
|
|
37
38
|
|
|
38
39
|
def org_organization(node, xml, org)
|
|
39
40
|
organization(xml, { name: org[:name], abbr: org[:abbr] }.compact,
|
|
@@ -92,9 +93,9 @@ module Metanorma
|
|
|
92
93
|
|
|
93
94
|
def multiling_noko_value(value, tag, xml)
|
|
94
95
|
if value.is_a?(Hash)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
value.each do |k, v|
|
|
97
|
+
xml.send tag, language: k do |x|
|
|
98
|
+
x << v
|
|
98
99
|
end
|
|
99
100
|
end
|
|
100
101
|
elsif value.is_a?(Array)
|
|
@@ -119,7 +120,7 @@ module Metanorma
|
|
|
119
120
|
|
|
120
121
|
def copyright_parse(node)
|
|
121
122
|
opt = { source: ["copyright-holder", "publisher", "pub"],
|
|
122
|
-
role: "publisher", default:
|
|
123
|
+
role: "publisher", default: pub_hash }
|
|
123
124
|
ret = org_attrs_parse(node, opt)
|
|
124
125
|
ret.empty? and ret = [{ name: "-" }]
|
|
125
126
|
ret
|
|
@@ -6,14 +6,15 @@ module Relaton
|
|
|
6
6
|
class Parse < ::Relaton::Render::Iso::Parse
|
|
7
7
|
def simple_or_host_xml2hash(doc, host)
|
|
8
8
|
ret = super
|
|
9
|
-
ret.merge(home_standard: home_standard(doc, ret[:publisher_raw] ||
|
|
9
|
+
ret.merge(home_standard: home_standard(doc, ret[:publisher_raw] ||
|
|
10
|
+
ret[:author_raw]))
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def home_standard(_doc, pubs)
|
|
13
14
|
pubs&.any? do |r|
|
|
14
15
|
["International Organization for Standardization", "ISO",
|
|
15
16
|
"International Electrotechnical Commission", "IEC",
|
|
16
|
-
"一般財団法人 日本規格協会", "
|
|
17
|
+
"一般財団法人 日本規格協会", "Japanese Industrial Standards"]
|
|
17
18
|
.include?(r[:nonpersonal])
|
|
18
19
|
end
|
|
19
20
|
end
|
data/metanorma-jis.gemspec
CHANGED
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.3.
|
|
4
|
+
version: 0.3.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: 2024-
|
|
11
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: japanese_calendar
|
|
@@ -234,6 +234,20 @@ dependencies:
|
|
|
234
234
|
- - ">="
|
|
235
235
|
- !ruby/object:Gem::Version
|
|
236
236
|
version: '0'
|
|
237
|
+
- !ruby/object:Gem::Dependency
|
|
238
|
+
name: xml-c14n
|
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
|
240
|
+
requirements:
|
|
241
|
+
- - ">="
|
|
242
|
+
- !ruby/object:Gem::Version
|
|
243
|
+
version: '0'
|
|
244
|
+
type: :development
|
|
245
|
+
prerelease: false
|
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
247
|
+
requirements:
|
|
248
|
+
- - ">="
|
|
249
|
+
- !ruby/object:Gem::Version
|
|
250
|
+
version: '0'
|
|
237
251
|
description: |
|
|
238
252
|
metanorma-jis lets you write JIS standards in AsciiDoc syntax.
|
|
239
253
|
|