metanorma-standoc 2.0.5.1 → 2.0.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: cfc9dd3ae0dd167d4c3b92c4b051619cde74ae602a66c9b34e363af1498682a0
4
- data.tar.gz: 1cde7c4c003cdf59c2ef85e0ec1fc3247095716b6fc4f99b121c638f0744aaf9
3
+ metadata.gz: d902ad2befbbd472837eceebed5f29e138d9c10a6dd2a7dc4c465addc6e5bb14
4
+ data.tar.gz: e84f81d8e37fde67646aac29bfda98a48ed9d5e851318dfb3acfdefca0872d12
5
5
  SHA512:
6
- metadata.gz: af0f552acb3f93c8c2e1f1bff1ca60fadff61a5242e08bf0de29df086906a14025a1f6b2d2fb23a6e97afdd086fb60c9b812a91359056e6195a42a6d1d305630
7
- data.tar.gz: cfad71e3de0a31950aee00c477a50449b97eb436ea6261584b73c616d7d24d30ab380ff7504b0357bd5e234752639a7705a43dca46f9f15983114ea50eaf2210
6
+ metadata.gz: 07d40940c3dac1176e80861e39b1fa527c9ae5c028cbde11624677c85f17645160c230725d1c010de16121a47031360c354a62db164534d6fba7d2d5456af8bf
7
+ data.tar.gz: 8f2220572c54be5e184d63fa694ce031be239a10d06888c92ac91f028ffa5bee9d2cf516e043df921dc5d932529d9686fadcb4b0547a5604717b14f261650310
@@ -126,7 +126,7 @@ module Metanorma
126
126
  file = File.join(@localdir,
127
127
  @boilerplateauthority)
128
128
  end
129
- (!file.nil? and File.exists?(file)) or return
129
+ (!file.nil? and File.exist?(file)) or return
130
130
  conv.populate_template(File.read(file, encoding: "UTF-8"), nil)
131
131
  end
132
132
 
@@ -2,7 +2,7 @@ module Metanorma
2
2
  module Standoc
3
3
  module Cleanup
4
4
  def textcleanup(result)
5
- text = result.flatten.map { |l| l.sub(/\s*$/, "") } * "\n"
5
+ text = result.flatten.map { |l| l.sub(/\s*\Z/, "") } * "\n"
6
6
  !@keepasciimath and text = asciimath2mathml(text)
7
7
  text = text.gsub(/\s+<fn /, "<fn ")
8
8
  text.gsub(%r{<passthrough\s+formats="metanorma">([^<]*)
@@ -32,7 +32,7 @@ module Metanorma
32
32
  end
33
33
 
34
34
  def uninterrupt_quotes_around_xml_skip(elem)
35
- !(/^['"]/.match?(elem.text) &&
35
+ !(/\A['"]/.match?(elem.text) &&
36
36
  elem.previous.ancestors("pre, tt, sourcecode, stem, figure, bibdata")
37
37
  .empty? &&
38
38
  ((elem.previous.text.strip.empty? &&
@@ -42,11 +42,11 @@ module Metanorma
42
42
 
43
43
  def uninterrupt_quotes_around_xml1(elem)
44
44
  prev = elem.at(".//preceding::text()[1]") or return
45
- /\S$/.match?(prev.text) or return
45
+ /\S\Z/.match?(prev.text) or return
46
46
  foll = elem.at(".//following::text()[1]")
47
- m = /^(["'][[:punct:]]*)(\s|$)/
47
+ m = /\A(["'][[:punct:]]*)(\s|\Z)/
48
48
  .match(HTMLEntities.new.decode(foll&.text)) or return
49
- foll.content = foll.text.sub(/^(["'][[:punct:]]*)/, "")
49
+ foll.content = foll.text.sub(/\A(["'][[:punct:]]*)/, "")
50
50
  prev.content = "#{prev.text}#{m[1]}"
51
51
  end
52
52
 
@@ -79,8 +79,8 @@ module Metanorma
79
79
  def dumb2smart_quotes1(curr, prev)
80
80
  /[-'"(<>]|\.\.|\dx/.match?(curr.text) or return
81
81
 
82
- /^["']/.match?(curr.text) && prev.match?(/\S$/) and
83
- curr.content = curr.text.sub(/^"/, "”").sub(/"’"/, "‘")
82
+ /\A["']/.match?(curr.text) && prev.match?(/\S\Z/) and
83
+ curr.content = curr.text.sub(/\A"/, "”").sub(/\A'/, "‘")
84
84
  curr.replace(Metanorma::Utils::smartformat(curr.text))
85
85
  end
86
86
 
@@ -108,7 +108,7 @@ module Metanorma
108
108
  bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), **{ type: "URI" }
109
109
  bib.uri code[:key].sub(/\.[a-zA-Z0-9]+$/, ""), **{ type: "citation" }
110
110
  end
111
- code[:id].sub!(/[:-](19|20)[0-9][0-9]$/, "")
111
+ # code[:id].sub!(/[:-](19|20)[0-9][0-9]$/, "")
112
112
  docid(bib, match[:usrlbl]) if match[:usrlbl]
113
113
  docid(bib, /^\d+$/.match?(code[:id]) ? "[#{code[:id]}]" : code[:id])
114
114
  code[:type] == "repo" and
@@ -123,7 +123,8 @@ module Metanorma
123
123
  end
124
124
  yr_match = /[:-](?<year>(?:19|20)[0-9][0-9])\b/.match(code[:id])
125
125
  refitem_render1(match, code, t)
126
- docnumber(t, code[:id]) unless /^\d+$|^\(.+\)$/.match?(code[:id])
126
+ /^\d+$|^\(.+\)$/.match?(code[:id]) or
127
+ docnumber(t, code[:id].sub(/[:-](19|20)[0-9][0-9]$/, ""))
127
128
  conditional_date(t, yr_match || match, false)
128
129
  end
129
130
  end
@@ -64,7 +64,7 @@ module Metanorma
64
64
 
65
65
  def max_td_count(table)
66
66
  max = 0
67
- table.xpath(".//tr").each do |tr|
67
+ table.xpath("./tr").each do |tr|
68
68
  n = tr.xpath("./td | ./th").size
69
69
  max < n and max = n
70
70
  end
@@ -72,8 +72,8 @@ module Metanorma
72
72
  end
73
73
 
74
74
  def maxrowcols_validate(table, maxcols)
75
- cells2d = table.xpath(".//tr").each_with_object([]) { |_r, m| m << {} }
76
- table.xpath(".//tr").each_with_index do |tr, r|
75
+ cells2d = table.xpath("./*/tr").each_with_object([]) { |_r, m| m << {} }
76
+ table.xpath("./*/tr").each_with_index do |tr, r|
77
77
  curr = 0
78
78
  tr.xpath("./td | ./th").each do |td|
79
79
  curr = maxcols_validate1(td, r, curr, cells2d, maxcols)
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.0.5.1".freeze
22
+ VERSION = "2.0.6".freeze
23
23
  end
24
24
  end
@@ -970,7 +970,7 @@ RSpec.describe Metanorma::Standoc do
970
970
  <formattedref format='application/x-isodoc+xml'>
971
971
  <em>Standard</em>
972
972
  </formattedref>
973
- <docidentifier type='ISO'>ISO/IEC TR 12382</docidentifier>
973
+ <docidentifier type='ISO'>ISO/IEC TR 12382:1992</docidentifier>
974
974
  <docnumber>12382</docnumber>
975
975
  <date type='published'><on>1992</on></date>
976
976
  </bibitem>
@@ -1820,7 +1820,7 @@ RSpec.describe Metanorma::Standoc do
1820
1820
  <em>Standard</em>
1821
1821
  </formattedref>
1822
1822
  <docidentifier type='metanorma'>[1]</docidentifier>
1823
- <docidentifier>XYZ 123</docidentifier>
1823
+ <docidentifier>XYZ 123:1966</docidentifier>
1824
1824
  <docnumber>123</docnumber>
1825
1825
  <date type='published'>
1826
1826
  <on>1966</on>