metanorma-jis 0.5.1 → 0.5.2
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 +11 -2
- data/lib/isodoc/jis/html_convert.rb +2 -1
- data/lib/isodoc/jis/jis.international-standard.xsl +530 -219
- data/lib/isodoc/jis/presentation_xml_convert.rb +49 -26
- data/lib/isodoc/jis/table.rb +2 -1
- data/lib/isodoc/jis/word_convert.rb +2 -3
- data/lib/metanorma/jis/basicdoc.rng +37 -32
- data/lib/metanorma/jis/isodoc.rng +32 -17
- data/lib/metanorma/jis/version.rb +1 -1
- metadata +2 -2
@@ -42,12 +42,12 @@ module IsoDoc
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def admits(elem)
|
45
|
-
#elem.children.first.previous = @i18n.l10n("#{@i18n.admitted}: ")
|
46
45
|
elem.xpath(ns(".//semx[@element = 'admitted']")).each do |t|
|
47
|
-
|
48
|
-
|
46
|
+
t.previous = @i18n.l10n("#{@i18n.admitted}: ")
|
47
|
+
end
|
49
48
|
end
|
50
49
|
|
50
|
+
# TODO: move the table/figure key processing to Word, not Presentation XML
|
51
51
|
def dl(docxml)
|
52
52
|
super
|
53
53
|
docxml.xpath(ns("//table//dl | //figure//dl")).each do |l|
|
@@ -130,30 +130,18 @@ module IsoDoc
|
|
130
130
|
"<tr><td border='0' colspan='#{cols}'>#{elem}</td></tr>"
|
131
131
|
end
|
132
132
|
|
133
|
-
#
|
133
|
+
# TODO preserve original Semantic XML source
|
134
134
|
def tablesource(elem)
|
135
|
+
ret = [semx_fmt_dup(elem)]
|
135
136
|
while elem&.next_element&.name == "source"
|
136
|
-
|
137
|
+
ret << semx_fmt_dup(elem.next_element.remove)
|
137
138
|
end
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
# TODO preserve original Semantic XML source
|
142
|
-
def tablesource(elem)
|
143
|
-
ret = [semx_fmt_dup(elem)]
|
144
|
-
while elem&.next_element&.name == "source"
|
145
|
-
ret << semx_fmt_dup(elem.next_element.remove)
|
139
|
+
s = ret.map { |x| to_xml(x) }.map(&:strip).join("; ")
|
140
|
+
tablesource_label(elem, s)
|
146
141
|
end
|
147
|
-
s = ret.map { |x| to_xml(x) }.map(&:strip).join("; ")
|
148
|
-
tablesource_label(elem, s)
|
149
|
-
end
|
150
|
-
|
151
|
-
def tablesource_label(elem, sources)
|
152
|
-
elem.children = l10n("#{@i18n.source}: #{sources}")
|
153
|
-
end
|
154
142
|
|
155
|
-
def
|
156
|
-
|
143
|
+
def tablesource_label(elem, sources)
|
144
|
+
elem.children = l10n("#{@i18n.source}: #{sources}")
|
157
145
|
end
|
158
146
|
|
159
147
|
def bibdata_i18n(bibdata)
|
@@ -204,10 +192,15 @@ module IsoDoc
|
|
204
192
|
end
|
205
193
|
|
206
194
|
def figure_fn(elem)
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
195
|
+
fnotes = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn"))
|
196
|
+
ret = footnote_collect(fnotes)
|
197
|
+
f = footnote_container(fnotes, ret) and elem << f
|
198
|
+
end
|
199
|
+
|
200
|
+
def table_fn(elem)
|
201
|
+
fnotes = elem.xpath(ns(".//fn"))
|
202
|
+
ret = footnote_collect(fnotes)
|
203
|
+
f = footnote_container(fnotes, ret) and elem << f
|
211
204
|
end
|
212
205
|
|
213
206
|
def omit_docid_prefix(prefix)
|
@@ -215,6 +208,36 @@ module IsoDoc
|
|
215
208
|
super || %w(JIS).include?(prefix)
|
216
209
|
end
|
217
210
|
|
211
|
+
def fn_ref_label(fnote)
|
212
|
+
if fnote.ancestors("table, figure").empty? ||
|
213
|
+
!fnote.ancestors("figure").empty? &&
|
214
|
+
!fnote.ancestors("name, fmt-name").empty?
|
215
|
+
"<sup>#{fn_label(fnote)}</sup>"
|
216
|
+
else
|
217
|
+
"<sup>#{fn_label(fnote)}" \
|
218
|
+
"<span class='fmt-label-delim'>)</span></sup>"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def fn_body_label(fnote)
|
223
|
+
if fnote.ancestors("table, figure").empty? ||
|
224
|
+
!fnote.ancestors("figure").empty? &&
|
225
|
+
!fnote.ancestors("name, fmt-name").empty?
|
226
|
+
"<sup>#{fn_label(fnote)}</sup>"
|
227
|
+
else
|
228
|
+
spc = %w(zh ja ko).include?(@lang) ? "" : " "
|
229
|
+
"#{@i18n.table_footnote}#{spc}<sup>#{fn_label(fnote)}" \
|
230
|
+
"<span class='fmt-label-delim'>)</span></sup>"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def non_document_footnotes(docxml)
|
235
|
+
table_fns = docxml.xpath(ns("//table//fn"))
|
236
|
+
fig_fns = docxml.xpath(ns("//figure//fn")) -
|
237
|
+
docxml.xpath(ns("//figure/name//fn"))
|
238
|
+
table_fns + fig_fns
|
239
|
+
end
|
240
|
+
|
218
241
|
include Init
|
219
242
|
end
|
220
243
|
end
|
data/lib/isodoc/jis/table.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Jis
|
3
3
|
class WordConvert < IsoDoc::Iso::WordConvert
|
4
|
-
|
4
|
+
# KILL
|
5
|
+
def make_table_footnote_targetx(out, fnid, fnref)
|
5
6
|
attrs = { id: fnid, class: "TableFootnoteRef" }
|
6
7
|
out.span do |s|
|
7
8
|
s << @i18n.table_footnote
|
@@ -109,11 +109,10 @@ module IsoDoc
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
|
112
|
+
# KILL
|
113
|
+
def footnote_parsex(node, out)
|
113
114
|
return table_footnote_parse(node, out) if @in_table || @in_figure # &&
|
114
115
|
|
115
|
-
# !node.ancestors.map(&:name).include?("name")
|
116
|
-
|
117
116
|
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
118
117
|
return seen_footnote_parse(node, out, fn) if @seen_footnote.include?(fn)
|
119
118
|
|
@@ -599,17 +599,9 @@ It is included for convenience, in case processing the citation to extract the a
|
|
599
599
|
<a:documentation>The caption of the block</a:documentation>
|
600
600
|
</ref>
|
601
601
|
</optional>
|
602
|
-
<
|
603
|
-
<
|
604
|
-
|
605
|
-
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
606
|
-
(The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
|
607
|
-
</text>
|
608
|
-
<ref name="callout">
|
609
|
-
<a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
|
610
|
-
</ref>
|
611
|
-
</choice>
|
612
|
-
</oneOrMore>
|
602
|
+
<ref name="sourcecodebody">
|
603
|
+
<a:documentation>The sourcecode content</a:documentation>
|
604
|
+
</ref>
|
613
605
|
<zeroOrMore>
|
614
606
|
<ref name="annotation">
|
615
607
|
<a:documentation>Annotations to the source code; each annotation consists of zero or more paragraphs,
|
@@ -628,17 +620,9 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
628
620
|
<a:documentation>The caption of the block</a:documentation>
|
629
621
|
</ref>
|
630
622
|
</optional>
|
631
|
-
<
|
632
|
-
<
|
633
|
-
|
634
|
-
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
635
|
-
(The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
|
636
|
-
</text>
|
637
|
-
<ref name="callout">
|
638
|
-
<a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
|
639
|
-
</ref>
|
640
|
-
</choice>
|
641
|
-
</oneOrMore>
|
623
|
+
<ref name="sourcecodebody">
|
624
|
+
<a:documentation>The sourcecode content</a:documentation>
|
625
|
+
</ref>
|
642
626
|
<zeroOrMore>
|
643
627
|
<ref name="annotation">
|
644
628
|
<a:documentation>Annotations to the source code; each annotation consists of zero or more paragraphs,
|
@@ -651,6 +635,20 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
651
635
|
</ref>
|
652
636
|
</zeroOrMore>
|
653
637
|
</define>
|
638
|
+
<define name="sourcecodebody">
|
639
|
+
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
640
|
+
(The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
|
641
|
+
<element name="body">
|
642
|
+
<oneOrMore>
|
643
|
+
<choice>
|
644
|
+
<text/>
|
645
|
+
<ref name="callout">
|
646
|
+
<a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
|
647
|
+
</ref>
|
648
|
+
</choice>
|
649
|
+
</oneOrMore>
|
650
|
+
</element>
|
651
|
+
</define>
|
654
652
|
<define name="pre">
|
655
653
|
<a:documentation>Pre-formatted block. Wrapper for text to be rendered with fixed-width typeface, and preserving spaces including line breaks.
|
656
654
|
They are intended for a restricted number of functions, most typically ASCII Art (which is still in prominent use in some
|
@@ -1672,18 +1670,25 @@ which can be bookmarks as well as block or section references</a:documentation>
|
|
1672
1670
|
</optional>
|
1673
1671
|
</define>
|
1674
1672
|
<define name="XrefBody">
|
1675
|
-
<
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1673
|
+
<a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `<xx>my link text</xx>`)</a:documentation>
|
1674
|
+
<optional>
|
1675
|
+
<element name="display-text">
|
1676
|
+
<oneOrMore>
|
1677
|
+
<ref name="PureTextElement"/>
|
1678
|
+
</oneOrMore>
|
1679
|
+
</element>
|
1680
|
+
</optional>
|
1680
1681
|
</define>
|
1681
1682
|
<define name="ErefBody">
|
1682
|
-
<
|
1683
|
-
<
|
1684
|
-
<
|
1685
|
-
|
1686
|
-
|
1683
|
+
<optional>
|
1684
|
+
<element name="display-text">
|
1685
|
+
<oneOrMore>
|
1686
|
+
<ref name="PureTextElement">
|
1687
|
+
<a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `<xx>my link text</xx>`)</a:documentation>
|
1688
|
+
</ref>
|
1689
|
+
</oneOrMore>
|
1690
|
+
</element>
|
1691
|
+
</optional>
|
1687
1692
|
</define>
|
1688
1693
|
<define name="fn">
|
1689
1694
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
|
@@ -33,6 +33,15 @@
|
|
33
33
|
</zeroOrMore>
|
34
34
|
</element>
|
35
35
|
</define>
|
36
|
+
<define name="fn" combine="interleave">
|
37
|
+
<optional>
|
38
|
+
<attribute name="hiddenref">
|
39
|
+
<a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
|
40
|
+
This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
</define>
|
36
45
|
<define name="index-primary">
|
37
46
|
<element name="primary">
|
38
47
|
<oneOrMore>
|
@@ -245,23 +254,9 @@
|
|
245
254
|
<a:documentation>The caption of the block</a:documentation>
|
246
255
|
</ref>
|
247
256
|
</optional>
|
248
|
-
<
|
249
|
-
<
|
250
|
-
|
251
|
-
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
252
|
-
(The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
|
253
|
-
</text>
|
254
|
-
<ref name="callout">
|
255
|
-
<a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
|
256
|
-
</ref>
|
257
|
-
<ref name="xref">
|
258
|
-
<a:documentation>Hyperlink of code segment to another part of the document</a:documentation>
|
259
|
-
</ref>
|
260
|
-
<ref name="eref">
|
261
|
-
<a:documentation>Hyperlink of code segment to external bibliographic resource</a:documentation>
|
262
|
-
</ref>
|
263
|
-
</choice>
|
264
|
-
</oneOrMore>
|
257
|
+
<ref name="sourcecodebody">
|
258
|
+
<a:documentation>The sourcecode content</a:documentation>
|
259
|
+
</ref>
|
265
260
|
<zeroOrMore>
|
266
261
|
<ref name="annotation">
|
267
262
|
<a:documentation>Annotations to the source code; each annotation consists of zero or more paragraphs,
|
@@ -277,6 +272,26 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
277
272
|
<a:documentation>A source for the block</a:documentation>
|
278
273
|
</ref>
|
279
274
|
</define>
|
275
|
+
<define name="sourcecodebody">
|
276
|
+
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
277
|
+
(The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
|
278
|
+
<element name="body">
|
279
|
+
<oneOrMore>
|
280
|
+
<choice>
|
281
|
+
<text/>
|
282
|
+
<ref name="callout">
|
283
|
+
<a:documentation>Zero or more cross-references; these are intended to be embedded within the content string, and link to annotations</a:documentation>
|
284
|
+
</ref>
|
285
|
+
<ref name="xref">
|
286
|
+
<a:documentation>Hyperlink of code segment to another part of the document</a:documentation>
|
287
|
+
</ref>
|
288
|
+
<ref name="eref">
|
289
|
+
<a:documentation>Hyperlink of code segment to external bibliographic resource</a:documentation>
|
290
|
+
</ref>
|
291
|
+
</choice>
|
292
|
+
</oneOrMore>
|
293
|
+
</element>
|
294
|
+
</define>
|
280
295
|
<define name="sections">
|
281
296
|
<element name="sections">
|
282
297
|
<oneOrMore>
|
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.5.
|
4
|
+
version: 0.5.2
|
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-03-
|
11
|
+
date: 2025-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: japanese_calendar
|