polytexnic 1.10.2 → 1.10.4

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: f125f1b4e0dc232a35eb7caa4941fc147d927ed3fa4aa18f691c902da1510545
4
- data.tar.gz: 0ed473416a4b88a4491af1cbc02d5db68c904998185bc70e92a2821b4ae0e730
3
+ metadata.gz: becee0a264fd8f1c6e60c6eb2fe347b369379d1ff65fe3d750f6cb8cc1fe41af
4
+ data.tar.gz: cdbd9839380bbffc7bcc4575402448eaf0af0ad079cddf068f20f4698492d073
5
5
  SHA512:
6
- metadata.gz: 1b70edd6d6fee965e904872c1df671f1651773da7160f757aaf3cd428408e396f5d59abf6afa36b3467f4a67cbe6268d596e909865f90889f9719a72b9bad27f
7
- data.tar.gz: 688a229066793aca1558d87d9f6de14780d927fca133bc8cb645df0ad7e0d20a64968bcbf195ccc44583d8b2b90d5edfd793e7226713a86d7892ab3782817af9
6
+ metadata.gz: c298160d71a2777aeab70cd791e7fdbcab57ce3315c4fa5510b9d74c29cbe4382a4a9b5f0eadf2b93d189e82c70d12cd5e16a2214bbcf4b04f02e3698e5e38e5
7
+ data.tar.gz: 6571de55107bcb9905287a9a0bd6b027ae3cd3c9346ff122a8767489c13ae557699c25ed9b9830f90af2a5a4dd8e369e8eadcb0b5ed094226cb7623fbe01c511
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polytexnic (1.10.2)
4
+ polytexnic (1.10.4)
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
-
@@ -18,9 +18,8 @@ module Polytexnic
18
18
  # Escapes backslashes even more.
19
19
  # Have I mentioned how much I hate backslashes?
20
20
  def extra_escape(string)
21
- string.gsub('\\', '\\\\\\').
22
- gsub("\\'", '\\\\' + "'").
23
- gsub('\\\\\\', '\\\\\\')
21
+ string.gsub("\\'", '\\\\\\\\' + "'")
22
+ # raise string.inspect
24
23
  end
25
24
  end
26
25
  end
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.10.2"
2
+ VERSION = "1.10.4"
3
3
  end
@@ -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
@@ -106,7 +106,7 @@ end
106
106
  context "align* environment" do
107
107
  let(:polytex) do <<-'EOS'
108
108
  \begin{align*}
109
- x &= 1\\
109
+ \lnot \forall x \in A\ P(x) \\
110
110
  y & = 2 \\
111
111
  x + y &= 3
112
112
  \end{align*}
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.2
4
+ version: 1.10.4
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-09-15 00:00:00.000000000 Z
12
+ date: 2023-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri