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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb76407e7ba54b0fb488ef09aec322e872b71d75
4
- data.tar.gz: e53153e7c347134405ead39bf70f6cd397964a2a
3
+ metadata.gz: 7c99c9d688840ccd3add5e41a73a4e424e5eeea9
4
+ data.tar.gz: b9f675cd796b25b35f90f50031508b07807c433e
5
5
  SHA512:
6
- metadata.gz: 987622308529332e85a94441ed056a17ef6be8774a961b2310d8b7b9b32c5163c4b74e963c2d2ead5d9ebab3b8358c4e9c067055c36a3d075d09716784edd7c6
7
- data.tar.gz: af9ce3e2739c1aa4383f9925c1dc3c179235394998654c87b746b8132fc0e6edd6f140bef05dc6b6452b81d26220e1d76c6f95832f4f502529f25ffefa2aaa9d
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
- doc.xpath('//error').map(&:remove)
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') + ' ')
@@ -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]{fdsfdas}
137
+ \newcommand{\newunicodechar}[2]{}
138
138
  EOS
139
139
  custom_commands = <<-EOS
140
140
  \\usepackage{amsthm}
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.0.beta7"
2
+ VERSION = "1.0.beta8"
3
3
  end
@@ -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." }
@@ -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.beta7
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-09-18 00:00:00.000000000 Z
12
+ date: 2014-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri