metanorma-standoc 3.1.5 → 3.1.6

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: 101539eb3a9ab93dced9b971970f3ff3901d7d85de59be1cac19e92495b0e9d3
4
- data.tar.gz: f628e233575e4b13e92aeb6980fd42c9b97e05256f8e859f892fbb71643247f1
3
+ metadata.gz: 9bc2bfaaaf9871ba417d1d455867a0d67b6df3f219886aa290a6195583eacafc
4
+ data.tar.gz: 3f2a6511903492d4853334fc0780143a7b01d13e8d8f6d27630631208fc10b5d
5
5
  SHA512:
6
- metadata.gz: '0943020cfe1c2a7a7947f470c0443ff200cbb5ca894b8268dda16e66e8e310f810cb0c0dc64d495b544c987d14995bd5e57d69ac25e61432a3b563bf1b8f2036'
7
- data.tar.gz: 1d68cd3ebd13e2681442a65975201ce39bdcf84eaa6f7b299345716e0b091129babaea12eb6faf5af207415af45a5d4a39cf59c362659156fcdf635f8f9b86f4
6
+ metadata.gz: 3485d18dfbe8b3474770f3e97d80652225539cca579b06cf1f0ca9a2ebe414c8ba1663a9b099eabecdea30cd3c630c2bebc54dfc1eb7dd954ffe89155d9d1da4
7
+ data.tar.gz: 8953152a143fbc28f9117e1f593b47e26f06b54eebd6498b71b98c5b5ea91a2240e41fae83af96d5f0a1ae618ebf0cb0d55b6f787db68d4ceb3509937493413c
@@ -145,16 +145,6 @@ div.document-stage-band, div.document-type-band {
145
145
  background-color: #333333;
146
146
  }
147
147
 
148
- a.FootnoteRef + a.FootnoteRef::before {
149
- content: ", ";
150
- vertical-align: super;
151
- }
152
-
153
- a.TableFootnoteRef + a.TableFootnoteRef::before {
154
- content: ", ";
155
- vertical-align: super;
156
- }
157
-
158
148
  a.TableFootnoteRef, span.TableFootnoteRef,
159
149
  a.FootnoteRef, span.FootnoteRef {
160
150
  vertical-align: super;
@@ -477,11 +467,13 @@ body {
477
467
  line-height: 1.4em;
478
468
  color: #1d1d1d;
479
469
  background-color: #ffffff;
480
- font-weight: 400;
481
470
  }
482
471
  body main {
483
472
  margin: 0 3em 0 6em;
484
473
  }
474
+ body {
475
+ font-weight: 400;
476
+ }
485
477
  body pre * {
486
478
  font-family: {{bodyfont}} !important;
487
479
  }
@@ -489,10 +481,6 @@ body pre * {
489
481
  /*
490
482
  2. Responsive navigation layout
491
483
  */
492
- #toc, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) {
493
- font-family: {{bodyfont}};
494
- font-weight: 400;
495
- }
496
484
  #toc ul, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) ul {
497
485
  margin: 0;
498
486
  padding: 0;
@@ -544,6 +532,10 @@ body pre * {
544
532
  color: black;
545
533
  }
546
534
  }
535
+ #toc, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) {
536
+ font-family: {{bodyfont}};
537
+ font-weight: 400;
538
+ }
547
539
  @media screen and (max-width: 768px) {
548
540
  #toc, #toc > ul > :is(.h1, .h2, .h3, .h4, .h5, .h6) {
549
541
  padding: 0 1.5em;
@@ -632,12 +624,6 @@ body pre * {
632
624
  }
633
625
  }
634
626
 
