polytexnic 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/polytexnic/literal.rb +3 -1
- data/lib/polytexnic/postprocessors/latex.rb +8 -1
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_latex_spec.rb +12 -1
- 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: 50ed75b9b53138ba115a7af87b3dc690e4dbcf70
|
4
|
+
data.tar.gz: d9a7c85d261e77667c483163c299434e7099a9b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 124b21054c5e3f1cad103613afeeb1b6c139ff52a5d588e5374b4cf195e73d9752884e6da60480431f3cf6802479be3f5bd8aea3d2f877605e588e17d91ed81c
|
7
|
+
data.tar.gz: 5604d325b1edabdef96de6a27cfdd26cd8b7fda8f5af91448c7c3606a68207866d1137551565b661cbbff8ad3fe95eb65b2cca5eb12332f628cf3d5a7cbbc0e1
|
data/lib/polytexnic/literal.rb
CHANGED
@@ -111,6 +111,7 @@ module Polytexnic
|
|
111
111
|
text = []
|
112
112
|
text << line if line.math_environment? || (latex && !language)
|
113
113
|
while (line = lines.shift)
|
114
|
+
puts line.inspect if debug?
|
114
115
|
if line.begin_literal?(literal_type)
|
115
116
|
count += 1
|
116
117
|
elsif line.end_literal?(literal_type)
|
@@ -126,6 +127,7 @@ module Polytexnic
|
|
126
127
|
end
|
127
128
|
raise "Missing \\end{#{line.literal_type}}" if count != 0
|
128
129
|
content = text.join("\n")
|
130
|
+
puts content.inspect if debug?
|
129
131
|
if math
|
130
132
|
key = digest(content)
|
131
133
|
literal_cache[key] = content
|
@@ -168,7 +170,7 @@ module Polytexnic
|
|
168
170
|
end
|
169
171
|
end
|
170
172
|
|
171
|
-
# Returns a permanent salt syntax highlighting cache.
|
173
|
+
# Returns a permanent salt for the syntax highlighting cache.
|
172
174
|
def code_salt
|
173
175
|
'fbbc13ed4a51e27608037365e1d27a5f992b6339'
|
174
176
|
end
|
@@ -9,10 +9,17 @@ module Polytexnic
|
|
9
9
|
puts polytex if debug?
|
10
10
|
polytex.tap do
|
11
11
|
literal_cache.each do |key, value|
|
12
|
-
|
12
|
+
puts value.inspect if debug?
|
13
|
+
polytex.gsub!(key, extra_escape(escape_backslashes(value)))
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
17
|
+
|
18
|
+
# Escapes backslashes even more.
|
19
|
+
# Have I mentioned how much I hate backslashes?
|
20
|
+
def extra_escape(string)
|
21
|
+
string.gsub('\\', '\\\\\\')
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
data/lib/polytexnic/version.rb
CHANGED
data/spec/to_latex_spec.rb
CHANGED
@@ -80,7 +80,7 @@ end
|
|
80
80
|
it { should_not resemble '%= lang:ruby' }
|
81
81
|
end
|
82
82
|
|
83
|
-
describe "
|
83
|
+
describe "Verbatim environments" do
|
84
84
|
let(:polytex) do <<-'EOS'
|
85
85
|
\begin{verbatim}
|
86
86
|
def foo
|
@@ -134,6 +134,17 @@ end
|
|
134
134
|
expect(n_ends).to eq 1
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
context "with code from Urbit docs that broke things" do
|
139
|
+
let(:polytex) do <<-'EOS'
|
140
|
+
\begin{verbatim}
|
141
|
+
~waclux-tomwyc/try=> 'Foo \'bar'
|
142
|
+
\end{verbatim}
|
143
|
+
EOS
|
144
|
+
end
|
145
|
+
|
146
|
+
it { should include "'Foo \\'bar'" }
|
147
|
+
end
|
137
148
|
end
|
138
149
|
|
139
150
|
describe "hyperref links" do
|
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: 0.7.
|
4
|
+
version: 0.7.3
|
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: 2013-12-
|
12
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|