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 +4 -4
- data/.quiet +0 -0
- data/Gemfile.lock +1 -1
- data/lib/polytexnic/postprocessors/html.rb +12 -0
- data/lib/polytexnic/postprocessors/latex.rb +2 -3
- data/lib/polytexnic/preprocessors/html.rb +11 -3
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/proof_theorem_spec.rb +13 -1
- data/spec/to_latex_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8b7f3f92a5c8273442057b775fe5fb9254b8cea720e116d412fb69a88d2cab
|
4
|
+
data.tar.gz: a4a31b444ae75f2b556a3d306f965c386c2e5aa04c08e57d46d5225e3e311e9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7296046560b0eee4a54c02c2f2c06a797dbe244a6a5a2b93ed1997529e88ad605c6589c645427ca22de026e356f6d128737a4478447cdefe3c16634ded71e0a7
|
7
|
+
data.tar.gz: 3ca36eebc4379605f6fb3579dd8d6c0c10a4d5f37a65610ae3541b3d565f700c63c56e3f758ae8ef68fadcd1f1b35d2c1168c27bf6984b7ce55d87e6ad78a5e2
|
data/.quiet
ADDED
File without changes
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
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}
|
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|
|
data/lib/polytexnic/version.rb
CHANGED
@@ -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
|
data/spec/to_latex_spec.rb
CHANGED
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.
|
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-
|
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
|