#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "..", "spec_helper") describe "Macro:" do before do reset_quiet create_project Glyph['document.output'] = 'html5' Glyph.run! 'load:all' end after do Glyph.lite_mode = false reset_quiet delete_project end it "section, chapter, header (html5)" do text = "chapter[@title[Chapter X] ... section[@title[Section Y]@id[sec-y] ... section[@title[Another section] ...]]]" interpret text doc = @p.document doc.output.gsub(/\n|\t/, '').should == %{

Chapter X

...

Section Y

...

Another section

...
}.gsub(/\n|\t/, '') doc.bookmark?(:"sec-y").should == Glyph::Bookmark.new({:id => :"sec-y", :title => "Section Y", :file => nil}) end it "document, head, style (html5)" do interpret "document[head[style[test.sass]]]" @p.document.output.gsub(/\n|\t/, '').should == %{ #{Glyph::CONFIG.get("document.title")} }.gsub(/\n|\t/, '') end it "toc (html5)" do file_copy Glyph::PROJECT/'../files/document_with_toc.glyph', Glyph::PROJECT/'document.glyph' interpret file_load(Glyph::PROJECT/'document.glyph') doc = @p.document doc.output.gsub!(/\n|\t/, '') doc.output.slice(/(.+?<\/nav>)/, 1).should == %{ }.gsub(/\n|\t/, '') end it "fmi (html5)" do interpret "fmi[this topic|#test] #[test|Test]" @p.document.output.should == %{ for more information on this topic, see Test Test}.gsub(/\n|\t/, '') end it "figure (html5)" do interpret "figure[@alt[ligature]ligature.jpg|Ligature]" @p.document.output.gsub(/\t|\n/, '').should == %{
Ligature
}.gsub(/\n|\t/, '') end it "draftcomment, todo (html5)" do text1 = "dc[comment!]" text2 = "![todo!]" interpret text1 @p.document.output.should == "" interpret text2 @p.document.output.should == "" Glyph['document.draft'] = true interpret text1 @p.document.output.should == %{} interpret text2 @p.document.output.should == %{} @p.document.todos.length.should == 1 Glyph['document.draft'] = false end end