635
- div.figure {
636
- line-height: 1.6em;
637
- padding: 1.5em;
638
- margin: 2em 0 1em 0;
639
- overflow: auto;
640
- }
641
627
  div.figure .FigureTitle, div.figure .figure-title {
642
628
  font-weight: 700;
643
629
  font-size: 1em;
@@ -650,6 +636,12 @@ div.figure > img, div.figure > svg {
650
636
  max-width: 100%;
651
637
  height: auto;
652
638
  }
639
+ div.figure {
640
+ line-height: 1.6em;
641
+ padding: 1.5em;
642
+ margin: 2em 0 1em 0;
643
+ overflow: auto;
644
+ }
653
645
 
654
646
  /*
655
647
  Document types + stages
@@ -969,6 +961,13 @@ p.Biblio, p.NormRef {
969
961
  /*
970
962
  3.6 Source Code + figures
971
963
  */
964
+ .figure .SourceTitle,
965
+ pre .SourceTitle,
966
+ .pseudocode .SourceTitle {
967
+ font-weight: 700;
968
+ font-size: 1em;
969
+ text-align: center;
970
+ }
972
971
  .figure,
973
972
  pre,
974
973
  .pseudocode {
@@ -979,13 +978,6 @@ pre,
979
978
  margin: 2em 0 1em 0;
980
979
  overflow: auto;
981
980
  }
982
- .figure .SourceTitle,
983
- pre .SourceTitle,
984
- .pseudocode .SourceTitle {
985
- font-weight: 700;
986
- font-size: 1em;
987
- text-align: center;
988
- }
989
981
 
990
982
  pre {
991
983
  font-family: {{monospacefont}};
@@ -1032,12 +1024,14 @@ pre {
1032
1024
  padding: 1.2em;
1033
1025
  margin: 2em 0 1em 0;
1034
1026
  text-align: left;
1035
- color: #424242;
1036
- padding-left: 2.7em;
1037
1027
  }
1038
1028
  .example p {
1039
1029
  margin: 0;
1040
1030
  }
1031
+ .example {
1032
+ color: #424242;
1033
+ padding-left: 2.7em;
1034
+ }
1041
1035
  .example .example-title {
1042
1036
  font-weight: 700;
1043
1037
  text-transform: uppercase;
@@ -1318,7 +1312,6 @@ To top button
1318
1312
  cursor: pointer;
1319
1313
  padding: 10px 15px 10px 15px;
1320
1314
  border-radius: 4px;
1321
- text-transform: uppercase;
1322
1315
  }
1323
1316
  #myBtn:hover {
1324
1317
  opacity: 1;
@@ -1328,6 +1321,9 @@ To top button
1328
1321
  display: none;
1329
1322
  }
1330
1323
  }
1324
+ #myBtn {
1325
+ text-transform: uppercase;
1326
+ }
1331
1327
  #myBtn a.anchorjs-link:hover {
1332
1328
  background: none;
1333
1329
  color: #485094;
@@ -139,7 +139,7 @@ module Metanorma
139
139
  %w(presentation semantic).each do |t|
140
140
  /^#{t}-metadata-/.match?(k) or next
