polytexnic 1.6.1 → 1.6.2
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/Gemfile.lock +15 -16
- data/lib/polytexnic/utils.rb +10 -2
- data/lib/polytexnic/version.rb +1 -1
- data/polytexnic.gemspec +3 -3
- data/spec/to_html/literal_environments/code_spec.rb +34 -8
- data/spec/to_latex_spec.rb +2 -2
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7811a66c9d17ae4c458e5ae584f9d5c7b5d967aa6c6405a34b3e5203c4923e2b
|
4
|
+
data.tar.gz: f50df8db56ef4f75072f4ae6fb094f5cc3e9165a0f982db1f09c4e4c01dd7619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b62df40cecb2a8c2e94a4afcbbb74c013f2395963a405c2f4a6bb7ae859d3325c458e6a1622e6a8aee0eafe72a9b34ecf4789bc8e90bcd65f4c17b6c13dfc4cd
|
7
|
+
data.tar.gz: 5d64cc55e439a0588090320c7911415e75d6267d2d00280fabfd06d92418431cb9cf829303de8b26604fc305a5a2decedd1bd354372559551d31c9e152cdd937
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polytexnic (1.6.
|
4
|
+
polytexnic (1.6.2)
|
5
5
|
json (~> 2.3.0)
|
6
6
|
kramdown (>= 1.17, < 3.0)
|
7
7
|
msgpack (~> 1.2.0)
|
8
|
-
nokogiri (
|
9
|
-
pygments.rb (~>
|
8
|
+
nokogiri (>= 1.6.0, < 2.0)
|
9
|
+
pygments.rb (~> 2.1)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
debugger-linecache (~> 1.2.0)
|
26
26
|
diff-lcs (1.4.4)
|
27
27
|
docile (1.1.5)
|
28
|
-
ffi (1.
|
28
|
+
ffi (1.14.2)
|
29
29
|
formatador (0.2.5)
|
30
30
|
growl (1.0.3)
|
31
31
|
guard (2.16.2)
|
@@ -45,29 +45,28 @@ GEM
|
|
45
45
|
json (2.3.1)
|
46
46
|
kramdown (2.3.0)
|
47
47
|
rexml
|
48
|
-
listen (3.
|
48
|
+
listen (3.4.1)
|
49
49
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
50
50
|
rb-inotify (~> 0.9, >= 0.9.10)
|
51
|
-
lumberjack (1.2.
|
51
|
+
lumberjack (1.2.8)
|
52
52
|
method_source (1.0.0)
|
53
53
|
mime-types (3.3.1)
|
54
54
|
mime-types-data (~> 3.2015)
|
55
|
-
mime-types-data (3.
|
56
|
-
mini_portile2 (2.4.0)
|
55
|
+
mime-types-data (3.2021.0225)
|
57
56
|
msgpack (1.2.10)
|
58
57
|
multi_json (1.15.0)
|
59
58
|
nenv (0.3.0)
|
60
|
-
nokogiri (1.
|
61
|
-
|
59
|
+
nokogiri (1.11.1-x86_64-darwin)
|
60
|
+
racc (~> 1.4)
|
62
61
|
notiffany (0.1.3)
|
63
62
|
nenv (~> 0.1)
|
64
63
|
shellany (~> 0.0)
|
65
|
-
pry (0.
|
64
|
+
pry (0.14.0)
|
66
65
|
coderay (~> 1.1)
|
67
66
|
method_source (~> 1.0)
|
68
|
-
pygments.rb (
|
69
|
-
|
70
|
-
rake (13.0.
|
67
|
+
pygments.rb (2.1.0)
|
68
|
+
racc (1.5.2)
|
69
|
+
rake (13.0.3)
|
71
70
|
rb-fsevent (0.10.4)
|
72
71
|
rb-inotify (0.10.1)
|
73
72
|
ffi (~> 1.0)
|
@@ -94,7 +93,7 @@ GEM
|
|
94
93
|
tins (0.13.2)
|
95
94
|
|
96
95
|
PLATFORMS
|
97
|
-
|
96
|
+
x86_64-darwin-19
|
98
97
|
|
99
98
|
DEPENDENCIES
|
100
99
|
coveralls
|
@@ -107,4 +106,4 @@ DEPENDENCIES
|
|
107
106
|
simplecov (~> 0.15.1)
|
108
107
|
|
109
108
|
BUNDLED WITH
|
110
|
-
2.
|
109
|
+
2.2.13
|
data/lib/polytexnic/utils.rb
CHANGED
@@ -206,9 +206,17 @@ module Polytexnic
|
|
206
206
|
# Inline numbers look much better in HTML but are invalid in LaTeX.
|
207
207
|
options['linenos'] = 'inline'
|
208
208
|
end
|
209
|
-
|
209
|
+
if (lines = options['hl_lines'])
|
210
|
+
content_lines = content.split("\n")
|
211
|
+
if lines.max > content_lines.length
|
212
|
+
err = "\nHighlight line(s) out of range: #{lines.inspect}\n"
|
213
|
+
err += content
|
214
|
+
raise err
|
215
|
+
end
|
216
|
+
end
|
217
|
+
highlight_cache[key] ||= Pygments.highlight(content, lexer: language,
|
210
218
|
formatter: formatter,
|
211
|
-
options:
|
219
|
+
options: options)
|
212
220
|
end
|
213
221
|
|
214
222
|
# Adds some verbatim font info (including size).
|
data/lib/polytexnic/version.rb
CHANGED
data/polytexnic.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["michael@softcover.io"]
|
11
11
|
gem.description = %q{Core translation engine for the softcover gem}
|
12
12
|
gem.summary = %q{Convert from PolyTeX & Markdown to HTML & LaTeX}
|
13
|
-
gem.homepage = "https://
|
13
|
+
gem.homepage = "https://github.com/softcover/polytexnic"
|
14
14
|
gem.license = "MIT"
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($/)
|
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'nokogiri', '
|
22
|
-
gem.add_dependency 'pygments.rb', '~>
|
21
|
+
gem.add_dependency 'nokogiri', '>= 1.6.0', '< 2.0'
|
22
|
+
gem.add_dependency 'pygments.rb', '~> 2.1'
|
23
23
|
gem.add_dependency 'msgpack', '~> 1.2.0'
|
24
24
|
gem.add_dependency 'kramdown', '>= 1.17', '< 3.0'
|
25
25
|
gem.add_dependency 'json', '~> 2.3.0'
|
@@ -98,7 +98,7 @@ describe Polytexnic::Pipeline do
|
|
98
98
|
<div class="code">
|
99
99
|
<div class="highlight">
|
100
100
|
<pre>
|
101
|
-
<span></span>
|
101
|
+
<span></span>
|
102
102
|
<span class="k">def</span> <span class="nf">foo</span>
|
103
103
|
<span class="s2">"bar"</span>
|
104
104
|
<span class="k">end</span>
|
@@ -126,15 +126,15 @@ describe Polytexnic::Pipeline do
|
|
126
126
|
<div class="highlight">
|
127
127
|
<pre>
|
128
128
|
<span></span>
|
129
|
-
<span class="lineno">1</span>
|
130
129
|
<span class="hll">
|
130
|
+
<span class="linenos">1</span>
|
131
131
|
<span class="k">def</span> <span class="nf">foo</span>
|
132
132
|
</span>
|
133
|
-
<span class="lineno">2</span>
|
134
133
|
<span class="hll">
|
134
|
+
<span class="linenos">2</span>
|
135
135
|
<span class="s2">"bar"</span>
|
136
136
|
</span>
|
137
|
-
<span class="
|
137
|
+
<span class="linenos">3</span>
|
138
138
|
<span class="k">end</span>
|
139
139
|
</pre>
|
140
140
|
</div>
|
@@ -143,9 +143,25 @@ describe Polytexnic::Pipeline do
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
+
context "when highlighting HTML" do
|
147
|
+
let(:polytex) do <<-'EOS'
|
148
|
+
%= lang:html, options: "hl_lines": [3], "linenos": true
|
149
|
+
\begin{code}
|
150
|
+
---
|
151
|
+
layout: default
|
152
|
+
title: Gallery for Learn Enough JavaScript to Be Dangerous
|
153
|
+
---
|
154
|
+
|
155
|
+
<div class="gallery col-three">
|
156
|
+
<div class="col col-nav gallery-thumbs" id="gallery-thumbs">
|
157
|
+
\end{code}
|
158
|
+
end
|
159
|
+
it should include('class="linenos"')
|
160
|
+
end
|
161
|
+
|
146
162
|
context "with highlight line out of range" do
|
147
163
|
let(:polytex) do <<-'EOS'
|
148
|
-
%= lang:ruby, options: "hl_lines": [
|
164
|
+
%= lang:ruby, options: "hl_lines": [4], "linenos": true
|
149
165
|
\begin{code}
|
150
166
|
def foo
|
151
167
|
"bar"
|
@@ -155,7 +171,7 @@ describe Polytexnic::Pipeline do
|
|
155
171
|
end
|
156
172
|
|
157
173
|
it "should emit a warning" do
|
158
|
-
|
174
|
+
expect { processed_text }.to raise_error
|
159
175
|
end
|
160
176
|
end
|
161
177
|
|
@@ -238,7 +254,7 @@ describe Polytexnic::Pipeline do
|
|
238
254
|
|
239
255
|
context "with custom options" do
|
240
256
|
let(:polytex) do <<-'EOS'
|
241
|
-
%= <<(polytexnic_commands.sty, lang: tex, options: "hl_lines": [
|
257
|
+
%= <<(polytexnic_commands.sty, lang: tex, options: "hl_lines": [1])
|
242
258
|
EOS
|
243
259
|
end
|
244
260
|
let(:output) do <<-'EOS'
|
@@ -377,7 +393,17 @@ describe Polytexnic::Pipeline do
|
|
377
393
|
|
378
394
|
context "with repo, tag, lang and options" do
|
379
395
|
let(:polytex) do <<-'EOS'
|
380
|
-
%= <<(tagged_file.rb, git: {tag: v0.9.4, repo:"repo_path/.git"}, lang: tex, options: "hl_lines": [
|
396
|
+
%= <<(tagged_file.rb, git: {tag: v0.9.4, repo:"repo_path/.git"}, lang: tex, options: "hl_lines": [2])
|
397
|
+
EOS
|
398
|
+
end
|
399
|
+
let(:output) do <<-'EOS'
|
400
|
+
<div class="code">
|
401
|
+
<div class="highlight">
|
402
|
+
<pre><span></span>Fake data
|
403
|
+
<span class="hll">second line
|
404
|
+
</span></pre>
|
405
|
+
</div>
|
406
|
+
</div>
|
381
407
|
EOS
|
382
408
|
end
|
383
409
|
it_behaves_like "an inclusion"
|
data/spec/to_latex_spec.rb
CHANGED
@@ -29,7 +29,7 @@ Make a code listing as in Listing~\ref{code:hello}.
|
|
29
29
|
\begin{codelisting}
|
30
30
|
\label{code:hello}
|
31
31
|
\codecaption{A hello program in Ruby.}
|
32
|
-
%= lang:ruby, options: "hl_lines": [
|
32
|
+
%= lang:ruby, options: "hl_lines": [2]
|
33
33
|
\begin{code}
|
34
34
|
def hello
|
35
35
|
"hello, world!"
|
@@ -262,4 +262,4 @@ end
|
|
262
262
|
it { should_not include 'xmlelement' }
|
263
263
|
end
|
264
264
|
end
|
265
|
-
end
|
265
|
+
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.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hartl
|
@@ -9,36 +9,42 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.6.0
|
21
|
+
- - "<"
|
19
22
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
23
|
+
version: '2.0'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.6.0
|
31
|
+
- - "<"
|
26
32
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
33
|
+
version: '2.0'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: pygments.rb
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
38
|
- - "~>"
|
33
39
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
40
|
+
version: '2.1'
|
35
41
|
type: :runtime
|
36
42
|
prerelease: false
|
37
43
|
version_requirements: !ruby/object:Gem::Requirement
|
38
44
|
requirements:
|
39
45
|
- - "~>"
|
40
46
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
47
|
+
version: '2.1'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: msgpack
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,7 +289,7 @@ files:
|
|
283
289
|
- tasks/bin/ruby_tests
|
284
290
|
- tasks/run_tests_with_both_rubies.rake
|
285
291
|
- tmp/.gitkeep
|
286
|
-
homepage: https://
|
292
|
+
homepage: https://github.com/softcover/polytexnic
|
287
293
|
licenses:
|
288
294
|
- MIT
|
289
295
|
metadata: {}
|