metanorma-standoc 2.0.5.1 → 2.0.5.2
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_text.rb +7 -7
- data/lib/metanorma/standoc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75c1f0434e53ee6bfe52bd329b1ddc84f08386c39da60ff1a00f6a34914b7709
|
4
|
+
data.tar.gz: c7ff940d7544e1d81b4a9ac7e3d0f42bc0398a34b8a5e7036ffe4806a2776615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 965db9580243b582af5051840e1a258e74963383bdcb377691cbb5aac2fbec083096cd201aca8c677f0a637ab793b3aa762fb02f5aa7767e710469bc39f0a8a0
|
7
|
+
data.tar.gz: 894d7350c1438462826073b48a7db77889466aa7d122b991c2c4bb212a12177bab53095a76d9a2e4444a355f6b5343b0f1d7be008c347fdc84f9df52f60924f8
|
@@ -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
|
|