polytexnic 1.10.1 → 1.10.2

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: '08ef6b16e688ae517db09f1ccd14da9a9861fc14d0b7576267f2704ee28e2223'
4
- data.tar.gz: 1d19e497423591bf533a01c7870e93fbff311639a35584c2fce4b2eb5fc70ce2
3
+ metadata.gz: f125f1b4e0dc232a35eb7caa4941fc147d927ed3fa4aa18f691c902da1510545
4
+ data.tar.gz: 0ed473416a4b88a4491af1cbc02d5db68c904998185bc70e92a2821b4ae0e730
5
5
  SHA512:
6
- metadata.gz: 6fb7f765d2eb5ef17df271b165aa628def5742333e672dd8fa599321e9e550a07af902e914768a2c90123a41ddec53a529677ee84c932d919ce7ce5c99400f50
7
- data.tar.gz: d69d4ccc81b47e6098462888862813f9a1164232a09b16c473d2f7821fa3a4c24f6f1a540d03147689630c7daf5ac42ff653e6d3ee1ccdea96c6cd2fb689ea68
6
+ metadata.gz: 1b70edd6d6fee965e904872c1df671f1651773da7160f757aaf3cd428408e396f5d59abf6afa36b3467f4a67cbe6268d596e909865f90889f9719a72b9bad27f
7
+ data.tar.gz: 688a229066793aca1558d87d9f6de14780d927fca133bc8cb645df0ad7e0d20a64968bcbf195ccc44583d8b2b90d5edfd793e7226713a86d7892ab3782817af9
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.2)
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
 
@@ -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.2"
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
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.2
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-09-15 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