polytexnic 1.1.beta1 → 1.1.beta2

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
  SHA1:
3
- metadata.gz: de97a8848a323aaaa3558b8cac21a2273404b1f8
4
- data.tar.gz: 3064c4792f08d5812d9ad45e699861e03377994e
3
+ metadata.gz: b0f80dcf61d5528a2910a447d29f3599d2d7e5c0
4
+ data.tar.gz: 5466bb5d3004ca816c7440eaacb2a8f4310c6b78
5
5
  SHA512:
6
- metadata.gz: 4b617bb00aef112924e92c74e297d11a2375472b95b676f59792da1f973c1707ec2d6613872972e8f6353b2db0d2bbd2e9fc139bde84040c5dfdbdb2dcb1638d
7
- data.tar.gz: c92ea88a740e56f74300246670e37777220a0e7e797ad84b0a98aa6832537b3ed06ef0388019bc8c845db7b4615ff33dceb03b1634f2a5bc62e8dc7e587f139b
6
+ metadata.gz: 73f6466f13d231921bce72faba6e77bd35164b19a1247b2e39132e55ef60e8ab4c3cfab13bd4b4cf3493f701f705c751ec4fb86c61fbb64626f9408ceba812fb
7
+ data.tar.gz: d4b01863a01a010e472d11597c7f3107276160a94034decd254e11466a9e7cf826042f0dbd7722d0a82e7fe5e707bb10b27abe297061edec7d549e92b3550adb
@@ -369,14 +369,19 @@ module Polytexnic
369
369
  node.add_next_sibling(space)
370
370
  end
371
371
  # Remove spurious intersentence space from mid-sentence notes.
372
- unless end_of_sentence
373
- intersentence_space = node.next_sibling
374
- intersentence_space.remove unless intersentence_space.nil?
372
+ next_sibling = node.next_sibling
373
+ if !end_of_sentence && intersentence_space?(next_sibling)
374
+ next_sibling.remove
375
375
  end
376
376
  end
377
377
  end
378
378
  end
379
379
 
380
+ # Returns true if a node is an intersentence space
381
+ def intersentence_space?(node)
382
+ node && node.values == ['intersentencespace']
383
+ end
384
+
380
385
  # Returns the nth footnote symbol for use in non-numerical footnotes.
381
386
  # By using the modulus operator %, we arrange to loop around to the
382
387
  # front if the number footnotes exceeds the number of symbols.
@@ -411,12 +416,12 @@ module Polytexnic
411
416
 
412
417
  # Returns HTML for a nicely styled TeX logo.
413
418
  def tex
414
- %(<span class="texhtml" style="font-family: 'CMU Serif', cmr10, LMRoman10-Regular, 'Times New Roman', 'Nimbus Roman No9 L', Times, serif;">T<span style="text-transform: uppercase; vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em;">E</span>X</span>)
419
+ %(<span class="texhtml">T<span class="texhtmlE">E</span>X</span>)
415
420
  end
416
421
 
417
422
  # Returns HTML for a nicely styled LaTeX logo.
418
423
  def latex
419
- %(<span class="texhtml" style="font-family: 'CMU Serif', cmr10, LMRoman10-Regular, 'Times New Roman', 'Nimbus Roman No9 L', Times, serif;">L<span style="text-transform: uppercase; font-size: 70%; margin-left: -0.36em; vertical-align: 0.3em; line-height: 0; margin-right: -0.15em;">A</span>T<span style="text-transform: uppercase; margin-left: -0.1667em; vertical-align: -0.5ex; line-height: 0; margin-right: -0.125em;">E</span>X</span>)
424
+ %(<span class="texhtml">L<span class="texhtmlA">A</span>T<span class="texhtmlE">E</span>X</span>)
420
425
  end
421
426
 
422
427
  # Handles \begin{quote} ... \end{quote}.
@@ -495,12 +500,11 @@ module Polytexnic
495
500
  label = node.at_css('data-label')
496
501
  node['id'] = pipeline_label(label)
497
502
  unexpected.remove
498
- clean_node node, %w{data-label}
499
503
  elsif label = node.at_css('data-label')
500
504
  node['id'] = pipeline_label(label)
501
505
  label.remove
502
- clean_node node, %w{data-label}
503
506
  end
507
+ clean_node node, %w{data-label place}
504
508
  end
505
509
  doc.xpath('//table').each do |node|
506
510
  if unexpected = node.at_css('unexpected')
@@ -1,3 +1,3 @@
1
1
  module Polytexnic
2
- VERSION = "1.1.beta1"
2
+ VERSION = "1.1.beta2"
3
3
  end
