metanorma-jis 0.6.6 → 1.0.0
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 +9 -0
- data/lib/isodoc/jis/i18n-ja.yaml +10 -0
- data/lib/isodoc/jis/jis.international-standard.xsl +326 -229
- data/lib/isodoc/jis/presentation_xml_convert.rb +63 -12
- data/lib/isodoc/jis/xref.rb +14 -2
- data/lib/metanorma/jis/biblio.rng +1 -1
- data/lib/metanorma/jis/cleanup.rb +0 -1
- data/lib/metanorma/jis/converter.rb +2 -0
- data/lib/metanorma/jis/isodoc.rng +35 -10
- data/lib/metanorma/jis/log.rb +20 -0
- data/lib/metanorma/jis/validate.rb +2 -4
- data/lib/metanorma/jis/version.rb +1 -1
- data/lib/relaton/render-jis/config.yml +58 -11
- data/lib/relaton/render-jis/fields.rb +19 -0
- data/lib/relaton/render-jis/general.rb +2 -7
- data/metanorma-jis.gemspec +3 -2
- metadata +24 -8
|
@@ -47,13 +47,17 @@ module IsoDoc
|
|
|
47
47
|
node.children.to_xml.gsub(%r{</?p( [^>]*)?>}, "")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
def contains_para?(text)
|
|
51
|
+
/\([^()]+\)|([^()].+)/.match?(text)
|
|
52
|
+
end
|
|
53
|
+
|
|
50
54
|
def source1_label(elem, sources, ancestor)
|
|
51
55
|
elem.children = if ancestor == :table
|
|
52
|
-
l10n("#{@i18n.source}: #{sources}")
|
|
53
|
-
elsif
|
|
54
|
-
l10n("[#{@i18n.source}: #{sources}]")
|
|
56
|
+
l10n("#{@i18n.source}: #{esc sources}")
|
|
57
|
+
elsif contains_para?(sources)
|
|
58
|
+
l10n("[#{@i18n.source}: #{esc sources}]")
|
|
55
59
|
else
|
|
56
|
-
l10n("(#{@i18n.source}: #{sources})")
|
|
60
|
+
l10n("(#{@i18n.source}: #{esc sources})")
|
|
57
61
|
end
|
|
58
62
|
end
|
|
59
63
|
|
|
@@ -87,7 +91,7 @@ module IsoDoc
|
|
|
87
91
|
|
|
88
92
|
def convert1(xml, filename, dir)
|
|
89
93
|
j = xml.at(ns("//metanorma-extension/presentation-metadata/" \
|
|
90
|
-
|
|
94
|
+
"autonumbering-style"))&.text
|
|
91
95
|
j ||= "arabic"
|
|
92
96
|
@autonumbering_style = j.to_sym
|
|
93
97
|
@xrefs.autonumbering_style = j.to_sym
|
|
@@ -150,14 +154,10 @@ module IsoDoc
|
|
|
150
154
|
end
|
|
151
155
|
|
|
152
156
|
# if termsource xref has no SDO identifier, cite instead by full reference
|
|
153
|
-
def
|
|
157
|
+
def anchor_linkend(node, linkend)
|
|
158
|
+
node.name == "fmt-origin" && fmt_origin_cite_full?(node) and
|
|
159
|
+
node["style"] ||= "short"
|
|
154
160
|
super
|
|
155
|
-
xmldoc.xpath(ns("//fmt-origin")).each do |e|
|
|
156
|
-
fmt_origin_cite_full?(e) or next
|
|
157
|
-
bibitem = @bibitem_lookup[e["bibitemid"]]
|
|
158
|
-
cit = bibitem.at(ns("./formattedref")) or next
|
|
159
|
-
e["citeas"] = citeas_cleanup(to_xml(cit.children).strip)
|
|
160
|
-
end
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
def fmt_origin_cite_full?(elem)
|
|
@@ -177,8 +177,59 @@ module IsoDoc
|
|
|
177
177
|
@lang == "ja" ? "、" : "; "
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
+
def termsource_mod_text_delim(_elem)
|
|
181
|
+
@lang == "ja" ? "," : ", "
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def termsource_modification(elem)
|
|
185
|
+
elem.xpath(".//text()[normalize-space() = '']").each(&:remove)
|
|
186
|
+
origin = elem.at(ns("./origin"))
|
|
187
|
+
mod = elem.at(ns("./modification"))
|
|
188
|
+
s = termsource_status(elem["status"])
|
|
189
|
+
mod && elem["status"] == "modified" and s = @i18n.modified_detail
|
|
190
|
+
s and origin.next = l10n(", #{s}", @lang, @script,
|
|
191
|
+
{ prev: origin.text })
|
|
192
|
+
mod or return
|
|
193
|
+
termsource_add_modification_text(mod)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def termsource_label(elem, sources)
|
|
197
|
+
if contains_para?(sources)
|
|
198
|
+
elem.replace(l10n("[#{@i18n.source}: #{esc sources}]"))
|
|
199
|
+
else
|
|
200
|
+
elem.replace(l10n("(#{@i18n.source}: #{esc sources})"))
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
180
204
|
def bracketed_refs_processing(docxml); end
|
|
181
205
|
|
|
206
|
+
def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, bib)
|
|
207
|
+
delim = bib.at(ns("./language"))&.text == "ja" ? " " : "<esc>,</esc> "
|
|
208
|
+
ret = (idents[:ordinal] || idents[:metanorma] || idents[:sdo]).to_s
|
|
209
|
+
ret = esc(ret)
|
|
210
|
+
(idents[:ordinal] || idents[:metanorma]) && idents[:sdo] and
|
|
211
|
+
ret += "#{delim}<strong>#{esc idents[:sdo]}</strong>"
|
|
212
|
+
!idents[:ordinal] && !idents[:metanorma] && idents[:sdo] and
|
|
213
|
+
ret = "<strong>#{ret}</ret>"
|
|
214
|
+
ret += datefn
|
|
215
|
+
ret.empty? and return ret
|
|
216
|
+
idents[:sdo] and ret += delim
|
|
217
|
+
ret.sub(delim, "").strip.empty? and return ""
|
|
218
|
+
ret
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def biblio_ref_entry_code(ordinal, ids, _id, _standard, datefn, bib)
|
|
222
|
+
delim = bib.at(ns("./language"))&.text == "ja" ? " " : "<esc>,</esc> "
|
|
223
|
+
ret = esc(ids[:ordinal]) || esc(ids[:metanorma]) || "[#{esc ordinal.to_s}]"
|
|
224
|
+
if ids[:sdo] && !ids[:sdo].empty?
|
|
225
|
+
ret = prefix_bracketed_ref(ret)
|
|
226
|
+
ret += "#{esc ids[:sdo]}#{datefn}#{delim}"
|
|
227
|
+
else
|
|
228
|
+
ret = prefix_bracketed_ref("#{ret}#{datefn}")
|
|
229
|
+
end
|
|
230
|
+
ret
|
|
231
|
+
end
|
|
232
|
+
|
|
182
233
|
include Init
|
|
183
234
|
end
|
|
184
235
|
end
|
data/lib/isodoc/jis/xref.rb
CHANGED
|
@@ -69,8 +69,9 @@ module IsoDoc
|
|
|
69
69
|
)
|
|
70
70
|
if elem["unnumbered"] != "true"
|
|
71
71
|
x = semx(elem, sublabel)
|
|
72
|
+
p = elem.at("./ancestor::xmlns:figure")
|
|
72
73
|
@anchors[elem["id"]][:label] = x
|
|
73
|
-
@anchors[elem["id"]][:xref] = @anchors[
|
|
74
|
+
@anchors[elem["id"]][:xref] = @anchors[p["id"]][:xref] +
|
|
74
75
|
subfigure_separator(markup: true) + x + delim_wrap(subfigure_delim)
|
|
75
76
|
end
|
|
76
77
|
end
|
|
@@ -171,12 +172,23 @@ module IsoDoc
|
|
|
171
172
|
label = counter.increment(entry).listlabel(entry.parent, depth)
|
|
172
173
|
s = semx(entry, label)
|
|
173
174
|
base = @c.decode(opts[:prev_label].gsub(%r{<[^>]+>}, "")).split(/\)\s*/) # List a) 1.1.1
|
|
174
|
-
label = "#{base[-1].sub(/^の/,'')}
|
|
175
|
+
label = "#{base[-1].sub(/^の/,'')}<esc>#{clausesep}</esc>#{label}"
|
|
175
176
|
[label, opts[:prev_label] + delim_wrap(clausesep) + s]
|
|
176
177
|
else
|
|
177
178
|
super
|
|
178
179
|
end
|
|
179
180
|
end
|
|
181
|
+
|
|
182
|
+
def hierarchical_figure_names(clause, num)
|
|
183
|
+
#require "debug"; binding.b
|
|
184
|
+
super
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def localise_anchors(type = nil)
|
|
188
|
+
#require "debug"; binding.b
|
|
189
|
+
super
|
|
190
|
+
end
|
|
191
|
+
|
|
180
192
|
end
|
|
181
193
|
end
|
|
182
194
|
end
|
|
@@ -869,7 +869,7 @@ depending on whether the items exist as independent documents, or are parts of a
|
|
|
869
869
|
</zeroOrMore>
|
|
870
870
|
</element>
|
|
871
871
|
</define>
|
|
872
|
-
<define name="BibItemType"
|
|
872
|
+
<define name="BibItemType">
|
|
873
873
|
<a:documentation>Type of bibliographic item.
|
|
874
874
|
The value list complies with the types provided in ISO 690:2021.
|
|
875
875
|
NOTE: These values represent a strict superset to BibTeX
|
|
@@ -311,17 +311,28 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
|
311
311
|
</ref>
|
|
312
312
|
</optional>
|
|
313
313
|
<choice>
|
|
314
|
-
<a:documentation>Content of the figure</a:documentation>
|
|
315
|
-
<ref name="image"
|
|
314
|
+
<a:documentation>Content of the figure </a:documentation>
|
|
315
|
+
<ref name="image">
|
|
316
|
+
<a:documentation>by default the content of a figure is a media file</a:documentation>
|
|
317
|
+
</ref>
|
|
316
318
|
<ref name="video"/>
|
|
317
319
|
<ref name="audio"/>
|
|
318
|
-
<ref name="pre"
|
|
320
|
+
<ref name="pre">
|
|
321
|
+
<a:documentation>figures can contain ASCII art</a:documentation>
|
|
322
|
+
</ref>
|
|
319
323
|
<oneOrMore>
|
|
320
|
-
<ref name="paragraph-with-footnote"
|
|
324
|
+
<ref name="paragraph-with-footnote">
|
|
325
|
+
<a:documentation>figures can contain discursive art</a:documentation>
|
|
326
|
+
</ref>
|
|
321
327
|
</oneOrMore>
|
|
322
328
|
<zeroOrMore>
|
|
323
|
-
<ref name="figure"
|
|
329
|
+
<ref name="figure">
|
|
330
|
+
<a:documentation>subfigures, nested directly within a figure</a:documentation>
|
|
331
|
+
</ref>
|
|
324
332
|
</zeroOrMore>
|
|
333
|
+
<ref name="table">
|
|
334
|
+
<a:documentation>Table is understood in this context to be a tabular arrangement of subfigures</a:documentation>
|
|
335
|
+
</ref>
|
|
325
336
|
</choice>
|
|
326
337
|
<zeroOrMore>
|
|
327
338
|
<ref name="fn">
|
|
@@ -354,17 +365,28 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
|
354
365
|
</ref>
|
|
355
366
|
</optional>
|
|
356
367
|
<choice>
|
|
357
|
-
<a:documentation>Content of the figure</a:documentation>
|
|
358
|
-
<ref name="image-no-id"
|
|
368
|
+
<a:documentation>Content of the figure </a:documentation>
|
|
369
|
+
<ref name="image-no-id">
|
|
370
|
+
<a:documentation>by default the content of a figure is a media file</a:documentation>
|
|
371
|
+
</ref>
|
|
359
372
|
<ref name="video-no-id"/>
|
|
360
373
|
<ref name="audio-no-id"/>
|
|
361
|
-
<ref name="pre-no-id"
|
|
374
|
+
<ref name="pre-no-id">
|
|
375
|
+
<a:documentation>figures can contain ASCII art</a:documentation>
|
|
376
|
+
</ref>
|
|
362
377
|
<oneOrMore>
|
|
363
|
-
<ref name="paragraph-with-footnote-no-id"
|
|
378
|
+
<ref name="paragraph-with-footnote-no-id">
|
|
379
|
+
<a:documentation>figures can contain discursive art</a:documentation>
|
|
380
|
+
</ref>
|
|
364
381
|
</oneOrMore>
|
|
365
382
|
<zeroOrMore>
|
|
366
|
-
<ref name="figure-no-id"
|
|
383
|
+
<ref name="figure-no-id">
|
|
384
|
+
<a:documentation>subfigures, nested directly within a figure</a:documentation>
|
|
385
|
+
</ref>
|
|
367
386
|
</zeroOrMore>
|
|
387
|
+
<ref name="table-no-id">
|
|
388
|
+
<a:documentation>Table is understood in this context to be a tabular arrangement of subfigures</a:documentation>
|
|
389
|
+
</ref>
|
|
368
390
|
</choice>
|
|
369
391
|
<zeroOrMore>
|
|
370
392
|
<ref name="fn">
|
|
@@ -876,6 +898,9 @@ titlecase, or lowercase</a:documentation>
|
|
|
876
898
|
<data type="boolean"/>
|
|
877
899
|
</attribute>
|
|
878
900
|
</optional>
|
|
901
|
+
<ref name="LocalizedStringAttributes">
|
|
902
|
+
<a:documentation>Specify language of bibitem, can be used to render it with language-specific bibliographic style</a:documentation>
|
|
903
|
+
</ref>
|
|
879
904
|
<ref name="ReducedBibliographicItem"/>
|
|
880
905
|
</element>
|
|
881
906
|
</define>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Metanorma
|
|
2
|
+
module Jis
|
|
3
|
+
class Converter
|
|
4
|
+
JIS_LOG_MESSAGES = {
|
|
5
|
+
# rubocop:disable Naming/VariableNumber
|
|
6
|
+
"JIS_1": { category: "Document Attributes",
|
|
7
|
+
error: "%s is not a recognised document type",
|
|
8
|
+
severity: 2 },
|
|
9
|
+
"JIS_2": { category: "Document Attributes",
|
|
10
|
+
error: "%s is not a recognised script",
|
|
11
|
+
severity: 2 },
|
|
12
|
+
}.freeze
|
|
13
|
+
# rubocop:enable Naming/VariableNumber
|
|
14
|
+
|
|
15
|
+
def log_messages
|
|
16
|
+
super.merge(JIS_LOG_MESSAGES)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -4,15 +4,13 @@ module Metanorma
|
|
|
4
4
|
def doctype_validate(_xmldoc)
|
|
5
5
|
%w(japanese-industrial-standard technical-report
|
|
6
6
|
technical-specification amendment).include? @doctype or
|
|
7
|
-
@log.add("
|
|
8
|
-
"#{@doctype} is not a recognised document type")
|
|
7
|
+
@log.add("JIS_1", nil, params: [@doctype])
|
|
9
8
|
end
|
|
10
9
|
|
|
11
10
|
def script_validate(xmldoc)
|
|
12
11
|
script = xmldoc&.at("//bibdata/script")&.text
|
|
13
12
|
%w(Jpan Latn).include?(script) or
|
|
14
|
-
@log.add("
|
|
15
|
-
"#{script} is not a recognised script")
|
|
13
|
+
@log.add("JIS_2", nil, params: [script])
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
def schema_file
|
|
@@ -16,28 +16,75 @@ nametemplate:
|
|
|
16
16
|
# etal_count: 5
|
|
17
17
|
seriestemplate: "{% if series_formatted %}{{ series_formatted }}{%else%}{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{series_num}}|({{series_partnumber}}){%endif%}"
|
|
18
18
|
journaltemplate: "{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{ labels['volume'] }}_{{series_num}} {{ labels['part'] }}_{{series_partnumber}}"
|
|
19
|
+
|
|
20
|
+
citetemplate:
|
|
21
|
+
author_date: "{{ author }} {{ date}}"
|
|
22
|
+
author_date_br: "{{ author }} ({{ date}})"
|
|
23
|
+
author: "{{ author }}"
|
|
24
|
+
date: "{{ date }}"
|
|
25
|
+
reference_tag: "{{ biblio_tag }}"
|
|
26
|
+
title: "{{labels['punct']['open-title']}}|{{ title }}|{{labels['punct']['close-title']}}"
|
|
27
|
+
title_reference_tag: "{{labels['punct']['open-title']}}|{{ title }}|{{labels['punct']['close-title']}} {{ biblio_tag }}"
|
|
28
|
+
short:
|
|
29
|
+
standard: "{% if home_standard %}<span_class='stddocTitle'>{{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}}</span> ,_{{ extent }}{% else %}{{ creatornames }}$$$ <span_class='stddocTitle'>{{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}}</span> ,_{{ extent }} $$$ {{ version }}$$$ {{labels['updated'] | capitalize }}_{{date_updated}}$$$ {{status | capitalize}}$$$ {{ authorizer }}$$${% endif %}"
|
|
30
|
+
website: "{{ creatornames }} ({{ role }}) $$$ <span_class='stddocTitle'>{{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}}</span> [{{ labels['website'] }}]$$$ {{ version }}$$$ {{place}}: {{ publisher }}$$$ {{date}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>"
|
|
31
|
+
book: "{{ creatornames }} ({{role}}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ edition | capitalize_first }}$$$ ({{ series }})$$$ {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
|
|
32
|
+
booklet: book
|
|
33
|
+
manual: book
|
|
34
|
+
techreport: book
|
|
35
|
+
proceedings: book
|
|
36
|
+
inbook: "{{ creatornames }} ({{role}}) $$$ {{labels['punct']['open-secondarytitle']}}{{ title }}{{labels['punct']['close-secondary-title']}} $$$ {{labels['punct']['open-title']}}{{host_title}}{{labels['punct']['close-title']}} ({{host_role}} {{ host_creatornames}})$$$ {{ edition | capitalize_first }}$$$ ({{ series }})$$$ {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
|
|
37
|
+
inproceedings: inbook
|
|
38
|
+
incollection: inbook
|
|
39
|
+
journal: "{{labels['punct']['open-title']}}{{ title}}{{labels['punct']['close-title']}} $$$ {{ edition | capitalize_first }}$$$ {{place}}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}"
|
|
40
|
+
article: "{{ creatornames }} ({{role}}) $$$ {{labels['punct']['open-secondary-title']}}{{ title }}{{labels['punct']['close-secondary-title']}}$$$ {{labels['punct']['open-title']}}{{ series }}{{labels['punct']['close-title']}} $$$ {{date}}, {{ extent }}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}"
|
|
41
|
+
software: "{{ creatornames }} ({{ role}}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ version }}$$$ {{medium | capitalize}}$$$ {{place}}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}"
|
|
42
|
+
electronic resource: software
|
|
43
|
+
dataset: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ version }}$$$ {{medium | capitalize }}$$$ {{ labels['in'] | capitalize }}:_{{series}}$$$ {{date}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ {{ authoritative_identifier | join '$$$' }}$$$ {{ other_identifier | join '$$$' }}$$$ {{ size }}$$$ {{ extent}}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
44
|
+
webresource: website
|
|
45
|
+
unpublished: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ medium | capitalize }}$$$ {{ date }}$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}"
|
|
46
|
+
presentation: unpublished
|
|
47
|
+
thesis: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ medium | capitalize }}$$$ {{place}}: {{ publisher }}$$$ {{ date }}"
|
|
48
|
+
misc: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ date }}"
|
|
49
|
+
# following are # unsupported types:
|
|
50
|
+
map: misc
|
|
51
|
+
audiovisual: misc
|
|
52
|
+
film: misc
|
|
53
|
+
video: misc
|
|
54
|
+
broadcast: misc
|
|
55
|
+
graphic_work: misc
|
|
56
|
+
music: misc
|
|
57
|
+
performance: misc
|
|
58
|
+
patent: misc
|
|
59
|
+
archival: misc
|
|
60
|
+
social_media: misc
|
|
61
|
+
alert: misc
|
|
62
|
+
message: misc
|
|
63
|
+
conversation: misc
|
|
64
|
+
internal: misc
|
|
65
|
+
|
|
19
66
|
template:
|
|
20
67
|
# skip standardidentifier, it is inserted in front of formattedref within metanorma
|
|
21
|
-
standard: "{% if home_standard %}<span_class='stddocTitle'>{{ title }}</span> ,_{{ extent }}{% else %}{{ creatornames }}
|
|
22
|
-
website: "{{ creatornames }} ({{ role }})
|
|
23
|
-
book: "{{ creatornames }} ({{role}})
|
|
68
|
+
standard: "{% if home_standard %}<span_class='stddocTitle'>{{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}}</span> ,_{{ extent }}{% else %}{{ creatornames }}$$$ <span_class='stddocTitle'>{{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}}</span> ,_{{ extent }} $$$ {{ version }}$$$ {{labels['updated'] | capitalize }}_{{date_updated}}$$$ {{status | capitalize}}$$$ {{ authorizer }}$$$ {{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>{% endif %}"
|
|
69
|
+
website: "{{ creatornames }} ({{ role }}) $$$ <span_class='stddocTitle'>{{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}}</span> [{{ labels['website'] }}]$$$ {{ version }}$$$ {{place}}: {{ publisher }}$$$ {{date}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
70
|
+
book: "{{ creatornames }} ({{role}}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ edition | capitalize_first }}$$$ ({{ series }})$$$ {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
24
71
|
booklet: book
|
|
25
72
|
manual: book
|
|
26
73
|
techreport: book
|
|
27
74
|
proceedings: book
|
|
28
|
-
inbook: "{{ creatornames }} ({{role}})
|
|
75
|
+
inbook: "{{ creatornames }} ({{role}}) $$$ {{labels['punct']['open-secondary-title']}}{{ title }}{{labels['punct']['close-secondary-title']}} $$$ {{host_title}} ({{host_role}} {{ host_creatornames}})$$$ {{ edition | capitalize_first }}$$$ ({{ series }})$$$ {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
29
76
|
inproceedings: inbook
|
|
30
77
|
incollection: inbook
|
|
31
|
-
journal: "{{ title}}
|
|
32
|
-
article: "{{ creatornames }} ({{role}})
|
|
33
|
-
software: "{{ creatornames }} ({{ role}})
|
|
78
|
+
journal: "{{labels['punct']['open-title']}}{{ title}}{{labels['punct']['close-title']}} $$$ {{ edition | capitalize_first }}$$$ {{place}}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
79
|
+
article: "{{ creatornames }} ({{role}}) $$$ {{labels['punct']['open-secondary-title']}}{{ title }}{{labels['punct']['close-secondary-title']}}$$$ {{labels['punct']['open-title']}}{{ series }}{{labels['punct']['close-title']}} $$$ {{date}}, {{ extent }}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
80
|
+
software: "{{ creatornames }} ({{ role}}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ version }}$$$ {{medium | capitalize}}$$$ {{place}}: {{publisher}}$$$ {{date}}$$$ {{size}}$$$ {{extent}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ [{{ labels['viewed'] }}:_{{date_accessed}}] "
|
|
34
81
|
electronic resource: software
|
|
35
|
-
dataset: "{{ creatornames }} ({{ role }})
|
|
82
|
+
dataset: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ version }}$$$ {{medium | capitalize }}$$$ {{ labels['in'] | capitalize }}:_{{series}}$$$ {{date}}$$$ {{ labels['updated'] | capitalize }}:_{{date_updated}}$$$ {{ authoritative_identifier | join '$$$' }}$$$ {{ other_identifier | join '$$$' }}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ {{ size }}$$$ {{ extent}}$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
36
83
|
webresource: website
|
|
37
|
-
unpublished: "{{ creatornames }} ({{ role }})
|
|
84
|
+
unpublished: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ medium | capitalize }}$$$ {{ date }}$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
38
85
|
presentation: unpublished
|
|
39
|
-
thesis: "{{ creatornames }} ({{ role }})
|
|
40
|
-
misc: "{{ creatornames }} ({{ role }})
|
|
86
|
+
thesis: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ medium | capitalize }}$$$ {{place}}: {{ publisher }}$$$ {{ date }}$$$ {{ labels['at'] | capitalize}}:_{{ access_location }}$$$ $$$_{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>$$$ [{{ labels['viewed'] }}:_{{date_accessed}}]"
|
|
87
|
+
misc: "{{ creatornames }} ({{ role }}) $$$ {{labels['punct']['open-title']}}{{ title }}{{labels['punct']['close-title']}} $$$ {{ date }}"
|
|
41
88
|
# following are # unsupported types:
|
|
42
89
|
map: misc
|
|
43
90
|
audiovisual: misc
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "metanorma-iso"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Render
|
|
5
|
+
module Jis
|
|
6
|
+
class Fields < ::Relaton::Render::Fields
|
|
7
|
+
def edition_fields_format(hash)
|
|
8
|
+
super
|
|
9
|
+
hash[:version] = versionformat(hash[:edition_raw], hash)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def versionformat(edn, context)
|
|
13
|
+
edn && !edn.empty? or return
|
|
14
|
+
@r.i18n.select(context).populate("version_cardinal", { "var1" => edn })
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -2,6 +2,7 @@ require "relaton-render"
|
|
|
2
2
|
require "metanorma-iso"
|
|
3
3
|
require "isodoc"
|
|
4
4
|
require_relative "parse"
|
|
5
|
+
require_relative "fields"
|
|
5
6
|
|
|
6
7
|
module Relaton
|
|
7
8
|
module Render
|
|
@@ -14,13 +15,7 @@ module Relaton
|
|
|
14
15
|
def klass_initialize(_options)
|
|
15
16
|
super
|
|
16
17
|
@parseklass = Relaton::Render::Jis::Parse
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def render1(doc)
|
|
20
|
-
r = doc.relation.select { |x| x.type == "hasRepresentation" }
|
|
21
|
-
.map { |x| @i18n.also_pub_as + render_single_bibitem(x.bibitem) }
|
|
22
|
-
out = [render_single_bibitem(doc)] + r
|
|
23
|
-
@i18n.l10n(out.join(". ").gsub(/[.。]\. /, ". ").sub(/[.。]\s*$/, ""))
|
|
18
|
+
@fieldsklass = Relaton::Render::Jis::Fields
|
|
24
19
|
end
|
|
25
20
|
|
|
26
21
|
def render_all(bib, type: "author-date")
|
data/metanorma-jis.gemspec
CHANGED
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
|
32
32
|
|
|
33
33
|
spec.add_dependency "japanese_calendar", "~> 0"
|
|
34
|
-
spec.add_dependency "metanorma-iso", "~> 3.
|
|
34
|
+
spec.add_dependency "metanorma-iso", "~> 3.2.0"
|
|
35
35
|
spec.add_dependency "pubid"
|
|
36
36
|
|
|
37
37
|
spec.add_development_dependency "debug"
|
|
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
|
|
|
39
39
|
spec.add_development_dependency "guard", "~> 2.14"
|
|
40
40
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
|
41
41
|
spec.add_development_dependency "iev", "~> 0.3.0"
|
|
42
|
+
spec.add_development_dependency "openssl"
|
|
42
43
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
43
44
|
spec.add_development_dependency "rspec", "~> 3.6"
|
|
44
45
|
spec.add_development_dependency "rubocop", "~> 1"
|
|
@@ -47,5 +48,5 @@ Gem::Specification.new do |spec|
|
|
|
47
48
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
|
48
49
|
spec.add_development_dependency "timecop", "~> 0.9"
|
|
49
50
|
spec.add_development_dependency "webmock"
|
|
50
|
-
spec.add_development_dependency "canon"
|
|
51
|
+
spec.add_development_dependency "canon", "= 0.1.3"
|
|
51
52
|
end
|
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.
|
|
4
|
+
version: 1.0.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: 2025-
|
|
11
|
+
date: 2025-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: japanese_calendar
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 3.
|
|
33
|
+
version: 3.2.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 3.
|
|
40
|
+
version: 3.2.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: pubid
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,6 +122,20 @@ dependencies:
|
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: 0.3.0
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: openssl
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
125
139
|
- !ruby/object:Gem::Dependency
|
|
126
140
|
name: rake
|
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -238,16 +252,16 @@ dependencies:
|
|
|
238
252
|
name: canon
|
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
|
240
254
|
requirements:
|
|
241
|
-
- -
|
|
255
|
+
- - '='
|
|
242
256
|
- !ruby/object:Gem::Version
|
|
243
|
-
version:
|
|
257
|
+
version: 0.1.3
|
|
244
258
|
type: :development
|
|
245
259
|
prerelease: false
|
|
246
260
|
version_requirements: !ruby/object:Gem::Requirement
|
|
247
261
|
requirements:
|
|
248
|
-
- -
|
|
262
|
+
- - '='
|
|
249
263
|
- !ruby/object:Gem::Version
|
|
250
|
-
version:
|
|
264
|
+
version: 0.1.3
|
|
251
265
|
description: |
|
|
252
266
|
metanorma-jis lets you write JIS standards in AsciiDoc syntax.
|
|
253
267
|
|
|
@@ -311,12 +325,14 @@ files:
|
|
|
311
325
|
- lib/metanorma/jis/isodoc.rng
|
|
312
326
|
- lib/metanorma/jis/isostandard.rng
|
|
313
327
|
- lib/metanorma/jis/jis.rng
|
|
328
|
+
- lib/metanorma/jis/log.rb
|
|
314
329
|
- lib/metanorma/jis/processor.rb
|
|
315
330
|
- lib/metanorma/jis/relaton-jis.rng
|
|
316
331
|
- lib/metanorma/jis/reqt.rng
|
|
317
332
|
- lib/metanorma/jis/validate.rb
|
|
318
333
|
- lib/metanorma/jis/version.rb
|
|
319
334
|
- lib/relaton/render-jis/config.yml
|
|
335
|
+
- lib/relaton/render-jis/fields.rb
|
|
320
336
|
- lib/relaton/render-jis/general.rb
|
|
321
337
|
- lib/relaton/render-jis/parse.rb
|
|
322
338
|
- metanorma-jis.gemspec
|