141
141
  k = k.sub(/^#{t}-metadata-/, "")
142
- quoted_csv_split(v.gsub("&#", "&#"))&.each do |c|
142
+ csv_split(v.gsub("&#", "&#"), ",", encode: false)&.each do |c|
143
143
  ret << "<#{t}-metadata><#{k}>#{c}</#{k}></#{t}-metadata>"
144
144
  end
145
145
  end
@@ -83,7 +83,9 @@ module Metanorma
83
83
  ext_contributor_cleanup(xmldoc) # feeds: bibdata_cleanup
84
84
  ext_dochistory_cleanup(xmldoc) # feeds: bibdata_cleanup
85
85
  bibdata_cleanup(xmldoc) # feeds: boilerplate_cleanup
86
- boilerplate_cleanup(xmldoc) # feeds: xref_cleanup for new <<>> introduced
86
+ boilerplate_cleanup(xmldoc) # feeds: xref_cleanup for new <<>>
87
+ # introduced, pres_metadata_cleanup
88
+ pres_metadata_cleanup(xmldoc)
87
89
  xref_cleanup(xmldoc)
88
90
  svgmap_cleanup(xmldoc) # feeds: img_cleanup
89
91
  review_cleanup(xmldoc)
@@ -209,6 +211,16 @@ module Metanorma
209
211
  ins = add_misc_container(xmldoc)
210
212
  ins << @metadata_attrs
211
213
  end
214
+
215
+ def pres_metadata_cleanup(xmldoc)
216
+ @isodoc ||= isodoc(@lang, @script, @locale)
217
+ isodoc_bibdata_parse(xmldoc)
218
+ xmldoc.xpath("//presentation-metadata/* | //semantic-metadata/*")
219
+ .each do |x|
220
+ /\{\{|\{%/.match?(x) or next
221
+ x.children = @isodoc.populate_template(to_xml(x.children), nil)
222
+ end
223
+ end
212
224
  end
213
225
  end
214
226
  end
@@ -3,7 +3,7 @@ require_relative "cleanup_terms_boilerplate"
3
3
  module Metanorma
4
4
  module Standoc
5
5
  module Cleanup
6
- def norm_ref_preface(ref)
6
+ def norm_ref_preface(ref, isodoc)
7
7
  ins = norm_ref_boilerplate_insert_location(ref)
8
8
  ins2 = norm_ref_process_boilerplate_note(ref)
9
9
  ins2 == :populated and return
@@ -12,7 +12,7 @@ module Metanorma
12
12
  %w(references bibitem).include? e.name
13
13
  end
14
14
  pref = refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref
15
- ins.next = boilerplate_snippet_convert(pref)
15
+ ins.next = boilerplate_snippet_convert(pref, isodoc)
16
16
  end
17
17
 
18
18
  def norm_ref_process_boilerplate_note(ref)
@@ -40,18 +40,27 @@ module Metanorma
40
40
  "//bibliography/references[@normative = 'true'][not(@hidden)] | " \
41
41
  "//bibliography/clause[.//references[@normative = 'true']]".freeze
42
42
 
43
+ def dup_with_namespace(elem)
44
+ ret = elem.dup
45
+ ret.add_namespace(nil, xml_namespace)
46
+ ret
47
+ end
48
+
43
49
  def boilerplate_isodoc(xmldoc)
44
50
  # prevent infinite recursion of asciidoc boilerplate processing
45
51
  # in termdef_boilerplate_insert and initial_boilerplate
46
52
  xmldoc.at("//metanorma-extension/semantic-metadata/" \
47
53
  "headless[text() = 'true']") and return nil
48
- x = xmldoc.dup
49
- x.root.add_namespace(nil, xml_namespace)
50
- xml = Nokogiri::XML(x.to_xml)
51
54
  @isodoc ||= isodoc(@lang, @script, @locale)
55
+ isodoc_bibdata_parse(xmldoc)
56
+ @isodoc
57
+ end
58
+
59
+ def isodoc_bibdata_parse(xmldoc)
52
60
  # initialise @isodoc.xrefs, for @isodoc.xrefs.info
61
+ x = dup_with_namespace(xmldoc.root)
62
+ xml = Nokogiri::XML(x.to_xml)
53
63
  @isodoc.bibdata(xml) # do i18n
54
- @isodoc
55
64
  end
56
65
 
57
66
  def unwrap_boilerplate_clauses(xmldoc, xpath)
@@ -71,7 +80,7 @@ module Metanorma
71
80
  termdef_boilerplate_insert(xmldoc, isodoc)
72
81
  unwrap_boilerplate_clauses(xmldoc, self.class::TERM_CLAUSE)
73
82
  if f = xmldoc.at(self.class::NORM_REF)
74
- norm_ref_preface(f)
83
+ norm_ref_preface(f, isodoc)
75
84
  unwrap_boilerplate_clauses(f, ".")
76
85
  end
77
86
  initial_boilerplate(xmldoc, isodoc)
@@ -210,16 +219,16 @@ module Metanorma
210
219
  /\.adoc(\.liquid)?$/.match?(file) or return ret
211
220
 
212
221
  # Split content into macro and non-macro parts
213
- parts = ret.split(/(#{ADOC_MACRO_PATTERN})/)
222
+ parts = ret.split(/(#{ADOC_MACRO_PATTERN})/o)
214
223
 
215
224
  parts.map.with_index do |part, index|
216
- if index.odd? && is_valid_macro?(part)
225
+ if index.odd? && valid_macro?(part)
217
226
  # This is a macro - leave unchanged
218
227
  part
219
228
  else
220
229
  # Not a macro - wrap {{ }} patterns
221
230
  part.gsub(/(?<!\{)(\{\{[^{}]+\}\})(?!\})/,
222
- "pass-format:metanorma[++\\1++]")
231
+ "pass-format:metanorma[++\\1++]")
223
232
  end
224
233
  end.join
225
234
  end
@@ -240,7 +249,7 @@ module Metanorma
240
249
 
241
250
  private
242
251
 
243
- def is_valid_macro?(text)
252
+ def valid_macro?(text)
244
253
  # Simple validation - does it look like a macro?
245
254
  text.match?(/^\S+:[^\[]*\[.*\]$/)
246
255
  end
@@ -11,19 +11,20 @@ module Metanorma
11
11
  e.gsub(/%(?=\p{P}|\p{Z}|$)/, sources || "??")
12
12
  end
13
13
 
14
- def boilerplate_snippet_convert(adoc)
15
- ret = boilerplate_xml_cleanup(adoc2xml(adoc, backend.to_sym))
14
+ def boilerplate_snippet_convert(adoc, isodoc)
15
+ b = isodoc.populate_template(adoc, nil)
16
+ ret = boilerplate_xml_cleanup(adoc2xml(b, backend.to_sym))
16
17
  @i18n.l10n(ret.children.to_xml, @lang, @script)
17
18
  end
18
19
 
19
20
  def term_defs_boilerplate(div, source, term, _preface, isodoc)
20
21
  verify_term_defs_source(source)
21
22
  a = @i18n.term_def_boilerplate and
22
- div.next = boilerplate_snippet_convert(a)
23
+ div.next = boilerplate_snippet_convert(a, isodoc)
23
24
  a = if source.empty? && term.nil? then @i18n.no_terms_boilerplate
24
25
  else term_defs_boilerplate_cont(source, term, isodoc)
25
26
  end
26
- a and div.next = boilerplate_snippet_convert(a)
27
+ a and div.next = boilerplate_snippet_convert(a, isodoc)
27
28
  end
28
29
 
29
30
  def verify_term_defs_source(source)
@@ -35,6 +35,7 @@ module Metanorma
35
35
  block_macro Metanorma::Plugin::Lutaml::LutamlKlassTableBlockMacro
36
36
  block_macro Metanorma::Plugin::Lutaml::LutamlEnumTableBlockMacro
37
37
  block Metanorma::Plugin::Plantuml::BlockProcessor
38
+ block_macro Metanorma::Plugin::Plantuml::ImageBlockMacroProcessor
38
39
  preprocessor Metanorma::Standoc::EmbedIncludeProcessor
39
40
  preprocessor Metanorma::Standoc::LinkProtectPreprocessor
40
41
  preprocessor Metanorma::Standoc::PassProtectPreprocessor
@@ -1,6 +1,7 @@
1
1
  require "date"
2
2
  require "pathname"
3
3
  require_relative "./front_contributor"
4
+ require_relative "./front_ext"
4
5
  require "isoics"
5
6
 
6
7
  module Metanorma
@@ -53,17 +54,6 @@ module Metanorma
53
54
  end
54
55
  end
55
56
 
56
- def metadata_ics(node, xml)
57
- ics = node.attr("library-ics")
58
- ics&.split(/,\s*/)&.each do |i|
59
- xml.ics do |elem|
60
- elem.code i
61
- icsdata = Isoics.fetch i
62
- elem.text_ icsdata.description
63
- end
64
- end
65
- end
66
-
67
57
  def metadata_source(node, xml)
68
58
  node.attr("uri") && xml.uri(node.attr("uri"))
69
59
  %w(xml html pdf doc relaton).each do |t|
@@ -183,66 +173,37 @@ module Metanorma
183
173
  end
184
174
  end
185
175
 
186
- def metadata_ext(node, ext)
187
- metadata_doctype(node, ext)
188
- metadata_subdoctype(node, ext)
189
- metadata_flavor(node, ext)
190
- metadata_ics(node, ext)
191
- structured_id(node, ext)
192
- metadata_coverpage_images(node, ext)
193
- end
194
-
195
- def structured_id(node, xml); end
196
-
197
- def metadata_doctype(node, xml)
198
- xml.doctype doctype(node)
199
- end
200
-
201
- def metadata_subdoctype(node, xml)
202
- s = node.attr("docsubtype") and xml.subdoctype s
203
- end
204
-
205
- def metadata_flavor(_node, ext)
206
- ext.flavor processor.new.asciidoctor_backend
207
- end
208
-
209
176
  def metadata_note(node, xml); end
210
177
 
211
178
  def metadata_series(node, xml); end
212
179
 
213
180
  def title(node, xml)
214
- title_english(node, xml)
215
- title_otherlangs(node, xml)
216
- end
217
-
218
- def title_english(node, xml)
219
- ["en"].each do |lang|
220
- at = { language: lang, format: "text/plain" }
221
- xml.title **attr_code(at) do |t|
222
- title = Metanorma::Utils::asciidoc_sub(
223
- node.attr("title") || node.attr("title-en") || node.attr("doctitle"),
224
- )
225
- t << title
226
- end
227
- end
181
+ title_main(node, xml)
182
+ title_other(node, xml)
228
183
  end
229
184
 
230
- def title_otherlangs(node, xml)
185
+ # English plain title: :title: or implicit, typed as main
186
+ def title_main(node, xml)
187
+ title = node.attr("title") || node.attr("doctitle")
188
+ node.attr("title-en") and return
189
+ add_title_xml(xml, title, "en", "main")
190
+ end
191
+
192
+ def title_other(node, xml)
231
193
  node.attributes.each do |k, v|
232
- /^title-(?<titlelang>.+)$/ =~ k or next
233
- titlelang == "en" and next
234
- xml.title v, { language: titlelang, format: "text/plain" }
194
+ /^title-(?<remainder>.+)$/ =~ k or next
195
+ type, language = remainder.split("-", 2)
196
+ if language.nil?
197
+ language = type
198
+ type = "main"
199
+ end
200
+ add_title_xml(xml, v, language, type)
235
201
  end
236
202
  end
237
203
 
238
- def metadata_coverpage_images(node, xml)
239
- %w(coverpage-image innercoverpage-image tocside-image
240
- backpage-image).each do |n|
241
- if a = node.attr(n)
242
- xml.send n do |c|
243
- a.split(",").each { |x| c.image src: x }
244
- end
245
- end
204
+ def add_title_xml(xml, content, language, type)
205
+ xml.title **attr_code(language: language, type: type) do |t|
206
+ t << Metanorma::Utils::asciidoc_sub(content)
246
207
  end
247
208
  end
248
209
  end
@@ -0,0 +1,50 @@
1
+ module Metanorma
2
+ module Standoc
3
+ module Front
4
+ def metadata_ics(node, xml)
5
+ ics = node.attr("library-ics")
6
+ ics&.split(/,\s*/)&.each do |i|
7
+ xml.ics do |elem|
8
+ elem.code i
9
+ icsdata = Isoics.fetch i
10
+ elem.text_ icsdata.description
11
+ end
12
+ end
13
+ end
14
+
15
+ def metadata_ext(node, ext)
16
+ metadata_doctype(node, ext)
17
+ metadata_subdoctype(node, ext)
18
+ metadata_flavor(node, ext)
19
+ metadata_ics(node, ext)
20
+ structured_id(node, ext)
21
+ metadata_coverpage_images(node, ext)
22
+ end
23
+
24
+ def structured_id(node, xml); end
25
+
26
+ def metadata_doctype(node, xml)
27
+ xml.doctype doctype(node)
28
+ end
29
+
30
+ def metadata_subdoctype(node, xml)
31
+ s = node.attr("docsubtype") and xml.subdoctype s
32
+ end
33
+
34
+ def metadata_flavor(_node, ext)
35
+ ext.flavor processor.new.asciidoctor_backend
36
+ end
37
+
38
+ def metadata_coverpage_images(node, xml)
39
+ %w(coverpage-image innercoverpage-image tocside-image
40
+ backpage-image).each do |n|
41
+ if a = node.attr(n)
42
+ xml.send n do |c|
43
+ a.split(",").each { |x| c.image src: x }
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -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.1.2 -->
3
+ <!-- VERSION v2.1.3 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -455,14 +455,7 @@ normative or informative references, some split references into sections organiz
455
455
  </ref>
456
456
  </zeroOrMore>
457
457
  <zeroOrMore>
458
- <ref name="doc_bibitem">
459
- <a:documentation>Bibliographic item cited in the document</a:documentation>
460
- </ref>
461
- <zeroOrMore>
462
- <ref name="note">
463
- <a:documentation>Annotation of the bibliographic item</a:documentation>
464
- </ref>
465
- </zeroOrMore>
458
+ <ref name="ReferenceEntry"/>
466
459
  </zeroOrMore>
467
460
  <zeroOrMore>
468
461
  <ref name="references">
@@ -604,18 +597,21 @@ gives an explicit page orientation</a:documentation>
604
597
  </element>
605
598
  </optional>
606
599
  </define>
607
- </include>
608
- <!-- end overrides -->
609
- <define name="FnAttributes" combine="interleave">
610
- <ref name="RequiredId"/>
611
- <optional>
612
- <attribute name="hiddenref">
613
- <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
600
+ <define name="FnAttributes">
601
+ <ref name="RequiredId"/>
602
+ <optional>
603
+ <attribute name="hiddenref">
604
+ <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
614
605
  This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
615
- <data type="boolean"/>
606
+ <data type="boolean"/>
607
+ </attribute>
608
+ </optional>
609
+ <attribute name="reference">
610
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
616
611
  </attribute>
617
- </optional>
618
- </define>
612
+ </define>
613
+ </include>
614
+ <!-- end overrides -->
619
615
  <define name="TdAttributes" combine="interleave">
620
616
  <ref name="RequiredId"/>
621
617
  <optional>
@@ -853,6 +849,17 @@ titlecase, or lowercase</a:documentation>
853
849
  <value>informative</value>
854
850
  </choice>
855
851
  </define>
852
+ <define name="ReferenceEntry">
853
+ <a:documentation>Entry in bibliography</a:documentation>
854
+ <ref name="doc_bibitem">
855
+ <a:documentation>Bibliographic item cited in the document</a:documentation>
856
+ </ref>
857
+ <zeroOrMore>
858
+ <ref name="note">
859
+ <a:documentation>Annotation of the bibliographic item</a:documentation>
860
+ </ref>
861
+ </zeroOrMore>
862
+ </define>
856
863
  <define name="doc_bibitem">
857
864
  <a:documentation>Standardisation document representation of bibliographic entry</a:documentation>
858
865
  <element name="bibitem">
@@ -27,7 +27,7 @@ module Metanorma
27
27
  def isorefmatchescode(match, _item)
28
28
  code = analyse_ref_code(match[:code])
29
29
  yr = norm_year(match[:year])
30
- { code: match[:code], year: yr, match:,
30
+ { code: match[:code], year: yr, match:, fn: match[:fn],
31
31
  title: match[:text], usrlbl: match[:usrlbl] || code[:usrlabel],
32
32
  analyse_code: code, lang: @lang || :all }
33
33
  end
@@ -58,6 +58,14 @@ module Metanorma
58
58
  end
59
59
  end
60
60
 
61
+ def ref_fn(match, xml)
62
+ if match.names.include?("fn") && match[:fn]
63
+ xml.note(**plaintxt.merge(type: "Unpublished-Status")) do |p|
64
+ p << match[:fn].to_s
65
+ end
66
+ end
67
+ end
68
+
61
69
  def isorefmatches2_1(xml, match, code)
62
70
  xml.bibitem **attr_code(ref_attributes(match)) do |t|
63
71
  isorefrender1(t, match, code, "--")
@@ -65,11 +73,7 @@ module Metanorma
65
73
  d.on "--"
66
74
  end
67
75
  iso_publisher(t, match[:code])
68
- unless match[:fn].nil?
69
- t.note(**plaintxt.merge(type: "Unpublished-Status")) do |p|
70
- p << match[:fn].to_s
71
- end
72
- end
76
+ ref_fn(match, t)
73
77
  end
74
78
  end
75
79
 
@@ -97,11 +101,7 @@ module Metanorma
97
101
  isorefrender1(t, match, code, year, " (all parts)")
98
102
  conditional_date(t, match, year == "--")
99
103
  iso_publisher(t, match[:code])
100
- if match.names.include?("fn") && match[:fn]
101
- t.note(**plaintxt.merge(type: "Unpublished-Status")) do |p|
102
- p << match[:fn].to_s
103
- end
104
- end
104
+ ref_fn(match, t)
105
105
  t.extent type: "part" do |e|
106
106
  e.referenceFrom "all"
107
107
  end
@@ -137,6 +137,7 @@ module Metanorma
137
137
  /^\d+$|^\(.+\)$/.match?(code[:id]) or
138
138
  docnumber(t, code[:id]&.sub(/[:-](19|20)[0-9][0-9]$/, ""))
139
139
  conditional_date(t, yr_match || match, false)
140
+ ref_fn(match, t)
140
141
  end
141
142
  end
142
143
 
@@ -165,11 +166,11 @@ module Metanorma
165
166
  def refitem1code(_item, match)
166
167
  code = analyse_ref_code(match[:code])
167
168
  ((code[:id] && code[:numeric]) || code[:nofetch]) and
168
- return { code: nil, match:, analyse_code: code,
169
+ return { code: nil, match:, analyse_code: code, fn: match[:fn],
169
170
  hidden: code[:hidden] }
170
171
  { code: code[:id], analyse_code: code, localfile: code[:localfile],
171
172
  year: (m = refitem1yr(code[:id])) ? m[:year] : nil,
172
- title: match[:text], match:, hidden: code[:hidden],
173
+ title: match[:text], match:, hidden: code[:hidden], fn: match[:fn],
173
174
  usrlbl: match[:usrlbl] || code[:usrlabel], lang: @lang || :all }
174
175
  end
175
176
 
@@ -195,7 +195,7 @@ module Metanorma
195
195
  def smart_render_xml(xml, code, opts)
196
196
  xml.respond_to? :to_xml or return nil
197
197
  xml = Nokogiri::XML(xml.to_xml(lang: opts[:lang]))
198
- emend_biblio(xml, code, opts[:title], opts[:usrlbl])
198
+ emend_biblio(xml, code, opts)
199
199
  xml.xpath("//date").each { |d| Metanorma::Utils::endash_date(d) }
200
200
  xml.traverse do |n|
201
201
  n.text? and n.replace(Metanorma::Utils::smartformat(n.text))
@@ -53,10 +53,11 @@ module Metanorma
53
53
  end
54
54
  end
55
55
 
56
- def emend_biblio(xml, code, title, usrlbl)
56
+ def emend_biblio(xml, code, opts)
57
57
  emend_biblio_id(xml, code)
58
- emend_biblio_title(xml, code, title)
59
- emend_biblio_usrlbl(xml, usrlbl)
58
+ emend_biblio_title(xml, code, opts[:title])
59
+ emend_biblio_usrlbl(xml, opts[:usrlbl])
60
+ emend_biblio_fn(xml, opts[:fn])
60
61
  end
61
62
 
62
63
  def emend_biblio_id(xml, code)
@@ -86,6 +87,11 @@ module Metanorma
86
87
  xml.at("/bibitem/docidentifier").next =
87
88
  "<docidentifier type='metanorma'>#{mn_code(usrlbl)}</docidentifier>"
88
89
  end
90
+
91
+ def emend_biblio_fn(xml, fnote)
92
+ fnote or return
93
+ xml.root << "<note type='Unpublished-Status'><p>#{fnote}</p></note>"
94
+ end
89
95
  end
90
96
  end
91
97
  end
@@ -53,7 +53,8 @@ module Metanorma
53
53
  ISO_REF =
54
54
  %r{^<ref\sid="(?<anchor>[^"]+)">
55
55
  \[(?<usrlbl>\(.+\))?(?<code>(?:ISO|IEC)[^0-9]*\s[0-9-]+|IEV)
56
- (?::(?<year>[0-9][0-9-]+))?\]</ref>,?\s*(?<text>.*)$}xm
56
+ (?::(?<year>[0-9][0-9-]+))?\]</ref>,?\s*
57
+ (?:<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>)?\s*(?<text>.*)$}xm
57
58
 
58
59
  ISO_REF_NO_YEAR =
59
60
  %r{^<ref\sid="(?<anchor>[^"]+)">
@@ -70,10 +71,12 @@ module Metanorma
70
71
 
71
72
  # These regexes allow () inside usrlbl but not inside code
72
73
  NON_ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
73
- \[(?<usrlbl>\(.+\))?(?<code>.+?)\]</ref>,?\s*(?<text>.*)$}xm
74
+ \[(?<usrlbl>\(.+\))?(?<code>.+?)\]</ref>,?\s*
75
+ (?:<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>)?(?<text>.*)$}xm
74
76
 
75
77
  NON_ISO_REF1 = %r{^<ref\sid="(?<anchor>[^"]+)">
76
- (?<usrlbl>\(.+\))?(?<code>.+?)</ref>,?\s*(?<text>.*)$}xm
78
+ (?<usrlbl>\(.+\))?(?<code>.+?)</ref>,?\s*
79
+ (?:<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>\s*)?(?<text>.*)$}xm
77
80
  end
