polytexnic 1.10.3 → 1.10.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da8b7f3f92a5c8273442057b775fe5fb9254b8cea720e116d412fb69a88d2cab
4
- data.tar.gz: a4a31b444ae75f2b556a3d306f965c386c2e5aa04c08e57d46d5225e3e311e9e
3
+ metadata.gz: 537f908aaaed4b7ffdd66a1af25c647b2f09bc01d66fdcad47335b47f53795b7
4
+ data.tar.gz: 5d29427b13c4896326c30eb27461588ce57e6b7e7460cd7a1b2ef513568a469f
5
5
  SHA512:
6
- metadata.gz: 7296046560b0eee4a54c02c2f2c06a797dbe244a6a5a2b93ed1997529e88ad605c6589c645427ca22de026e356f6d128737a4478447cdefe3c16634ded71e0a7
7
- data.tar.gz: 3ca36eebc4379605f6fb3579dd8d6c0c10a4d5f37a65610ae3541b3d565f700c63c56e3f758ae8ef68fadcd1f1b35d2c1168c27bf6984b7ce55d87e6ad78a5e2
6
+ metadata.gz: fa43d394b64dd3b75a80e78d1ae179f355d92b46e45e6440b723fd43ab86f76fe87404d2003915eddf4f76b7af37dea5bbdf5e533361db1f7f6ab9dc78286c99
7
+ data.tar.gz: f912d164306c4b0b4f36462fc96de57f719ace3b391e5906b19df581e22801d646aea3b0e7dc65a363db0d576da3fa03dfc55ea7945114a0730504fdee20b999
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polytexnic (1.10.3)
4
+ polytexnic (1.10.5)
5
5
  json (= 2.3.1)
6
6
  kramdown (= 2.4.0)
7
7
  msgpack (= 1.2.10)
@@ -60,7 +60,7 @@ GEM
60
60
  coderay (~> 1.1)
61
61
  method_source (~> 1.0)
62
62
  pygments.rb (2.3.1)
63
- racc (1.7.1)
63
+ racc (1.7.3)
64
64
  rake (13.0.6)
65
65
  rb-fsevent (0.11.2)
66
66
  rb-inotify (0.10.1)
@@ -221,11 +221,19 @@ module Polytexnic
221
221
  listing = language_labels["listing"]
222
222
  equation = language_labels["equation"]
223
223
  eq = language_labels["eq"]
224
- linked_item = "(#{part}|#{chapter}|#{section}|#{appendix}|#{table}|#{box}|#{figure}" +
225
- "|#{fig}\.|#{listing}|#{equation}|#{eq}\.)"
224
+ @supported_theorem_types.each do |theorem|
225
+ eval("#{theorem} = language_labels['#{theorem}']")
226
+ end
227
+ theorem_string = @supported_theorem_types.map(&:capitalize).join("|")
228
+ linked_item = "(#{part}|#{chapter}|#{section}|#{appendix}|#{table}" +
229
+ "|#{box}|#{figure}|#{fig}\.|#{listing}|#{equation}" +
230
+ "|#{eq}\.|#{theorem_string})"
226
231
  ref = /(?:#{linked_item}(~| ))*(\\(?:eq)*ref){(.*?)}/i
227
232
  string.gsub!(ref) do
228
- "\\hyperref[#{$4}]{#{$1}#{$2}#{$3}{#{$4}}}"
233
+ # The outermost braces handle the edge case of a ref inside
234
+ # square-backet args, as in `\proof[Theorem~\ref{th:foo}]`.
235
+ # See https://tex.stackexchange.com/questions/513460/how-to-add-a-hyperref-inside-theorem-title-or-proof-name
236
+ "{\\hyperref[#{$4}]{#{$1}#{$2}#{$3}{#{$4}}}}"
229
237
  end
230
238
  end
231
239
 
@@ -307,4 +315,3 @@ class String
307
315
  end.join('|')
308
316
  end
309
317
  end
310
-
@@ -150,7 +150,7 @@ module Polytexnic
150
150
  |
151
151
  ~\\eqref\{.*?\} # eq reference with a tie
152
152
  |
153
- \\[^\s]+\{.*?\} # command with one arg
153
+ \\[^\s(]+\{.*?\} # command with one arg
154
154
  |
155
155
  \\\w+ # normal command
156
156
  |
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.10.3"
2
+ VERSION = "1.10.5"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  This is some inline math: $\int_\Omega d\omega = \int_{\partial\Omega} \omega$ (the general form of Stokes's Theorem). Here's some more: \( \varphi^2 = \varphi + 1 \).
2
2
 
3
- Our main strategy for producing HTML is to pass it through as-is and let MathJax handle the rendering.
3
+ Our main strategy for producing HTML is to pass it through as-is and let MathJax handle the rendering.
@@ -248,16 +248,21 @@ Chapter~\ref{cha:one}
248
248
  it { should include 'Chapter~\ref{cha:one}' }
249
249
  end
250
250
 
251
- context "an inline equation" do
251
+ context "inline math" do
252
252
  let(:source) { '\( x \) is a variable' }
253
253
  it { should include source }
254
254
  end
255
255
 
256
- context "an inline equation with a newline" do
256
+ context "inline math with a newline" do
257
257
  let(:source) { '\( x' + "\n" + ' + y \) is a sum' }
258
258
  it { should include source }
259
259
  end
260
260
 
261
+ context "an inline math with no spaces" do
262
+ let(:source) { '\(\mathbb{R}\)'}
263
+ it { should include source }
264
+ end
265
+
261
266
  context "a centered equation" do
262
267
  let(:source) { '\[ x^2 - 2 = 0 \] is an equation' }
263
268
  it { should resemble source }
@@ -95,9 +95,9 @@ describe 'Polytexnic::Pipeline#to_html' do
95
95
  it { should include("Remark</span> 1.5") }
96
96
  it { should include("Theorem</span> 2.1") }
97
97
  it { should include("Lemma</span> 2.2") }
98
- it { should include('Theorem <a href="#th-lorem" class="hyperref"><span class="ref">1.1</span></a>')}
99
- it { should include('Theorem <a href="#th-another" class="hyperref"><span class="ref">2.1</span></a>')}
100
- it { should include('Lemma <a href="#lemma-yet_another" class="hyperref"><span class="ref">2.2</span></a>')}
98
+ it { should include('<a href="#th-lorem" class="hyperref">Theorem <span class="ref">1.1</span></a>')}
99
+ it { should include('<a href="#th-another" class="hyperref">Theorem <span class="ref">2.1</span></a>')}
100
+ it { should include('<a href="#lemma-yet_another" class="hyperref">Lemma <span class="ref">2.2</span></a>')}
101
101
  end
102
102
 
103
103
  describe "articles theorems" do
@@ -164,9 +164,9 @@ describe 'Polytexnic::Pipeline#to_html' do
164
164
  it { should include("Remark</span> 5") }
165
165
  it { should include("Theorem</span> 6") }
166
166
  it { should include("Lemma</span> 7") }
167
- it { should include('Theorem <a href="#th-lorem" class="hyperref"><span class="ref">1</span></a>')}
168
- it { should include('Theorem <a href="#th-another" class="hyperref"><span class="ref">6</span></a>')}
169
- it { should include('Lemma <a href="#lemma-yet_another" class="hyperref"><span class="ref">7</span></a>')}
167
+ it { should include('<a href="#th-lorem" class="hyperref">Theorem <span class="ref">1</span></a>')}
168
+ it { should include('<a href="#th-another" class="hyperref">Theorem <span class="ref">6</span></a>')}
169
+ it { should include('<a href="#lemma-yet_another" class="hyperref">Lemma <span class="ref">7</span></a>')}
170
170
  end
171
171
 
172
172
  describe "optional argument" 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: 1.10.3
4
+ version: 1.10.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: 2023-10-05 00:00:00.000000000 Z
12
+ date: 2024-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri