Sha256: 884f1be83507d9973fddbf2464a37d205d8a8d2700ed4d5ef9717066fc02669f

Contents?: true

Size: 1.96 KB

Versions: 21

Compression:

Stored size: 1.96 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 "aside boxes" do
    let(:polytex) do <<-'EOS'
      \chapter{Foo bar}

      \begin{aside}
      \heading{Lorem ipsum.}
      \label{aside:lorem}

      lorem ipsum

      dolor sit amet

      \end{aside}

      Box~\ref{aside:lorem}
      EOS
    end

    it do
      should resemble <<-'EOS'
        <div id="cid1" data-tralics-id="cid1" class="chapter" data-number="1"><h1><a href="#cid1" class="heading"><span class="number">Chapter 1 </span>Foo bar</a></h1>
        <div class="aside" id="aside-lorem" data-tralics-id="uid1" data-number="1.1">
          <div class="heading">
            <span class="number">Box 1.1.</span>
            <span class="description">Lorem ipsum.</span>
          </div>
          <p>lorem ipsum</p>
          <p>dolor sit amet</p>
        </div>
        <p><a href="#aside-lorem" class="hyperref">Box <span class="ref">1.1</span></a></p>
        </div>
      EOS
    end

    context "with a custom language label" do
      before do
        pipeline.stub(:language_labels).
                 and_return({ "chapter" => { "word" => "Chapter",
                                             "order" => "standard" },
                              "aside" => "Cajón" })
      end
      it { should include 'Cajón 1.1' }
    end
  end

  describe "aside cross-references" do
    let(:aside) do <<-'EOS'
        \begin{aside}
        \heading{Lorem ipsum.}
        \label{aside:lorem}

        lorem ipsum

        dolor sit amet

        \end{aside}

        Box~\ref{aside:lorem}
      EOS
    end
    context "in a chapter" do
      let(:polytex) { '\chapter{Foo bar}' + "\n" + aside}
      it { should include ">1.1<" }
    end

    context "in an article" do
      let(:polytex) { '\section{A section}' + "\n" + aside }
      it { should include ">1<" }
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
polytexnic-1.9.2 spec/to_html/asides_spec.rb
polytexnic-1.9.1 spec/to_html/asides_spec.rb
polytexnic-1.9.0 spec/to_html/asides_spec.rb
polytexnic-1.8.2 spec/to_html/asides_spec.rb
polytexnic-1.8.1 spec/to_html/asides_spec.rb
polytexnic-1.8.0 spec/to_html/asides_spec.rb
polytexnic-1.7.5 spec/to_html/asides_spec.rb
polytexnic-1.7.4 spec/to_html/asides_spec.rb
polytexnic-1.7.3 spec/to_html/asides_spec.rb
polytexnic-1.7.2 spec/to_html/asides_spec.rb
polytexnic-1.7.1 spec/to_html/asides_spec.rb
polytexnic-1.7.0 spec/to_html/asides_spec.rb
polytexnic-1.6.6 spec/to_html/asides_spec.rb
polytexnic-1.6.5 spec/to_html/asides_spec.rb
polytexnic-1.6.4 spec/to_html/asides_spec.rb
polytexnic-1.6.3 spec/to_html/asides_spec.rb
polytexnic-1.6.2 spec/to_html/asides_spec.rb
polytexnic-1.6.1 spec/to_html/asides_spec.rb
polytexnic-1.6.0 spec/to_html/asides_spec.rb
polytexnic-1.5.16 spec/to_html/asides_spec.rb