polytexnic 1.10.1 → 1.10.3

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: '08ef6b16e688ae517db09f1ccd14da9a9861fc14d0b7576267f2704ee28e2223'
4
- data.tar.gz: 1d19e497423591bf533a01c7870e93fbff311639a35584c2fce4b2eb5fc70ce2
3
+ metadata.gz: da8b7f3f92a5c8273442057b775fe5fb9254b8cea720e116d412fb69a88d2cab
4
+ data.tar.gz: a4a31b444ae75f2b556a3d306f965c386c2e5aa04c08e57d46d5225e3e311e9e
5
5
  SHA512:
6
- metadata.gz: 6fb7f765d2eb5ef17df271b165aa628def5742333e672dd8fa599321e9e550a07af902e914768a2c90123a41ddec53a529677ee84c932d919ce7ce5c99400f50
7
- data.tar.gz: d69d4ccc81b47e6098462888862813f9a1164232a09b16c473d2f7821fa3a4c24f6f1a540d03147689630c7daf5ac42ff653e6d3ee1ccdea96c6cd2fb689ea68
6
+ metadata.gz: 7296046560b0eee4a54c02c2f2c06a797dbe244a6a5a2b93ed1997529e88ad605c6589c645427ca22de026e356f6d128737a4478447cdefe3c16634ded71e0a7
7
+ data.tar.gz: 3ca36eebc4379605f6fb3579dd8d6c0c10a4d5f37a65610ae3541b3d565f700c63c56e3f758ae8ef68fadcd1f1b35d2c1168c27bf6984b7ce55d87e6ad78a5e2
data/.quiet ADDED
File without changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polytexnic (1.10.1)
4
+ polytexnic (1.10.3)
5
5
  json (= 2.3.1)
6
6
  kramdown (= 2.4.0)
7
7
  msgpack (= 1.2.10)
@@ -891,6 +891,18 @@ module Polytexnic
891
891
  doc.xpath('//proof').each do |node|
892
892
  node.name = 'div'
893
893
  node['class'] = 'proof'
894
+ proofoption = node.css('proofoption')
895
+ if proofoption.empty?
896
+ proof_label = 'Proof.'
897
+ else
898
+ proof_label = proofoption.first.content.strip
899
+ end
900
+ proofoption.remove
901
+ node.remove_attribute('proofoption')
902
+ first_paragraph = node.children.first
903
+ html = first_paragraph.inner_html
904
+ html = %(<em class="proof_label">#{proof_label}</em> ) + html
905
+ first_paragraph.inner_html = html
894
906
  end
895
907
  end
896
908
 
@@ -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
@@ -318,14 +318,22 @@ module Polytexnic
318
318
  end
319
319
 
320
320
  # Wrap proofs in a 'proof' element.
321
+ # Start with proofs that have options.
322
+ string.gsub! /(\\begin{proof})\[(.*?)\]/ do
323
+ "\\begin{xmlelement*}{proof}" +
324
+ "\\begin{xmlelement*}{proofoption}#{$2}" +
325
+ "\\end{xmlelement*}"
326
+ end
327
+ # string.gsub!(/\\begin{proof}\[.*?\]/, '')
328
+ # Now do optionless proofs.
321
329
  string.gsub! /\\begin{proof}/ do |s|
322
- "\\begin{xmlelement*}{proof}\n#{s}"
330
+ "\\begin{xmlelement*}{proof}"
323
331
  end
324
332
  string.gsub! /\\end{proof}/ do |s|
325
333
  "#{s}\n\\end{xmlelement*}"
326
334
  end
327
- string.gsub!(/\\begin{proof}/, '')
328
- string.gsub!(/\\end{proof}/, '')
335
+ # string.gsub!(/\\begin{proof}/, '')
336
+ # string.gsub!(/\\end{proof}/, '')
329
337
 
330
338
  # Wrap asides in an 'aside' element.
331
339
  string.gsub! /\\begin{aside}/ do |s|
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.10.1"
2
+ VERSION = "1.10.3"
3
3
  end
@@ -16,7 +16,19 @@ describe 'Polytexnic::Pipeline#to_html' do
16
16
  EOS
17
17
  end
18
18
  it { should include("Lorem ipsum.") }
19
- it { should include('<div class="proof">')}
19
+ it { should include('<div class="proof"><p><em class="proof_label">Proof.</em> Lorem')}
20
+
21
+ context "with optional argument" do
22
+ let(:polytex) do <<-'EOS'
23
+ \chapter{Foo bar}
24
+
25
+ \begin{proof}[Simpler proof.]
26
+ Dolor sit amet.
27
+ \end{proof}
28
+ EOS
29
+ end
30
+ it { should include('<div class="proof"><p><em class="proof_label">Simpler proof.</em> Dolor') }
31
+ end
20
32
  end
21
33
 
22
34
  describe "chapter theorems" 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.1
4
+ version: 1.10.3
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-06 00:00:00.000000000 Z
12
+ date: 2023-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -207,6 +207,7 @@ files:
207
207
  - ".pull_requests/1389652617"
208
208
  - ".pull_requests/1395697424"
209
209
  - ".pull_requests/1403381407"
210
+ - ".quiet"
210
211
  - ".rspec"
211
212
  - Gemfile
212
213
  - Gemfile.lock