metanorma-jis 0.5.5 → 0.5.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '028e16564c24076acd2266efc285afc31665c045d7c52d421d1cc86d6a6c2cf4'
4
- data.tar.gz: bcaa409668820ce993abbf1521bd7d8758ef6c9d8d0bdcf756dcb4d5395dfc8f
3
+ metadata.gz: 91ce452f56835d696316e24e201cb29822b12d0d46948a47f61413e5596787d8
4
+ data.tar.gz: c87a9eafd93f339359d1ca573fcc721579ffbaf681d082fdba1e4c7882a469bb
5
5
  SHA512:
6
- metadata.gz: d46e0162e974d7aaae36c63d1ce38e0bb849e46cbc18dffd14fe7acc4b85267a48976f5a3154ee7b326d0d3e9d9148582b094981b5dc6a6456698f549c2790d3
7
- data.tar.gz: 0a05986075fa296bfa633e7903cad32f0ca58aab56362082c6ef5012a549f0537b4741d5b715e3f401874e4a0dee3efb69e6927ad66000b8c218ac71c943a3c3
6
+ metadata.gz: 4dfd857816997b92b13897a1733ba363f6738ab9ce9bfca6e33985ca6f159cadcba79858779939533a666130fea6735dfeb8715fb7b4aa9128049d7258d3b067
7
+ data.tar.gz: 40a71b469f2f7f3b5d8b52eb2d045836990f369dbde2999ae47d6a08859fb7cab83ffe06d0f13af9f690dc062f0bb7c075298d91e17e7a247e54389e0eb20349
@@ -44,7 +44,7 @@ module IsoDoc
44
44
  def table_parse_tail(node, out)
45
45
  node.xpath(ns("./p[@class = 'ListTitle' or @class = 'dl']"))
46
46
  .each { |p| parse(p, out) }
47
- node.xpath(ns("./source")).each { |n| parse(n, out) }
47
+ node.xpath(ns("./fmt-source")).each { |n| parse(n, out) }
48
48
  node.xpath(ns("./note")).each { |n| parse(n, out) }
49
49
  node.xpath(ns("./fmt-footnote-container/fmt-fn-body"))
50
50
  .each { |n| parse(n, out) }
@@ -18,7 +18,7 @@ module IsoDoc
18
18
  key: node.xpath(ns("./p[@class = 'ListTitle' or @class = 'dl']")),
19
19
  img: node.at(ns("./image")),
20
20
  aside: node.at(ns("./aside")),
21
- source: node.at(ns("./source")),
21
+ source: node.at(ns("./fmt-source")),
22
22
  subfigs: node.xpath(ns("./figure")).map { |n| figure_components(n) } }
23
23
  end
24
24
 
@@ -320,8 +320,6 @@ h6:hover > a.anchor,
320
320
 
321
321
  svg {
322
322
  width: 100%;
323
- padding-bottom: 92%;
324
- height: 1px;
325
323
  overflow: visible;
326
324
  }
327
325
 
@@ -320,8 +320,6 @@ h6:hover > a.anchor,
320
320
 
321
321
  svg {
322
322
  width: 100%;
323
- padding-bottom: 92%;
324
- height: 1px;
325
323
  overflow: visible;
326
324
  }
327
325
 
@@ -5878,6 +5878,7 @@
5878
5878
  <xsl:variable name="hair_space"> </xsl:variable>
5879
5879
  <xsl:variable name="en_dash">–</xsl:variable>
5880
5880
  <xsl:variable name="em_dash">—</xsl:variable>
5881
+ <xsl:variable name="nonbreak_space_em_dash_space"> — </xsl:variable>
5881
5882
  <xsl:variable name="cr">&#13;</xsl:variable>
5882
5883
  <xsl:variable name="lf">
5883
5884
  </xsl:variable>
@@ -14156,11 +14157,11 @@
14156
14157
  </xsl:template>
14157
14158
 
14158
14159
  <!-- figure/fn -->
14159
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
14160
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'fn']" priority="2"/>
14160
14161
  <!-- figure/note -->
14161
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
14162
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'note']" priority="2"/>
14162
14163
  <!-- figure/example -->
