polytexnic 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c446b2fb998709a77a87e98ba9af120969006b56484734a32293cbaca231033
|
4
|
+
data.tar.gz: 3f47c7501336770234680a56af3b4115aeb3c831b04410256a0f6d52d602a407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70d14a3eceafb2fb6bf73bf6f8bebff97467942ac3cf1097bf92c4958667d4a163162766383ec9c3e03f9d637ec555ff801fd547d0536e656aa4ffe958d44fdf
|
7
|
+
data.tar.gz: 390ea1b062ad18eec86bca19632cf66c8f1832a6d7e9d417441e90e653ee38decfbf0759732e494f655eb41b96d1137e302aa15a61b16fec95cb442d1728ad52
|
@@ -68,23 +68,29 @@ module Polytexnic
|
|
68
68
|
end
|
69
69
|
not_a_capital = '[^A-Z]'
|
70
70
|
# Case of "foo. A"
|
71
|
-
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})[ ]+([^\s])/) do
|
71
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})[ \t]+([^\s])/) do
|
72
72
|
$1 + $2 + xmlelement('intersentencespace') + ' ' + $3
|
73
73
|
end
|
74
|
-
# Case of "foo.\n A"
|
75
|
-
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})\n[ ]
|
76
|
-
$1 + $2 + xmlelement('intersentencespace') + ' ' + $3
|
77
|
-
end
|
78
|
-
# Case of "foo.\nA"
|
79
|
-
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})\n([^\n])/) do
|
74
|
+
# Case of "foo.\nA" or "foo.\n A"
|
75
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})[ \t]*\n[ \t]*([^\s])/) do
|
80
76
|
$1 + $2 + xmlelement('intersentencespace') + ' ' + $3
|
81
77
|
end
|
82
78
|
# Case of "foo.} A" or "foo.}} A"
|
83
|
-
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})(\}+)[ ]+([^\s])/) do
|
79
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})(\}+)[ \t]+([^\s])/) do
|
84
80
|
$1 + $2 + $3 + xmlelement('intersentencespace') + ' ' + $4
|
85
81
|
end
|
86
82
|
# Case of "foo.'') A"
|
87
|
-
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})('+)(\))[ ]+([^\s])/) do
|
83
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})('+)(\))[ \t]+([^\s])/) do
|
84
|
+
$1 + $2 + $3 + $4 + xmlelement('intersentencespace') + ' ' + $5
|
85
|
+
end
|
86
|
+
# Case of "foo.}\nA" or "foo.}}\nA"
|
87
|
+
# Matching '.}\n\label' messes up aside boxes, so as a compromise
|
88
|
+
# we detect '.}\n\w', which matches virtually all use cases.
|
89
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})(\}+)\n[ \t]*(\w+)/) do
|
90
|
+
$1 + $2 + $3 + xmlelement('intersentencespace') + ' ' + $4
|
91
|
+
end
|
92
|
+
# Case of "foo.')\nA" or "foo.'')\nA"
|
93
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})('+)(\))\n([^\s])/) do
|
88
94
|
$1 + $2 + $3 + $4 + xmlelement('intersentencespace') + ' ' + $5
|
89
95
|
end
|
90
96
|
# Handle the manual override to force an intersentence space, '\@',
|
data/lib/polytexnic/version.rb
CHANGED
@@ -93,7 +93,12 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
93
93
|
it { should resemble "#{intsp} Bar" }
|
94
94
|
end
|
95
95
|
|
96
|
-
context "with a sentence ending with
|
96
|
+
context "with a sentence ending with curly braces and a newline" do
|
97
|
+
let(:polytex) { "\\emph{\\textbf{Foo.}}\nBar." }
|
98
|
+
it { should resemble "#{intsp} Bar" }
|
99
|
+
end
|
100
|
+
|
101
|
+
context "with a sentence ending with a single quote and a paren" do
|
97
102
|
let(:polytex) { "(It 'isn't.') Is it?"}
|
98
103
|
it { should resemble "(It ’isn’t.’)#{intsp} Is it?" }
|
99
104
|
end
|
@@ -103,12 +108,37 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
103
108
|
it { should resemble "(It ”isn’t.”)#{intsp} Is it?" }
|
104
109
|
end
|
105
110
|
|
111
|
+
context "with a sentence ending with a single quote, paren, newline" do
|
112
|
+
let(:polytex) { "(It 'isn't.')\nIs it?"}
|
113
|
+
it { should resemble "(It ’isn’t.’)#{intsp} Is it?" }
|
114
|
+
end
|
115
|
+
|
116
|
+
context "with a sentence ending with double quotes, paren, newline" do
|
117
|
+
let(:polytex) { "(It ''isn't.'')\nIs it?"}
|
118
|
+
it { should resemble "(It ”isn’t.”)#{intsp} Is it?" }
|
119
|
+
end
|
120
|
+
|
106
121
|
context "with a mid-sentence footnote ending with a period" do
|
107
122
|
let(:polytex) { 'Lorem\footnote{From \emph{Cicero}.} ipsum.' }
|
108
123
|
it { should include 'ipsum' }
|
109
124
|
it { should_not include 'intersentencespace' }
|
110
125
|
end
|
111
126
|
|
127
|
+
context "with only a newline" do
|
128
|
+
let(:polytex) { "Lorem ipsum.\nDolor sit amet." }
|
129
|
+
it { should resemble "Lorem ipsum.#{intsp} Dolor sit amet." }
|
130
|
+
end
|
131
|
+
|
132
|
+
context "with a newline and space" do
|
133
|
+
let(:polytex) { "Lorem ipsum. \n Dolor sit amet." }
|
134
|
+
it { should resemble "Lorem ipsum.#{intsp} Dolor sit amet." }
|
135
|
+
end
|
136
|
+
|
137
|
+
context "with two newlines" do
|
138
|
+
let(:polytex) { "Lorem ipsum.\n\nDolor sit amet." }
|
139
|
+
it { should_not resemble "Lorem ipsum.#{intsp} Dolor sit amet." }
|
140
|
+
end
|
141
|
+
|
112
142
|
context "forced inter-sentence override" do
|
113
143
|
let(:polytex) { 'Superman II\@. Lorem ipsum.' }
|
114
144
|
it { should resemble "Superman II.#{intsp} Lorem ipsum." }
|