polytexnic 1.7.4 → 1.8.0
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 +6 -10
- data/lib/polytexnic/utils.rb +4 -0
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_latex_spec.rb +5 -1
- 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: 661b389f86877d73f04e77626ac0f94edfd3e4e9e6ea9060489f88446421ce78
|
4
|
+
data.tar.gz: 2057c1bc6a0c75ee9b12ac21ca1cb44576fb8e25fef4f9e07c3bb1db487aa9b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55f620674b1f78f0241fb7e1dd3e7f3394e89784866a760a1e1a5576ac7de90475edb7de3eaf9340ee26907536604a0731b2625acc8e75cedc24998d2a4f517
|
7
|
+
data.tar.gz: 5f99100eeaeec45de820fc3df6272d0c49a4f179bc9585986a9f589daa3baf5f4348562bee9af93c2ec1f750bde10ee81bc234808eb6c6f0771e44bd980343a0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polytexnic (1.
|
4
|
+
polytexnic (1.8.0)
|
5
5
|
json (~> 2.3.0)
|
6
6
|
kramdown (>= 2.0, < 3.0)
|
7
7
|
msgpack (~> 1.2.0)
|
@@ -51,9 +51,7 @@ GEM
|
|
51
51
|
msgpack (1.2.10)
|
52
52
|
multi_json (1.15.0)
|
53
53
|
nenv (0.3.0)
|
54
|
-
nokogiri (1.13.
|
55
|
-
racc (~> 1.4)
|
56
|
-
nokogiri (1.13.8-x86_64-darwin)
|
54
|
+
nokogiri (1.13.10-arm64-darwin)
|
57
55
|
racc (~> 1.4)
|
58
56
|
notiffany (0.1.3)
|
59
57
|
nenv (~> 0.1)
|
@@ -61,10 +59,10 @@ GEM
|
|
61
59
|
pry (0.14.1)
|
62
60
|
coderay (~> 1.1)
|
63
61
|
method_source (~> 1.0)
|
64
|
-
pygments.rb (2.3.
|
65
|
-
racc (1.6.
|
62
|
+
pygments.rb (2.3.1)
|
63
|
+
racc (1.6.1)
|
66
64
|
rake (13.0.6)
|
67
|
-
rb-fsevent (0.11.
|
65
|
+
rb-fsevent (0.11.2)
|
68
66
|
rb-inotify (0.10.1)
|
69
67
|
ffi (~> 1.0)
|
70
68
|
rest-client (1.6.7)
|
@@ -91,8 +89,6 @@ GEM
|
|
91
89
|
|
92
90
|
PLATFORMS
|
93
91
|
arm64-darwin-21
|
94
|
-
x86_64-darwin-19
|
95
|
-
x86_64-darwin-21
|
96
92
|
|
97
93
|
DEPENDENCIES
|
98
94
|
coveralls
|
@@ -104,4 +100,4 @@ DEPENDENCIES
|
|
104
100
|
simplecov (~> 0.15.1)
|
105
101
|
|
106
102
|
BUNDLED WITH
|
107
|
-
2.3.
|
103
|
+
2.3.14
|
data/lib/polytexnic/utils.rb
CHANGED
@@ -35,7 +35,10 @@ module Polytexnic
|
|
35
35
|
|
36
36
|
|
37
37
|
# Expands '\input' command by processing & inserting the target source.
|
38
|
+
# We skip tikzstyles since those don't get inserted into the text.
|
38
39
|
def expand_input!(text, code_function, ext = 'md')
|
40
|
+
uuid = "52576c7eb84a49b5afc0d9913891f346"
|
41
|
+
text.gsub!(/\\input\{(.*\.tikzstyles)\}/) { "#{uuid}-#{$1}-#{uuid}" }
|
39
42
|
text.gsub!(/^[ \t]*\\input\{(.*?)\}[ \t]*$/) do
|
40
43
|
# Prepend a newline for safety.
|
41
44
|
included_text = "\n" + File.read("#{$1}.#{ext}")
|
@@ -44,6 +47,7 @@ module Polytexnic
|
|
44
47
|
expand_input!(clean_text, code_function, ext)
|
45
48
|
end
|
46
49
|
end
|
50
|
+
text.gsub!(/#{uuid}-(.*)-#{uuid}/) { "\\input{#{$1}}" }
|
47
51
|
end
|
48
52
|
|
49
53
|
# Returns true for Apple Silicon.
|
data/lib/polytexnic/version.rb
CHANGED
data/spec/to_latex_spec.rb
CHANGED
@@ -230,6 +230,7 @@ end
|
|
230
230
|
describe '\input command' do
|
231
231
|
let(:external_file) { 'foo.tex' }
|
232
232
|
let(:nested_external_file) { 'bar.tex' }
|
233
|
+
let(:tikzstyles_file) { 'test.tikzstyles' }
|
233
234
|
let(:input) do <<-'EOS'
|
234
235
|
Lorem ipsum
|
235
236
|
%= lang:ruby
|
@@ -252,13 +253,15 @@ end
|
|
252
253
|
before do
|
253
254
|
File.write(external_file, input)
|
254
255
|
File.write(nested_external_file, nested_input)
|
256
|
+
File.write(tikzstyles_file, "lorem ipsum")
|
255
257
|
end
|
256
258
|
after do
|
257
259
|
File.unlink(external_file)
|
258
260
|
File.unlink(nested_external_file)
|
261
|
+
File.unlink(tikzstyles_file)
|
259
262
|
end
|
260
263
|
|
261
|
-
let(:polytex) { "\\chapter{Foo}\n\n \\input{foo} " }
|
264
|
+
let(:polytex) { "\\chapter{Foo}\n\n \\input{foo}\n\n \\input{test.tikzstyles}" }
|
262
265
|
let(:foo_latex) do
|
263
266
|
'\PY{k}{def} \PY{n+nf}{foo}\PY{p}{;}'
|
264
267
|
end
|
@@ -268,6 +271,7 @@ end
|
|
268
271
|
|
269
272
|
it { should include foo_latex }
|
270
273
|
it { should include bar_latex }
|
274
|
+
it { should include '\input{test.tikzstyles}' }
|
271
275
|
it { should_not include 'xmlelement' }
|
272
276
|
end
|
273
277
|
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.
|
4
|
+
version: 1.8.0
|
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: 2022-
|
12
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|