14163
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
14164
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'example']" priority="2"/>
14164
14165
 
14165
14166
  <!-- figure/note[@type = 'units'] -->
14166
14167
  <!-- image/note[@type = 'units'] -->
@@ -17661,6 +17662,9 @@
17661
17662
  <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="update_xml_pres"/>
17662
17663
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_step1"/>
17663
17664
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_pres"/>
17665
+ <!-- https://github.com/metanorma/isodoc/issues/687 -->
17666
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_step1"/>
17667
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_pres"/>
17664
17668
 
17665
17669
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
17666
17670
  <xsl:copy>
@@ -17943,6 +17947,20 @@
17943
17947
  </xsl:element>
17944
17948
  </xsl:template>
17945
17949
 
17950
+ <xsl:template match="*[local-name() = 'fmt-source']"/>
17951
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_step1">
17952
+ <xsl:element name="source" namespace="{$namespace_full}">
17953
+ <xsl:copy-of select="@*"/>
17954
+ <xsl:apply-templates mode="update_xml_step1"/>
17955
+ </xsl:element>
17956
+ </xsl:template>
17957
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_pres">
17958
+ <xsl:element name="source" namespace="{$namespace_full}">
17959
+ <xsl:copy-of select="@*"/>
17960
+ <xsl:apply-templates mode="update_xml_pres"/>
17961
+ </xsl:element>
17962
+ </xsl:template>
17963
+
17946
17964
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
17947
17965
  <xsl:apply-templates mode="update_xml_step1"/>
17948
17966
  </xsl:template>
@@ -19414,6 +19432,12 @@
19414
19432
  </xsl:if>
19415
19433
  </xsl:template>
19416
19434
 
19435
+ <xsl:template name="setIDforNamedDestinationInline">
19436
+ <xsl:if test="@named_dest">
19437
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
19438
+ </xsl:if>
19439
+ </xsl:template>
19440
+
19417
19441
  <xsl:template name="setNamedDestination">
19418
19442
  <!-- skip GUID, e.g. _33eac3cb-9663-4291-ae26-1d4b6f4635fc -->
19419
19443
  <xsl:if test="@id and normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}')) = 'false'">
@@ -78,18 +78,28 @@ module IsoDoc
78
78
  "<tr><td border='0' colspan='#{cols}'>#{elem}</td></tr>"
79
79
  end
80
80
 
81
- # TODO preserve original Semantic XML source
82
- def tablesource(elem)
81
+ # KILL
82
+ def tablesourcex(elem)
83
83
  ret = [semx_fmt_dup(elem)]
84
- while elem&.next_element&.name == "source"
85
- ret << semx_fmt_dup(elem.next_element.remove)
84
+ n = elem
85
+ while n = n&.next_element
86
+ case n.name
87
+ when "source"
88
+ when "fmt-source"
89
+ ret << to_xml(n.remove.children)
90
+ else break
91
+ end
86
92
  end
87
- s = ret.map { |x| to_xml(x) }.map(&:strip).join("; ")
93
+ s = ret.map(&:strip).join("; ")
88
94
  tablesource_label(elem, s)
89
95
  end
90
96
 
91
- def tablesource_label(elem, sources)
97
+ def source1_label(elem, sources, ancestor)
98
+ case ancestor
99
+ when :table
92
100
  elem.children = l10n("#{@i18n.source}: #{sources}")
101
+ else super
102
+ end
93
103
  end
94
104
 
95
105
  def bibdata_i18n(bibdata)
@@ -267,6 +267,10 @@ in a document (e.g. sourcecode annotations)</a:documentation>
267
267
  <value>justified</value>
268
268
  </choice>
269
269
  </define>
270
+ <define name="IdRefType">
271
+ <a:documentation>Type of cross-references to elements. In BasicDoc, these always point to id { xsd:ID } </a:documentation>
272
+ <data type="IDREF"/>
273
+ </define>
270
274
  <define name="RequiredId">
271
275
  <a:documentation>Mandatory anchor of element, to be used for cross-references within the document</a:documentation>
272
276
  <attribute name="id">
@@ -409,13 +413,13 @@ in a document (e.g. sourcecode annotations)</a:documentation>
409
413
  <attribute name="from">
410
414
  <a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
411
415
  If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
412
- <data type="IDREF"/>
416
+ <ref name="IdRefType"/>
413
417
  </attribute>
414
418
  </optional>
415
419
  <optional>
416
420
  <attribute name="to">
417
421
  <a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
418
- <data type="IDREF"/>
422
+ <ref name="IdRefType"/>
419
423
  </attribute>
420
424
  </optional>
421
425
  </define>
@@ -1504,7 +1508,7 @@ Restricted recursively to contain only other such inline elements with no identi
1504
1508
  <attribute name="to">
1505
1509
  <a:documentation>A reference to an anchor element (typically a bookmark),
1506
1510
  to indicate that the index range covers a range of locations between the current index element and the `to` anchor</a:documentation>
1507
- <data type="IDREF"/>
1511
+ <ref name="IdRefType"/>
1508
1512
  </attribute>
1509
1513
  </optional>
1510
1514
  <ref name="index-primary">
@@ -1662,7 +1666,7 @@ which can be bookmarks as well as block or section references</a:documentation>
1662
1666
  <define name="XrefAttributes">
1663
1667
  <attribute name="target">
1664
1668
  <a:documentation>The identifier of a section, block or inlined element being referenced</a:documentation>
1665
- <data type="IDREF"/>
1669
+ <ref name="IdRefType"/>
1666
1670
  </attribute>
1667
1671
  <optional>
1668
1672
  <attribute name="type">
@@ -1723,7 +1727,7 @@ The target of a footnote is the location it is embedded in within the text</a:do
1723
1727
  <attribute name="target">
1724
1728
  <a:documentation>The target of the callout is understood to be the location of the callout within the source code;
1725
1729
  the extent of the target is not expressed overtly</a:documentation>
1726
- <data type="IDREF"/>
1730
+ <ref name="IdRefType"/>
1727
1731
  </attribute>
1728
1732
  <text>
1729
1733
  <a:documentation>The label of the callout, used to identify its target within the source code</a:documentation>
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <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">
3
- <!-- VERSION v2.0.4 -->
3
+ <!-- VERSION v2.0.6 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -36,6 +36,12 @@
36
36
  </zeroOrMore>
37
37
  </element>
38
38
  </define>
39
+ <define name="IdRefType">
40
+ <a:documentation>Cross-references are not normalised to xsd:IDREF in Semantic XML: that is deferred to Presentation XML.
41
+ All IdRefType instances point not to `@id` in Semantic XML, which is the Content GUID for an element,
42
+ but to `@anchor`, the user-supplied cross-reference</a:documentation>
43
+ <text/>
44
+ </define>
39
45
  <define name="index-primary">
40
46
  <element name="primary">
41
47
  <oneOrMore>
@@ -238,7 +244,7 @@
238
244
  <a:documentation>Notes specific to this block</a:documentation>
239
245
  </ref>
240
246
  </zeroOrMore>
241
- <ref name="TermSource">
247
+ <ref name="BlockSource">
242
248
  <a:documentation>A source for the table</a:documentation>
243
249
  </ref>
244
250
  </define>
@@ -262,10 +268,112 @@ and is intended to be referenced by a callout within the source code</a:document
262
268
  <a:documentation>Notes whose scope is the current block</a:documentation>
263
269
  </ref>
264
270
  </zeroOrMore>
265
- <ref name="TermSource">
271
+ <ref name="BlockSource">
272
+ <a:documentation>A source for the block</a:documentation>
273
+ </ref>
274
+ </define>
275
+ <define name="FigureBody">
276
+ <optional>
277
+ <ref name="tname">
278
+ <a:documentation>The caption of the block</a:documentation>
279
+ </ref>
280
+ </optional>
281
+ <choice>
282
+ <a:documentation>Content of the figure</a:documentation>
283
+ <ref name="image"/>
284
+ <ref name="video"/>
285
+ <ref name="audio"/>
286
+ <ref name="pre"/>
287
+ <oneOrMore>
288
+ <ref name="paragraph-with-footnote"/>
289
+ </oneOrMore>
290
+ <zeroOrMore>
291
+ <ref name="figure"/>
292
+ </zeroOrMore>
293
+ </choice>
294
+ <zeroOrMore>
295
+ <ref name="fn">
296
+ <a:documentation>Footnotes specific to the figure</a:documentation>
297
+ </ref>
298
+ </zeroOrMore>
299
+ <optional>
300
+ <ref name="dl">
301
+ <a:documentation>An optional definitions list defining any symbols used in the figure</a:documentation>
302
+ </ref>
303
+ </optional>
304
+ <zeroOrMore>
305
+ <ref name="note">
306
+ <a:documentation>Notes whose scope is the current block</a:documentation>
307
+ </ref>
308
+ </zeroOrMore>
309
+ <ref name="BlockSource">
310
+ <a:documentation>A source for the block</a:documentation>
311
+ </ref>
312
+ </define>
313
+ <define name="FigureNoIdBody">
314
+ <optional>
315
+ <ref name="source">
316
+ <a:documentation>A URI or other reference intended to link to an externally hosted image (or equivalent)</a:documentation>
317
+ </ref>
318
+ </optional>
319
+ <optional>
320
+ <ref name="tname">
321
+ <a:documentation>The caption of the block</a:documentation>
322
+ </ref>
323
+ </optional>
324
+ <choice>
325
+ <a:documentation>Content of the figure</a:documentation>
326
+ <ref name="image-no-id"/>
327
+ <ref name="video-no-id"/>
328
+ <ref name="audio-no-id"/>
329
+ <ref name="pre-no-id"/>
330
+ <oneOrMore>
331
+ <ref name="paragraph-with-footnote-no-id"/>
332
+ </oneOrMore>
333
+ <zeroOrMore>
334
+ <ref name="figure-no-id"/>
335
+ </zeroOrMore>
336
+ </choice>
337
+ <zeroOrMore>
338
+ <ref name="fn">
339
+ <a:documentation>Footnotes specific to the figure</a:documentation>
340
+ </ref>
341
+ </zeroOrMore>
342
+ <optional>
343
+ <ref name="dl-no-id">
344
+ <a:documentation>An optional definitions list defining any symbols used in the figure</a:documentation>
345
+ </ref>
346
+ </optional>
347
+ <zeroOrMore>
348
+ <ref name="note-no-id">
349
+ <a:documentation>Notes whose scope is the current block</a:documentation>
350
+ </ref>
351
+ </zeroOrMore>
352
+ <ref name="BlockSource">
266
353
  <a:documentation>A source for the block</a:documentation>
267
354
  </ref>
268
355
  </define>
356
+ <define name="source">
357
+ <element name="source">
358
+ <attribute name="status">
359
+ <a:documentation>The status of the term as it is used in this document, relative to its definition in the original document</a:documentation>
360
+ <ref name="SourceStatusType"/>
361
+ </attribute>
362
+ <attribute name="type">
363
+ <a:documentation>The type of the managed term in the present context</a:documentation>
364
+ <ref name="SourceTypeType"/>
365
+ </attribute>
366
+ <ref name="origin">
367
+ <a:documentation>The original document and location where the term definition has been obtained from</a:documentation>
368
+ </ref>
369
+ <optional>
370
+ <ref name="modification">
371
+ <a:documentation>Any changes that the definition of the term has undergone relative to the original document,
372
+ in order to be applicable in this standardisation document</a:documentation>
373
+ </ref>
374
+ </optional>
375
+ </element>
376
+ </define>
269
377
  <define name="sourcecodebody">
270
378
  <a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
271
379
  (The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
@@ -687,6 +795,32 @@ titlecase, or lowercase</a:documentation>
687
795
  </attribute>
688
796
  </optional>
689
797
  </define>
798
+ <define name="RequiredId" combine="interleave">
799
+ <optional>
800
+ <attribute name="anchor">
801
+ <a:documentation>User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
802
+ </attribute>
803
+ </optional>
804
+ <optional>
805
+ <attribute name="source">
806
+ <a:documentation>Sourcing of the current element in an external data model</a:documentation>
807
+ <ref name="IdRefType"/>
808
+ </attribute>
809
+ </optional>
810
+ </define>
811
+ <define name="OptionalId" combine="interleave">
812
+ <optional>
813
+ <attribute name="anchor">
814
+ <a:documentation> User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
815
+ </attribute>
816
+ </optional>
817
+ <optional>
818
+ <attribute name="source">
819
+ <a:documentation>Sourcing of the current element in an external data model</a:documentation>
820
+ <ref name="IdRefType"/>
821
+ </attribute>
822
+ </optional>
823
+ </define>
690
824
  <define name="ObligationType">
691
825
  <a:documentation>The force of a clause in a standard document: whether it has normative or informative effect</a:documentation>
692
826
  <choice>
@@ -832,6 +966,7 @@ titlecase, or lowercase</a:documentation>
832
966
  is used in particular to capture mutually agreed definitions of codepoints in Unicode Private Use Area</a:documentation>
833
967
  </attribute>
834
968
  </optional>
969
+ <ref name="OptionalId"/>
835
970
  <oneOrMore>
836
971
  <ref name="TextElement">
837
972
  <a:documentation>Textual content of span</a:documentation>
@@ -1081,7 +1216,7 @@ That concept may be defined as a term within the current document, or it may be
1081
1216
  <element name="label">
1082
1217
  <!-- Identifier of form input element that this element is a label of -->
1083
1218
  <attribute name="for">
1084
- <data type="IDREF"/>
1219
+ <ref name="IdRefType"/>
1085
1220
  </attribute>
1086
1221
  <zeroOrMore>
1087
1222
  <ref name="PureTextElement"/>
@@ -2121,7 +2256,7 @@ used in document amendments</a:documentation>
2121
2256
  </define>
2122
2257
  <define name="termsource">
2123
2258
  <a:documentation>The bibliographic source where a term is defined in the sense applicable in this standardisation document</a:documentation>
2124
- <element name="termsource">
2259
+ <element name="source">
2125
2260
  <attribute name="status">
2126
2261
  <a:documentation>The status of the term as it is used in this document, relative to its definition in the original document</a:documentation>
2127
2262
  <ref name="SourceStatusType"/>
@@ -2503,6 +2638,11 @@ Normative References contents contain normative references, but as a clause in t
2503
2638
  <ref name="termsource"/>
2504
2639
  </zeroOrMore>
2505
2640
  </define>
2641
+ <define name="BlockSource">
2642
+ <zeroOrMore>
2643
+ <ref name="source"/>
2644
+ </zeroOrMore>
2645
+ </define>
2506
2646
  <start>
2507
2647
  <ref name="standard-document"/>
2508
2648
  </start>
@@ -46,13 +46,17 @@ module Metanorma
46
46
  options_preprocess(options)
47
47
  case format
48
48
  when :html
49
- IsoDoc::Jis::HtmlConvert.new(options).convert(inname, xml, nil, outname)
49
+ IsoDoc::Jis::HtmlConvert.new(options)
50
+ .convert(inname, xml, nil, outname)
50
51
  when :doc
51
- IsoDoc::Jis::WordConvert.new(options).convert(inname, xml, nil, outname)
52
+ IsoDoc::Jis::WordConvert.new(options)
53
+ .convert(inname, xml, nil, outname)
52
54
  when :pdf
53
- IsoDoc::Jis::PdfConvert.new(options).convert(inname, xml, nil, outname)
55
+ IsoDoc::Jis::PdfConvert.new(options)
56
+ .convert(inname, xml, nil, outname)
54
57
  when :presentation
55
- IsoDoc::Jis::PresentationXMLConvert.new(options).convert(inname, xml, nil, outname)
58
+ IsoDoc::Jis::PresentationXMLConvert.new(options)
59
+ .convert(inname, xml, nil, outname)
56
60
  else
57
61
  super
58
62
  end
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Jis
3
- VERSION = "0.5.5".freeze
3
+ VERSION = "0.5.7".freeze
4
4
  end
5
5
  end
6
6
 
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.5
4
+ version: 0.5.7
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-04-29 00:00:00.000000000 Z
11
+ date: 2025-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar