polytexnic 1.10.0 → 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 +4 -4
- data/.quiet +0 -0
- data/Gemfile.lock +1 -1
- data/lib/polytexnic/postprocessors/html.rb +12 -11
- 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
- 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: f125f1b4e0dc232a35eb7caa4941fc147d927ed3fa4aa18f691c902da1510545
|
4
|
+
data.tar.gz: 0ed473416a4b88a4491af1cbc02d5db68c904998185bc70e92a2821b4ae0e730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b70edd6d6fee965e904872c1df671f1651773da7160f757aaf3cd428408e396f5d59abf6afa36b3467f4a67cbe6268d596e909865f90889f9719a72b9bad27f
|
7
|
+
data.tar.gz: 688a229066793aca1558d87d9f6de14780d927fca133bc8cb645df0ad7e0d20a64968bcbf195ccc44583d8b2b90d5edfd793e7226713a86d7892ab3782817af9
|
data/.quiet
ADDED
File without changes
|
data/Gemfile.lock
CHANGED
@@ -773,11 +773,6 @@ module Polytexnic
|
|
773
773
|
def build_heading(node, css_class)
|
774
774
|
node.name = 'div'
|
775
775
|
node['class'] = element_class(css_class)
|
776
|
-
# Extract theorem content (if any). This super-hacky.
|
777
|
-
# th_regex = /data-tralics-id=".*?"><strong>.*?<\/strong>(.*?)<\/div>/m
|
778
|
-
# theorem_content = node.to_xhtml.scan(th_regex).flatten.first
|
779
|
-
# theorem_content.gsub!("\n\n", '') if theorem_content
|
780
|
-
# raise theorem_content
|
781
776
|
heading = node.at_css('p')
|
782
777
|
heading.attributes.each do |key, value|
|
783
778
|
node.set_attribute(key, value)
|
@@ -826,11 +821,6 @@ module Polytexnic
|
|
826
821
|
full_number << theorem_description
|
827
822
|
end
|
828
823
|
full_number << Nokogiri::XML::Text.new('.', heading)
|
829
|
-
# # We remove all paragraphs and append the previously extracted
|
830
|
-
# # theorem content. The desired numbered heading is just the
|
831
|
-
# # first line, so we split on newline and take the first element.
|
832
|
-
# number_html = full_number.to_xhtml.split("\n").first
|
833
|
-
# full_number.inner_html = number_html + theorem_content
|
834
824
|
elsif css_class == 'codelisting'
|
835
825
|
description = node.at_css('.description').content
|
836
826
|
unless description.empty?
|
@@ -839,7 +829,6 @@ module Polytexnic
|
|
839
829
|
else
|
840
830
|
full_number << Nokogiri::XML::Text.new('.', heading)
|
841
831
|
end
|
842
|
-
# raise heading.to_xhtml
|
843
832
|
heading
|
844
833
|
end
|
845
834
|
|
@@ -902,6 +891,18 @@ module Polytexnic
|
|
902
891
|
doc.xpath('//proof').each do |node|
|
903
892
|
node.name = 'div'
|
904
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
|
905
906
|
end
|
906
907
|
end
|
907
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}
|
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
|
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.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-
|
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
|