polytexnic 1.1.4 → 1.1.5
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/lib/polytexnic/postprocessors/html.rb +14 -7
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/footnote_spec.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9365791fe43e93ce220fb5b947dc2d0ee8b0739
|
4
|
+
data.tar.gz: 518c1e4d4ce55ecc0643472428295dbe5df6a538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f67be04f1a31890d4e22916be834c0793a6e9894fb8ab526fb9783380a2acf218b39dacdeaf3f150da7e317608174268d5c471c3f41c723ae8ab0b7c6575a617
|
7
|
+
data.tar.gz: 738bd6741d7e7c109c7ac7c603f8c3f1b03a74f759382319f3a1e7f6d26f89173b533a5e726728daee19010ec66e934e05541369f15fb306016228bcadfddbd9
|
@@ -414,21 +414,22 @@ module Polytexnic
|
|
414
414
|
# Update: Hacked a solution to handle the uncommon case of a footnote
|
415
415
|
# inside a section* environment.
|
416
416
|
def chapter_number(node)
|
417
|
-
if section_star?(node)
|
418
|
-
return chapter_number(section_star_chapter(node))
|
419
|
-
end
|
420
417
|
return 0 if article?
|
421
418
|
number = node['data-number']
|
422
419
|
if number && !number.empty?
|
423
420
|
number.split('.').first.to_i
|
421
|
+
elsif section_star?(node)
|
422
|
+
chapter_number(section_star_chapter(node))
|
424
423
|
else
|
425
424
|
chapter_number(node.parent) rescue nil
|
426
425
|
end
|
427
426
|
end
|
428
427
|
|
429
|
-
# Returns true if node
|
428
|
+
# Returns true if node is inside section*.
|
430
429
|
def section_star?(node)
|
431
430
|
begin
|
431
|
+
# puts (val = node.parent.parent.attributes['class'].value) + '*******'
|
432
|
+
# puts node.parent.parent.parent.parent.children[1] if val == 'section-star'
|
432
433
|
node.parent.parent.attributes['class'].value == 'section-star'
|
433
434
|
rescue
|
434
435
|
false
|
@@ -437,7 +438,12 @@ module Polytexnic
|
|
437
438
|
|
438
439
|
# Returns the chapter node for a section*.
|
439
440
|
def section_star_chapter(node)
|
440
|
-
node.parent.parent
|
441
|
+
section_star = node.parent.parent
|
442
|
+
potential_chapter = section_star
|
443
|
+
# Keep accessing previous siblings until we hit a chapter.
|
444
|
+
while (potential_chapter = potential_chapter.previous_sibling) do
|
445
|
+
return potential_chapter if chapter?(potential_chapter)
|
446
|
+
end
|
441
447
|
end
|
442
448
|
|
443
449
|
# Handles logos for TeX and LaTeX.
|
@@ -920,8 +926,9 @@ module Polytexnic
|
|
920
926
|
|
921
927
|
# Returns true if the node represents a chapter.
|
922
928
|
def chapter?(node)
|
923
|
-
|
924
|
-
|
929
|
+
attributes = node.attributes
|
930
|
+
attributes && attributes['class'] &&
|
931
|
+
attributes['class'].value =~ /chapter/
|
925
932
|
end
|
926
933
|
|
927
934
|
# Returns the name to use for chapters.
|
data/lib/polytexnic/version.rb
CHANGED
@@ -178,13 +178,23 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
178
178
|
|
179
179
|
describe "footnote inside a section*" do
|
180
180
|
let(:polytex) do <<-'EOS'
|
181
|
+
\chapter{The first}
|
182
|
+
|
183
|
+
Test
|
184
|
+
|
185
|
+
\chapter{The second}
|
186
|
+
|
187
|
+
Also test
|
188
|
+
|
181
189
|
\chapter{Lorem}
|
190
|
+
|
182
191
|
Foo bar
|
192
|
+
|
183
193
|
\section*{Baz}
|
184
194
|
|
185
195
|
Lorem ipsum.\footnote{Dolor sit amet.}
|
186
196
|
EOS
|
187
197
|
end
|
188
|
-
it { should include 'cha-
|
198
|
+
it { should include 'cha-3_footnote' }
|
189
199
|
end
|
190
200
|
end
|