@@ -94,7 +94,8 @@ describe 'Polytexnic::Pipeline#to_html' do
94
94
  end
95
95
 
96
96
  context "with a mid-sentence footnote ending with a period" do
97
- let(:polytex) { 'Lorem\footnote{Cicero.} ipsum.' }
97
+ let(:polytex) { 'Lorem\footnote{From \emph{Cicero}.} ipsum.' }
98
+ it { should include 'ipsum' }
98
99
  it { should_not include 'intersentencespace' }
99
100
  end
100
101
 
@@ -116,7 +117,7 @@ describe 'Polytexnic::Pipeline#to_html' do
116
117
  describe "TeX logo" do
117
118
  let(:polytex) { '\TeX' }
118
119
  let(:output) do
119
- %(<span class="texhtml" style="font-family: 'CMU Serif', cmr10, LMRoman10-Regular, 'Times New Roman', 'Nimbus Roman No9 L', Times, serif;">T<span style="text-transform: uppercase; vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em;">E</span>X</span>)
120
+ %(<span class="texhtml">T<span class="texhtmlE">E</span>X</span>)
120
121
  end
121
122
  it { should include(output) }
122
123
  end
@@ -124,7 +125,7 @@ describe 'Polytexnic::Pipeline#to_html' do
124
125
  describe "LaTeX logo" do
125
126
  let(:polytex) { '\LaTeX' }
126
127
  let(:output) do
127
- %(<span class="texhtml" style="font-family: 'CMU Serif', cmr10, LMRoman10-Regular, 'Times New Roman', 'Nimbus Roman No9 L', Times, serif;">L<span style="text-transform: uppercase; font-size: 70%; margin-left: -0.36em; vertical-align: 0.3em; line-height: 0; margin-right: -0.15em;">A</span>T<span style="text-transform: uppercase; margin-left: -0.1667em; vertical-align: -0.5ex; line-height: 0; margin-right: -0.125em;">E</span>X</span>)
128
+ %(<span class="texhtml">L<span class="texhtmlA">A</span>T<span class="texhtmlE">E</span>X</span>)
128
129
  end
129
130
  it { should include(output) }
130
131
  end
@@ -132,7 +133,7 @@ describe 'Polytexnic::Pipeline#to_html' do
132
133
  describe "PolyTeX logo" do
133
134
  let(:polytex) { '\PolyTeX' }
134
135
  let(:output) do
135
- %(Poly<span class="texhtml" style="font-family: 'CMU Serif', cmr10, LMRoman10-Regular, 'Times New Roman', 'Nimbus Roman No9 L', Times, serif;">T<span style="text-transform: uppercase; vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em;">E</span>X</span>)
136
+ %(Poly<span class="texhtml">T<span class="texhtmlE">E</span>X</span>)
136
137
  end
137
138
  it { should include(output) }
138
139
  end
@@ -140,7 +141,7 @@ describe 'Polytexnic::Pipeline#to_html' do
140
141
  describe "PolyTeXnic logo" do
141
142
  let(:polytex) { '\PolyTeXnic' }
142
143
  let(:output) do
143
- %(Poly<span class="texhtml" style="font-family: 'CMU Serif', cmr10, LMRoman10-Regular, 'Times New Roman', 'Nimbus Roman No9 L', Times, serif;">T<span style="text-transform: uppercase; vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em;">E</span>X</span>nic)
144
+ %(Poly<span class="texhtml">T<span class="texhtmlE">E</span>X</span>nic)
144
145
  end
145
146
  it { should include(output) }
146
147
  end
@@ -166,4 +166,13 @@ describe 'Polytexnic::Pipeline#to_html' do
166
166
  end
167
167
  it { should resemble output }
168
168
  end
169
+
170
+ describe "emphasis inside footnote" do
171
+ let(:polytex) do <<-'EOS'
172
+ \chapter{Lorem}
173
+ Lorem ipsum\footnote{Dolor \emph{sit}} amet. Consectetur.
174
+ EOS
175
+ end
176
+ it { should include 'amet' }
177
+ end
169
178
  end
@@ -84,7 +84,7 @@ describe 'Polytexnic::Pipeline#to_html' do
84
84
 
85
85
  context "with a label and a cross-reference" do
86
86
  let(:polytex) do <<-'EOS'
87
- \begin{figure}
87
+ \begin{figure}[h]
88
88
  lorem
89
89
  \label{fig:foo}
90
90
  \end{figure}
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.beta1
4
+ version: 1.1.beta2
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-03-05 00:00:00.000000000 Z
12
+ date: 2015-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri