Created
January 23, 2011 07:53
-
-
Save darashi/791906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), 'spec_helper') | |
describe HikiDoc, '(character)' do | |
(1..6).each do |i| | |
it "に#{'!'*i}helloを渡すとH#{i}になる" do | |
HikiDoc.to_xhtml("#{'!'*i}hello").should == "<h#{i}>hello</h#{i}>\n" | |
end | |
end | |
it 'に!!!!!!!helloを渡すと<h6>!hello</h6>になる' do | |
HikiDoc.to_xhtml('!!!!!!!hello').should == "<h6>!hello</h6>\n" | |
end | |
it '' do | |
HikiDoc.to_xhtml("<<<\n!hoge\n>>>").should == "<pre>!hoge</pre>\n" | |
end | |
it do | |
HikiDoc.to_xhtml("{{myplugin}}").should == "<div class=\"plugin\">{{myplugin}}</div>\n" | |
end | |
it do | |
HikiDoc.to_xhtml("Hello, {{myplugin}}").should == "<p>Hello, <span class=\"plugin\">{{myplugin}}</span></p>\n" | |
end | |
it do | |
lambda { HikiDoc.to_xhtml("\00\0") }.should raise_exception HikiDoc::UnexpectedError | |
end | |
it do | |
HikiDoc.to_xhtml("//{{plugin}} comment").should == "" | |
end | |
it do | |
HikiDoc.to_xhtml("*hoge").should == "<ul>\n<li>hoge</li>\n</ul>\n" | |
end | |
it do | |
HikiDoc.to_xhtml("**hoge").should == "<ul>\n<li><ul>\n<li>hoge</li>\n</ul></li>\n</ul>\n" | |
end | |
it do | |
HikiDoc.to_xhtml("#hoge").should == "<ol>\n<li>hoge</li>\n</ol>\n" | |
end | |
it do | |
HikiDoc.to_xhtml("#*hoge").should == "<ol>\n<li><ol>\n<li>hoge</li>\n</ol></li>\n</ol>\n" | |
end | |
it do | |
HikiDoc.to_xhtml("*").should == "<ul>\n<li></li>\n</ul>\n" | |
end | |
it do | |
HikiDoc.to_xhtml(%Q("")).should == "<blockquote></blockquote>\n" | |
end | |
it do | |
HikiDoc.to_xhtml(%Q(""hoge)).should == "<blockquote><p>hoge</p>\n</blockquote>\n" | |
end | |
it do | |
HikiDoc.to_xhtml(%Q(<<<ruby\ni = 1\nj = 2\n>>>)).should == "<pre class=\"prettyprint\">i = 1\nj = 2</pre>\n" | |
end | |
it "with syntax gem" do | |
HikiDoc.to_xhtml(%Q(<<<\ni = 1\nj = 2\n>>>)).should == "<blockquote><p>hoge</p>\n</blockquote>\n" | |
end | |
it "blockquoteとpreを組み合わせる" do | |
HikiDoc.to_xhtml(%Q(""<<<\nhello\n>>>)).should == "<blockquote><p>hoge</p>\n</blockquote>\n" | |
end | |
it do | |
pending | |
f = HikiDoc::LineInput.new(StringIO.new('hogehoge')) | |
output = HikiDoc::HTMLOutput.new(">") | |
output.reset | |
hikidoc = HikiDoc.new(output) | |
hikidoc.send(:compile_paragraph, f) | |
output.finish.should == "<p>hogehoge</p>\n" | |
end | |
it do | |
pending | |
f = HikiDoc::LineInput.new(StringIO.new("\00\0")) | |
output = HikiDoc::HTMLOutput.new(">") | |
output.reset | |
hikidoc = HikiDoc.new(output) | |
hikidoc.instance_eval do | |
@plugin_blocks = ['testplugin'] | |
end | |
hikidoc.send(:compile_paragraph, f) | |
output.finish.should == 'hoge' | |
end | |
it 'strip' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), 'spec_helper') | |
describe HikiDoc do | |
it '|| を使うとテーブルがボーダーなしで描画できる' do | |
HikiDoc.to_xhtml('||1||2||').should == "<table>\n<tr><td>1</td><td>2</td></tr>\n</table>\n" | |
end | |
it '|| を使うとテーブルが描画できる' do | |
HikiDoc.to_xhtml('||1||2||').should == "<table>\n<tr><td>1</td><td>2</td></tr>\n</table>\n" | |
end | |
it '|| > を使うと行を結合したテーブルが描画できる' do | |
HikiDoc.to_xhtml('||>1||3||').should == "<table>\n<tr><td colspan=\"2\">1</td><td>3</td></tr>\n</table>\n" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hikidoc' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment