polytexnic 1.9.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/polytexnic/literal.rb +1 -8
- data/lib/polytexnic/postprocessors/html.rb +3 -1
- data/lib/polytexnic/postprocessors/latex.rb +3 -1
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/characters_and_punctuation_spec.rb +6 -0
- data/spec/to_latex_spec.rb +13 -0
- 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: 7fd013155e321745a2fa54c50bfc39826c9908e3cd6fa4aca280197c805cb6f3
|
4
|
+
data.tar.gz: cf219afa3a0f99c57536bbf9e5e75776515b56b3eec36b3ccd5f4a9adc63c597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 916e1ed5f71cf96fa311426dd8e87bd52e3fd0a0884744085dc9400da972d9648c3216e2c45b33bb50c1a77cbc08322e11ad8f1b8fb6620cd25fa6f69ee62ec1
|
7
|
+
data.tar.gz: a14021cf2f3d7f1d5634bb81198490baab22116484207392841107b1bcb86e9d814d6dedc01fba3b1e58320e28dff459a0e621b0d85f7e4472231c15ce8dacdf
|
data/Gemfile.lock
CHANGED
data/lib/polytexnic/literal.rb
CHANGED
@@ -23,14 +23,9 @@ module Polytexnic
|
|
23
23
|
%w[align* eqnarray* equation* gather* multline*]
|
24
24
|
end
|
25
25
|
|
26
|
-
def math_environments_starred
|
27
|
-
%w[align* eqnarray* equation* gather* multline*]
|
28
|
-
end
|
29
|
-
|
30
26
|
# Returns a list of all literal types.
|
31
27
|
def literal_types
|
32
|
-
%w[verbatim Vertatim code metacode] +
|
33
|
-
math_environments
|
28
|
+
%w[verbatim Vertatim code metacode] + math_environments
|
34
29
|
end
|
35
30
|
|
36
31
|
# Handles environments that should be passed through the pipeline intact.
|
@@ -83,8 +78,6 @@ module Polytexnic
|
|
83
78
|
literal_type = line.literal_type
|
84
79
|
skip = line.math_environment? || latex
|
85
80
|
if line.math_environment? && !latex
|
86
|
-
# puts line
|
87
|
-
# puts "****"
|
88
81
|
output << '\begin{xmlelement*}{equation}'
|
89
82
|
if line.starred?
|
90
83
|
output << '\begin{equation*}'
|
@@ -419,8 +419,10 @@ module Polytexnic
|
|
419
419
|
node.add_next_sibling(space)
|
420
420
|
end
|
421
421
|
# Remove spurious intersentence space from mid-sentence notes.
|
422
|
+
closing_paren = after && after.content[0] == ")"
|
422
423
|
next_sibling = node.next_sibling
|
423
|
-
if !end_of_sentence
|
424
|
+
if ((!end_of_sentence || closing_paren) &&
|
425
|
+
intersentence_space?(next_sibling))
|
424
426
|
next_sibling.remove
|
425
427
|
end
|
426
428
|
end
|
@@ -18,7 +18,9 @@ module Polytexnic
|
|
18
18
|
# Escapes backslashes even more.
|
19
19
|
# Have I mentioned how much I hate backslashes?
|
20
20
|
def extra_escape(string)
|
21
|
-
string.gsub('\\', '\\\\\\')
|
21
|
+
string.gsub('\\', '\\\\\\').
|
22
|
+
gsub("\\'", '\\\\' + "'").
|
23
|
+
gsub('\\\\\\', '\\\\\\')
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
data/lib/polytexnic/version.rb
CHANGED
@@ -139,6 +139,12 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
139
139
|
it { should_not include 'intersentencespace' }
|
140
140
|
end
|
141
141
|
|
142
|
+
context "with parens after a footnote" do
|
143
|
+
let(:polytex) { '(Lorem ipsum.\footnote{From \emph{Cicero}.}) Next' }
|
144
|
+
it { should include 'ipsum' }
|
145
|
+
it { should_not include 'intersentencespace' }
|
146
|
+
end
|
147
|
+
|
142
148
|
context "with only a newline" do
|
143
149
|
let(:polytex) { "Lorem ipsum.\nDolor sit amet." }
|
144
150
|
it { should resemble "Lorem ipsum.#{intsp} Dolor sit amet." }
|
data/spec/to_latex_spec.rb
CHANGED
@@ -103,6 +103,19 @@ end
|
|
103
103
|
|
104
104
|
it { should resemble polytex }
|
105
105
|
|
106
|
+
context "align* environment" do
|
107
|
+
let(:polytex) do <<-'EOS'
|
108
|
+
\begin{align*}
|
109
|
+
x &= 1\\
|
110
|
+
y & = 2 \\
|
111
|
+
x + y &= 3
|
112
|
+
\end{align*}
|
113
|
+
EOS
|
114
|
+
end
|
115
|
+
|
116
|
+
it { should resemble polytex }
|
117
|
+
end
|
118
|
+
|
106
119
|
context "containing an example of highlighted code" do
|
107
120
|
let(:polytex) do <<-'EOS'
|
108
121
|
\begin{verbatim}
|
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.9.
|
4
|
+
version: 1.9.2
|
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: 2023-08-
|
12
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|