polytexnic 1.7.3 → 1.7.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ae9208f70f3f0a06275683bf047bc73870168cb5501b2726dbbadd8b9c55ceb
4
- data.tar.gz: c712dda3116e33168f71e70fcc19411b66f8c07ce9ae5bbd026dfd1b5b26a8e3
3
+ metadata.gz: bf582b21d2b0ca0b0a5d2fa2da4c5633f0cf1f53b240b9dd591f97b02ac4fc32
4
+ data.tar.gz: 1e04b862d24f44942d23bdd7ca0d68158a1067bed3966f80125eabe72a1045d0
5
5
  SHA512:
6
- metadata.gz: bdad58dffb6636ae21dc2a929a456ed005de8000d08f74b69c12bc5b269805b1c7f20ec026507bc70ed8b5a1ade086db559c42c67a8077c0fd50b770b329d8b0
7
- data.tar.gz: 9f900c12dc794ffa606f9beb8802102369c76f4a8ef1ba82d2902f03f0ed624d2b3ac4d3bb836aae2a5ca0f2223a77a543cd5efe93e57137d8385c3ffb59117c
6
+ metadata.gz: a0e19cfd1a8e44c4a9b2e59e8c15499d25a6137a49eb542acee566928052ec80b445a9f295d44f7c95a8a7d8a5975570c969e12139de5c35b52fed3c517fdfb0
7
+ data.tar.gz: 68a9ff47f302a1dee06aa08bcc911b9cd69b578a3be043e7542104bb392f989195d9a7d48f79198020d15b067f15f46c6c4686e7328dfa908814c5c7bf2c37b6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polytexnic (1.7.3)
4
+ polytexnic (1.7.5)
5
5
  json (~> 2.3.0)
6
6
  kramdown (>= 2.0, < 3.0)
7
7
  msgpack (~> 1.2.0)
@@ -38,7 +38,7 @@ GEM
38
38
  guard-compat (~> 1.1)
39
39
  rspec (>= 2.99.0, < 4.0)
40
40
  json (2.3.1)
41
- kramdown (2.3.2)
41
+ kramdown (2.4.0)
42
42
  rexml
43
43
  listen (3.7.1)
44
44
  rb-fsevent (~> 0.10, >= 0.10.3)
@@ -51,7 +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.6-x86_64-darwin)
54
+ nokogiri (1.13.10-arm64-darwin)
55
55
  racc (~> 1.4)
56
56
  notiffany (0.1.3)
57
57
  nenv (~> 0.1)
@@ -59,10 +59,10 @@ GEM
59
59
  pry (0.14.1)
60
60
  coderay (~> 1.1)
61
61
  method_source (~> 1.0)
62
- pygments.rb (2.3.0)
63
- racc (1.6.0)
62
+ pygments.rb (2.3.1)
63
+ racc (1.6.1)
64
64
  rake (13.0.6)
65
- rb-fsevent (0.11.1)
65
+ rb-fsevent (0.11.2)
66
66
  rb-inotify (0.10.1)
67
67
  ffi (~> 1.0)
68
68
  rest-client (1.6.7)
@@ -88,8 +88,7 @@ GEM
88
88
  tins (0.13.2)
89
89
 
90
90
  PLATFORMS
91
- x86_64-darwin-19
92
- x86_64-darwin-21
91
+ arm64-darwin-21
93
92
 
94
93
  DEPENDENCIES
95
94
  coveralls
@@ -101,4 +100,4 @@ DEPENDENCIES
101
100
  simplecov (~> 0.15.1)
102
101
 
103
102
  BUNDLED WITH
104
- 2.3.10
103
+ 2.3.14
data/arm64-darwin21 ADDED
Binary file
@@ -10,7 +10,9 @@ module Polytexnic
10
10
  def tralics
11
11
  executable = `which tralics`.chomp
12
12
  return executable unless executable.empty?
13
- filename = if os_x_newer?
13
+ filename = if apple_silicon?
14
+ 'tralics-apple-silicon'
15
+ elsif os_x_newer?
14
16
  'tralics-os-x-newer'
15
17
  elsif os_x_older?
16
18
  'tralics-os-x-older'
@@ -33,7 +35,10 @@ module Polytexnic
33
35
 
34
36
 
35
37
  # Expands '\input' command by processing & inserting the target source.
38
+ # We skip tikzstyles since those don't get inserted into the text.
36
39
  def expand_input!(text, code_function, ext = 'md')
40
+ uuid = "52576c7eb84a49b5afc0d9913891f346"
41
+ text.gsub!(/\\input\{(.*\.tikzstyles)\}/) { "#{uuid}-#{$1}-#{uuid}" }
37
42
  text.gsub!(/^[ \t]*\\input\{(.*?)\}[ \t]*$/) do
38
43
  # Prepend a newline for safety.
39
44
  included_text = "\n" + File.read("#{$1}.#{ext}")
@@ -42,6 +47,12 @@ module Polytexnic
42
47
  expand_input!(clean_text, code_function, ext)
43
48
  end
44
49
  end
50
+ text.gsub!(/#{uuid}-(.*)-#{uuid}/) { "\\input{#{$1}}" }
51
+ end
52
+
53
+ # Returns true for Apple Silicon.
54
+ def apple_silicon?
55
+ RUBY_PLATFORM.match(/arm64/)
45
56
  end
46
57
 
47
58
  # Returns true for OS X Mountain Lion (10.8) and later.
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.7.3"
2
+ VERSION = "1.7.5"
3
3
  end
File without changes
@@ -97,4 +97,4 @@ class String
97
97
  stripped_result = result.split("\n").map(&:strip).join("\n")
98
98
  stripped_result.gsub("\n", ' ').gsub(/[ \t]{2,}/, ' ')
99
99
  end
100
- end
100
+ end
@@ -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.7.3
4
+ version: 1.7.5
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-05-19 00:00:00.000000000 Z
12
+ date: 2022-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -226,6 +226,7 @@ files:
226
226
  - LICENSE.md
227
227
  - README.md
228
228
  - Rakefile
229
+ - arm64-darwin21
229
230
  - bin/polytexnic
230
231
  - lib/polytexnic.rb
231
232
  - lib/polytexnic/code_inclusion.rb
@@ -243,6 +244,7 @@ files:
243
244
  - notes/pandoc.md
244
245
  - polytexnic.gemspec
245
246
  - polytexnic_commands.sty
247
+ - precompiled_binaries/tralics-apple-silicon
246
248
  - precompiled_binaries/tralics-armv7l-linux-eabihf
247
249
  - precompiled_binaries/tralics-i686-linux
248
250
  - precompiled_binaries/tralics-os-x-newer