moro-piki_doc 0.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
+ require 'piki_doc/document'
3
+
4
+ describe PikiDoc::Document do
5
+ describe "to_xhtml(image_link_with_param)" do
6
+ subject{ PikiDoc::Document.to_xhtml('http://image.exmaple.com/image.jpg?size=100x75') }
7
+
8
+ it{ should == "<p><img src=\"http://image.exmaple.com/image.jpg?size=100x75\" alt=\"image.jpg\" /></p>\n"}
9
+ end
10
+
11
+ describe "register(plugin)" do
12
+ before(:all) do
13
+ PikiDoc::Document.register(Object.new, Object.new)
14
+ end
15
+
16
+ it{ PikiDoc::Document.should have(2).plugins }
17
+ end
18
+ end
19
+
@@ -0,0 +1,45 @@
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
+ require 'piki_doc/output'
3
+
4
+ describe PikiDoc::HTMLOutput do
5
+ # {{vote_form('order','お名前', '[勉強会]','PP, Blog, Twitter or Github', 'ひとこと', '[ust設備あり]')}}
6
+ describe "call inline_plugin() when respond_to?(meth) and accept?()" do
7
+ Spec::Matchers.create :ouptut_content do |expected|
8
+ match do |actual|
9
+ actual.finish.strip.should == expected
10
+ end
11
+ end
12
+
13
+ before do
14
+ @input = "plugin/source"
15
+
16
+ @plugin = mock("plugin")
17
+ @plugin.should_receive(:respond_to?).with(:inline_plugin).at_least(:once).and_return(true)
18
+ @plugin.should_receive(:respond_to?).with(:block_plugin).at_least(:once).and_return(true)
19
+ @plugin.should_receive(:accept?).with(@input).and_return(true)
20
+
21
+ @out = PikiDoc::HTMLOutput.new(suffix = " />", [@plugin]).tap(&:reset)
22
+ end
23
+
24
+ describe "inline_plugin" do
25
+ before do
26
+ @plugin.should_receive(:inline_plugin).with(@input).and_return("--out--")
27
+ end
28
+
29
+ it "should render plugin output" do
30
+ @out.inline_plugin(@input).should == "--out--"
31
+ end
32
+ end
33
+
34
+ describe "block_plugin" do
35
+ before do
36
+ @plugin.should_receive(:block_plugin).with(@input).and_return("--block--")
37
+ end
38
+
39
+ it "should render plugin output" do
40
+ @out.block_plugin(@input)
41
+ @out.should ouptut_content "--block--"
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,57 @@
1
+ require File.expand_path("spec_helper", File.dirname(__FILE__))
2
+ require 'piki_doc'
3
+
4
+ class HikiComatibilityMatcher
5
+ def initialize(format, hikidoc)
6
+ @format = "to_#{format}"
7
+ @hikidoc = hikidoc
8
+ end
9
+
10
+ def matches?(actual)
11
+ actual.send(@format, @hikidoc) == HikiDoc.send(@format, @hikidoc)
12
+ end
13
+
14
+ def description
15
+ "compat with " + shorten_content
16
+ end
17
+
18
+ def failure_message_for_should
19
+ "should compat but do'nt compat with " + shorten_content
20
+ end
21
+
22
+ def failure_message_for_should_not
23
+ "should not compat but compat with " + shorten_content
24
+ end
25
+
26
+ private
27
+ def shorten_content(num=50)
28
+ @hikidoc.gsub(/[\r\n]/, "\\n").split(//)[0, num].join("")
29
+ end
30
+ end
31
+
32
+ describe PikiDoc do
33
+ subject{ PikiDoc } # module itself
34
+ def compat_with_hiki(*arg)
35
+ HikiComatibilityMatcher.new(*arg)
36
+ end
37
+
38
+ it do should compat_with_hiki(:xhtml, <<-EOS) end
39
+ !おはよう
40
+ !!こんにちは
41
+
42
+ こんばんは
43
+ EOS
44
+
45
+ it do should compat_with_hiki(:xhtml, <<-EOS) end
46
+ - foobar
47
+ - piyopiyo
48
+
49
+ EOS
50
+
51
+ it do should_not compat_with_hiki(:xhtml, <<-EOS) end
52
+ !クエリつき画像リンク
53
+ http://image.with.query.example.com/photo.jpg?size=100x75
54
+ EOS
55
+
56
+ end
57
+
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moro-piki_doc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - MOROHASHI Kyosuke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-30 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: extended HikiDoc to able to plug plugins.
17
+ email: moronatural@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.ja.hiki
24
+ - Changelog
25
+ files:
26
+ - README.ja.hiki
27
+ - Changelog
28
+ - Rakefile
29
+ - lib/piki_doc
30
+ - lib/piki_doc/bundles
31
+ - lib/piki_doc/bundles/asin.rb
32
+ - lib/piki_doc/bundles/gist.rb
33
+ - lib/piki_doc/bundles/plugin_adapter.rb
34
+ - lib/piki_doc/document.rb
35
+ - lib/piki_doc/image_uri_autolink_fix.rb
36
+ - lib/piki_doc/output.rb
37
+ - lib/piki_doc.rb
38
+ - lib/vendor
39
+ - lib/vendor/hikidoc.rb
40
+ - spec/piki_doc/document_spec.rb
41
+ - spec/piki_doc/output_spec.rb
42
+ - spec/piki_doc_spec.rb
43
+ - features/step_definitions/pluggable_hikidoc_steps.rb
44
+ - features/support/env.rb
45
+ - features/asin_plugin.feature
46
+ - features/gist_plugin.feature
47
+ has_rdoc: false
48
+ homepage: http://github.com/moro/piki_doc/
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --title
52
+ - piki_doc documentation
53
+ - --charset
54
+ - utf-8
55
+ - --opname
56
+ - index.html
57
+ - --line-numbers
58
+ - --main
59
+ - README.ja.hiki
60
+ - --inline-source
61
+ - --exclude
62
+ - ^(examples|extras)/
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.2.0
81
+ signing_key:
82
+ specification_version: 2
83
+ summary: extended HikiDoc to able to plug plugins.
84
+ test_files:
85
+ - spec/piki_doc/document_spec.rb
86
+ - spec/piki_doc/output_spec.rb
87
+ - spec/piki_doc_spec.rb
88
+ - features/step_definitions/pluggable_hikidoc_steps.rb
89
+ - features/support/env.rb
90
+ - features/asin_plugin.feature
91
+ - features/gist_plugin.feature