require 'spec_helper'
module Hemingway
describe Parser do
before do
@parser = Parser.new
end
describe "#footnote" do
it "should put a footnote at the end of a paragraph" do
html = @parser.parse("You are what you redpoint\\footnote{sending a lead route}, after all.").html
html.should == "
You are what you redpoint, after all.
"
end
it "should put properly increment the footnote count per entry" do
html = @parser.parse("Slowly, Vader\\footnote{thug} approached Luke\\footnote{homeboy}").html
html.should == "Slowly, Vader approached Luke
"
end
it "should support any type of content in a footnote" do
html = @parser.parse("Dave Graham\\footnote{\\emph{Boulderer}, and \& all around \\textsc{good} guy $\\gamma$} makes the best mixtapes").html
html.should == "Dave Graham makes the best mixtapes
"
end
it "should properly place footnotes from all paragraphs after all paragraphs an increment properly" do
html = @parser.parse("Freddie Gibbs\\footnote{from Gary, Indiana} is hood\\footnote{thug} as all hell.\n\n John Russel\\footnote{of Short Bus fame} almost got raped in Gary, ID\\footnote{but not by Freddie Gibbs}").html
html.should == "Freddie Gibbs is hood as all hell.
John Russel almost got raped in Gary, ID
"
end
it "will obviously allow me to drop a list in a footnote (this is just for my own satisfaction mostly)" do
html = @parser.parse("There are some rules\\footnote{\\begin{itemize} \\item Steezy socks always \\item Brosend often \\item Everything for the ladies \\end{itemize}} that we all must live by.").html
html.should == "There are some rules that we all must live by.
"
end
end
end
end