metanorma-standoc 2.0.5.1 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/standoc/cleanup_boilerplate.rb +1 -1
- data/lib/metanorma/standoc/cleanup_text.rb +7 -7
- data/lib/metanorma/standoc/ref.rb +3 -2
- data/lib/metanorma/standoc/validate.rb +3 -3
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/metanorma/refs_spec.rb +2 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +46 -58
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -16
- data/spec/vcr_cassettes/hide_refs.yml +179 -191
- data/spec/vcr_cassettes/isobib_get_123.yml +15 -18
- data/spec/vcr_cassettes/isobib_get_123_1.yml +97 -103
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +111 -119
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -16
- data/spec/vcr_cassettes/isobib_get_124.yml +14 -17
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +19 -17
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +66 -96
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d902ad2befbbd472837eceebed5f29e138d9c10a6dd2a7dc4c465addc6e5bb14
|
4
|
+
data.tar.gz: e84f81d8e37fde67646aac29bfda98a48ed9d5e851318dfb3acfdefca0872d12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
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
|
-
!(
|
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
|
45
|
+
/\S\Z/.match?(prev.text) or return
|
46
46
|
foll = elem.at(".//following::text()[1]")
|
47
|
-
m =
|
47
|
+
m = /\A(["'][[:punct:]]*)(\s|\Z)/
|
48
48
|
.match(HTMLEntities.new.decode(foll&.text)) or return
|
49
|
-
foll.content = foll.text.sub(
|
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
|
-
|
83
|
-
curr.content = curr.text.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
|
-
|
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("
|
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("
|
76
|
-
table.xpath("
|
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)
|
data/spec/metanorma/refs_spec.rb
CHANGED
@@ -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>
|