polytexnic 1.0.beta7 → 1.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/polytexnic/postprocessors/html.rb +7 -2
- data/lib/polytexnic/preprocessors/html.rb +4 -0
- data/lib/polytexnic/utils.rb +1 -1
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/characters_and_punctuation_spec.rb +5 -0
- data/spec/to_html/core_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c99c9d688840ccd3add5e41a73a4e424e5eeea9
|
4
|
+
data.tar.gz: b9f675cd796b25b35f90f50031508b07807c433e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4fe8193a39805b0114fe33a63e80916560c18e89eb8e9b963b78da4cdd14c2fce3135ee464a0fd8d98343017932d7b9a8ecaccd28cb9c6e29c502bebf3fb50
|
7
|
+
data.tar.gz: 97a80e005643620f5a937402d481ed8be79e3987f06d0dd4b42eb6c82d196f15bba05013265041d51af21ef2beb003dcf51eb557616e478d3496c825cdd4e74d
|
@@ -450,8 +450,13 @@ module Polytexnic
|
|
450
450
|
end
|
451
451
|
|
452
452
|
# Removes remaining errors.
|
453
|
+
# Also included is the 'newpage' & 'allowbreak' tags, which
|
454
|
+
# theoretically should have been added to the list of ignored commands
|
455
|
+
# in utils.rb#tralics_commands, but for some reason that doesn't work.
|
453
456
|
def remove_errors(doc)
|
454
|
-
|
457
|
+
%w[newpage allowbreak error].each do |tag|
|
458
|
+
doc.xpath("//#{tag}").map(&:remove)
|
459
|
+
end
|
455
460
|
end
|
456
461
|
|
457
462
|
# Set the Tralics ids.
|
@@ -940,7 +945,7 @@ module Polytexnic
|
|
940
945
|
|
941
946
|
# Unescapes some special characters that are escaped by kramdown.
|
942
947
|
def unescape_special_chars(url)
|
943
|
-
url.gsub(/\\_/, '_').gsub(/\\#/, '#')
|
948
|
+
url.gsub(/\\_/, '_').gsub(/\\#/, '#').gsub(/\\%/, '%')
|
944
949
|
end
|
945
950
|
|
946
951
|
# Handles both \includegraphics and figure environments.
|
@@ -79,6 +79,10 @@ module Polytexnic
|
|
79
79
|
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})\n([^\n])/) do
|
80
80
|
$1 + $2 + xmlelement('intersentencespace') + ' ' + $3
|
81
81
|
end
|
82
|
+
# Case of "foo.}} A"
|
83
|
+
doc.gsub!(/(#{not_a_capital})(#{end_of_sentence})(\})+[ ]+([^\s])/) do
|
84
|
+
$1 + $2 + $3 + xmlelement('intersentencespace') + ' ' + $4
|
85
|
+
end
|
82
86
|
# Handle the manual override to force an inter-sentence space, '\@',
|
83
87
|
# as in 'Superman II\@. A new sentence'.
|
84
88
|
doc.gsub!(/\\@\. /, '.' + xmlelement('intersentencespace') + ' ')
|
data/lib/polytexnic/utils.rb
CHANGED
@@ -134,7 +134,7 @@ module Polytexnic
|
|
134
134
|
\newcommand{\pbox}[2]{#2}
|
135
135
|
% Ignore some other commands.
|
136
136
|
\newcommand{\includepdf}[1]{}
|
137
|
-
\newcommand{\newunicodechar}[2]{
|
137
|
+
\newcommand{\newunicodechar}[2]{}
|
138
138
|
EOS
|
139
139
|
custom_commands = <<-EOS
|
140
140
|
\\usepackage{amsthm}
|
data/lib/polytexnic/version.rb
CHANGED
@@ -88,6 +88,11 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
88
88
|
it { should resemble "“Yes, indeed!”#{intsp} A new sentence." }
|
89
89
|
end
|
90
90
|
|
91
|
+
context "with sentence ending with curly braces" do
|
92
|
+
let(:polytex) { "\\emph{\\textbf{Foo.}} Bar." }
|
93
|
+
it { should resemble "#{intsp} Bar" }
|
94
|
+
end
|
95
|
+
|
91
96
|
context "forced inter-sentence override" do
|
92
97
|
let(:polytex) { 'Superman II\@. Lorem ipsum.' }
|
93
98
|
it { should resemble "Superman II.#{intsp} Lorem ipsum." }
|
data/spec/to_html/core_spec.rb
CHANGED
@@ -221,6 +221,12 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
221
221
|
it { should include '>Example Site</a>' }
|
222
222
|
end
|
223
223
|
|
224
|
+
context "containing an escaped percent" do
|
225
|
+
let(:polytex) { '\href{http://example.com/escaped\%20text}{Example Site}' }
|
226
|
+
it { should include '<a href="http://example.com/escaped%20text"' }
|
227
|
+
it { should include '>Example Site</a>' }
|
228
|
+
end
|
229
|
+
|
224
230
|
context "self-linking URL" do
|
225
231
|
let(:polytex) { '\url{http://example.com/}' }
|
226
232
|
it { should include '<a href="http://example.com/"' }
|
@@ -286,5 +292,15 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
286
292
|
let(:polytex) { '\newunicodechar{├}{\textSFviii}' }
|
287
293
|
it { should_not include '├' }
|
288
294
|
end
|
295
|
+
|
296
|
+
context "\\newpage" do
|
297
|
+
let(:polytex) { '\newpage' }
|
298
|
+
it { should_not include 'newpage' }
|
299
|
+
end
|
300
|
+
|
301
|
+
context "\\allowbreak" do
|
302
|
+
let(:polytex) { '\allowbreak' }
|
303
|
+
it { should_not include 'allowbreak' }
|
304
|
+
end
|
289
305
|
end
|
290
306
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polytexnic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.beta8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hartl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|