Sha256: aa0d63851eea583c8cfc9f9d9e861437be735e0aa0ae9098498f7b082c5f810d

Contents?: true

Size: 1.34 KB

Versions: 37

Compression:

Stored size: 1.34 KB

Contents

# encoding=utf-8
require 'spec_helper'

describe 'Polytexnic::Pipeline#to_html' do

  let(:pipeline) { Polytexnic::Pipeline.new(polytex) }
  subject(:processed_text) { pipeline.to_html }

 describe '\input command' do
    let(:external_file) { 'foo.tex' }
    let(:nested_external_file) { 'bar.tex' }
    let(:input) do <<-'EOS'
Lorem ipsum \href{http://example.com/}{example}
%= lang:ruby
\begin{code}
def foo; 'foo'; end
\end{code}
Lorem \emph{ipsum} dolor sit amet

\input{bar}
      EOS
    end
    let(:nested_input) do <<-'EOS'
Lorem ipsum
%= lang:python
\begin{code}
def bar(): return "bar"
\end{code}
      EOS
    end
    before do
      File.write(external_file, input)
      File.write(nested_external_file, nested_input)
    end
    after do
      File.unlink(external_file)
      File.unlink(nested_external_file)
    end

    let(:polytex) { "\\chapter{Foo}\n\n  \\input{foo}  " }
    let(:foo_html) do
      '<div class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">foo</span>'
    end
    let(:bar_html) do
      '<div class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">bar</span><span class="p">():'
    end

    it { should include foo_html }
    it { should include bar_html }
    it { should include '<a href="http://example.com/"' }
    it { should include '>example</a>' }
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
polytexnic-1.3.5 spec/to_html/input_spec.rb
polytexnic-1.3.4 spec/to_html/input_spec.rb
polytexnic-1.3.3 spec/to_html/input_spec.rb
polytexnic-1.3.2 spec/to_html/input_spec.rb
polytexnic-1.3.1 spec/to_html/input_spec.rb
polytexnic-1.3.0 spec/to_html/input_spec.rb
polytexnic-1.2.8 spec/to_html/input_spec.rb
polytexnic-1.2.7 spec/to_html/input_spec.rb
polytexnic-1.2.6 spec/to_html/input_spec.rb
polytexnic-1.2.5 spec/to_html/input_spec.rb
polytexnic-1.2.4 spec/to_html/input_spec.rb
polytexnic-1.2.3 spec/to_html/input_spec.rb
polytexnic-1.2.2 spec/to_html/input_spec.rb
polytexnic-1.2.1 spec/to_html/input_spec.rb
polytexnic-1.2.0 spec/to_html/input_spec.rb
polytexnic-1.1.14 spec/to_html/input_spec.rb
polytexnic-1.1.11 spec/to_html/input_spec.rb
polytexnic-1.1.10 spec/to_html/input_spec.rb
polytexnic-1.1.9 spec/to_html/input_spec.rb
polytexnic-1.1.8 spec/to_html/input_spec.rb