Sha256: ca16bf9a91a2439fab806b676dd83e5d72ea7d1c17b1092248b1b1ced7a13925

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module Hemingway

  describe Parser do

    before do
      @parser = Parser.new
    end

    describe "#math" do
      it 'should parse out a math symbol' do
        html = @parser.parse("$\\Delta$").html
        html.should == "<div class='entry'><p>&Delta;</p></div>"
      end

      it 'should allow me to nest math symbols in a tag' do
        html = @parser.parse("\\emph{$\\Delta$}").html
        html.should == "<div class='entry'><p><em>&Delta;</em></p></div>"
      end

      it 'should escape text properly into a math symbol' do
        html = @parser.parse("hello $\\Delta$").html
        html.should == "<div class='entry'><p>hello &Delta;</p></div>"
      end

      it 'should allow me to exponentiate text' do
        html = @parser.parse("December 7$^{th}$").html
        html.should == "<div class='entry'><p>December 7<sup>th</sup></p></div>"
      end

      it 'should allow me to make a degree sign' do
        html = @parser.parse("25 $^{\\circ}$ celcius").html
        html.should == "<div class='entry'><p>25 &deg; celcius</p></div>"
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hemingway-1.0.0 spec/nodes/math_spec.rb
hemingway-0.0.3 spec/nodes/math_spec.rb