78
81
  end
79
82
  end
@@ -43,9 +43,11 @@ module Metanorma
43
43
  %(id = "_#{UUIDTools::UUID.random_create}")
44
44
  end
45
45
 
46
- def csv_split(text, delim = ";")
47
- Metanorma::Utils::csv_split(@c.decode(text), delim)
48
- .map { |x| @c.encode(x, :basic, :hexadecimal) }
46
+ def csv_split(text, delim = ";", encode: true)
47
+ ret = Metanorma::Utils::csv_split(@c.decode(text), delim)
48
+ encode and
49
+ ret.map! { |x| @c.encode(x, :basic, :hexadecimal) }
50
+ ret
49
51
  end
50
52
 
51
53
  # quoted strings: key="va,lue",
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "3.1.5".freeze
22
+ VERSION = "3.1.6".freeze
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.5
4
+ version: 3.1.6
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-09-01 00:00:00.000000000 Z
11
+ date: 2025-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -528,6 +528,7 @@ files:
528
528
  - lib/metanorma/standoc/front.rb
529
529
  - lib/metanorma/standoc/front_committee.rb
530
530
  - lib/metanorma/standoc/front_contributor.rb
531
+ - lib/metanorma/standoc/front_ext.rb
531
532
  - lib/metanorma/standoc/front_organisation.rb
532
533
  - lib/metanorma/standoc/init.rb
533
534
  - lib/metanorma/standoc/inline.rb