polytexnic 1.1.3 → 1.1.4
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 +19 -0
- data/lib/polytexnic/version.rb +1 -1
- data/spec/to_html/footnote_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea14cfbcb4bdd08795b37315bd7187585f12030c
|
4
|
+
data.tar.gz: 335d87363e054d2fef85f3fe4609874e7811b4f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04ba7029301eedf24b8e5fcc1b0b23c9e23e1f1169b5e2c0d09e7c9a78ea40e52e4e385589c8625f823eda953769de55a3d432158f94dcf7c95aeeb83c92fcac
|
7
|
+
data.tar.gz: d46e70f38f8555c482e44f19703b8547c503647007be4c6e8078344fcf9d669a7992fa321454d2e608e85c7c22f1a4d17330a6215c14221d8a5061623d4f3abc
|
@@ -411,7 +411,12 @@ module Polytexnic
|
|
411
411
|
# Every node is inside some div that has a 'data-number' attribute,
|
412
412
|
# so recursively search the parents to find it.
|
413
413
|
# Then return the first number in the value, e.g., "1" in "1.2".
|
414
|
+
# Update: Hacked a solution to handle the uncommon case of a footnote
|
415
|
+
# inside a section* environment.
|
414
416
|
def chapter_number(node)
|
417
|
+
if section_star?(node)
|
418
|
+
return chapter_number(section_star_chapter(node))
|
419
|
+
end
|
415
420
|
return 0 if article?
|
416
421
|
number = node['data-number']
|
417
422
|
if number && !number.empty?
|
@@ -421,6 +426,20 @@ module Polytexnic
|
|
421
426
|
end
|
422
427
|
end
|
423
428
|
|
429
|
+
# Returns true if node comes from a '\section*'.
|
430
|
+
def section_star?(node)
|
431
|
+
begin
|
432
|
+
node.parent.parent.attributes['class'].value == 'section-star'
|
433
|
+
rescue
|
434
|
+
false
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
# Returns the chapter node for a section*.
|
439
|
+
def section_star_chapter(node)
|
440
|
+
node.parent.parent.parent.children[1]
|
441
|
+
end
|
442
|
+
|
424
443
|
# Handles logos for TeX and LaTeX.
|
425
444
|
def tex_logos(doc)
|
426
445
|
doc.xpath('//TeX').each do |node|
|
data/lib/polytexnic/version.rb
CHANGED
@@ -175,4 +175,16 @@ describe 'Polytexnic::Pipeline#to_html' do
|
|
175
175
|
end
|
176
176
|
it { should_not include '</span> amet' }
|
177
177
|
end
|
178
|
+
|
179
|
+
describe "footnote inside a section*" do
|
180
|
+
let(:polytex) do <<-'EOS'
|
181
|
+
\chapter{Lorem}
|
182
|
+
Foo bar
|
183
|
+
\section*{Baz}
|
184
|
+
|
185
|
+
Lorem ipsum.\footnote{Dolor sit amet.}
|
186
|
+
EOS
|
187
|
+
end
|
188
|
+
it { should include 'cha-1_footnote' }
|
189
|
+
end
|
178
190
|
end
|
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.1.
|
4
|
+
version: 1.1.4
|
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: 2015-
|
12
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|