middleman-hikidoc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa93477d02018fd578f085718b05ae232bc1d254
4
- data.tar.gz: 8570517185e4c7f93f41ae608591b4597fc65c8e
3
+ metadata.gz: 3b58e1d9d544e9f0fc958ffeacc1de19a8ae4499
4
+ data.tar.gz: 6acce35cf3ec5098c078ec5f1eadc0808e2cbc1d
5
5
  SHA512:
6
- metadata.gz: c753b431783063ffaf453dc530834bf89a02b238f041876a99e68df5373eae5122dcf939b09bdb7032debba867f823b4b3c9089be29f25573dd7ed14e21519d9
7
- data.tar.gz: ee5a36ea38e4fc6368a94c8c0a5d35c3aea62625a3da26ea1ae7fde66f264715e7ae0417aad2aad04bca0b62bc2b725bfe5c36641a6fcb1986e367f40286c52c
6
+ metadata.gz: dc124ae3bfb08131869d981720f8fbbfbc15cef065346b6e43c608f3f137a3b787792c9e23b92ee9ea2d2bbe3ad0f3b3e682e7d7bb4c2f02e1b0e6e02a8d8591
7
+ data.tar.gz: 92a00641dcf8664e39d308fef4354d59e8bbd2b7a3fc5442d224bc141deb43b333ac93df9d6fd2c7c5f5f6efdeb913d520bf44acb31c26693fe1343fc49b014c
@@ -0,0 +1 @@
1
+ /spec/build
data/README.md CHANGED
@@ -13,6 +13,25 @@ Then add this to config.rb
13
13
 
14
14
  activate :hikidoc
15
15
 
16
+ ## Options
17
+
18
+ Map `!` to `h3` instead of `h1`
19
+
20
+ activate :hikidoc, level: 3
21
+
22
+ Use to_html instead of to_xhtml
23
+
24
+ activate :hikidoc, format: :html
25
+
26
+ Other options:
27
+
28
+ option :format, :xhtml
29
+ option :plugin_syntax, nil
30
+ option :level, 1
31
+ option :allow_bracket_inline_image, true
32
+ option :use_wiki_name, true
33
+ option :use_not_wiki_name, true
34
+
16
35
  ## License
17
36
 
18
37
  MIT
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ desc "run test"
4
+ task :spec do
5
+ sh "rspec"
6
+ end
7
+
8
+ task :default => :spec
@@ -6,10 +6,30 @@ require 'middleman-hikidoc/version'
6
6
  module Middleman
7
7
  module Renderers
8
8
  class Hikidoc < Middleman::Extension
9
+ option :format, :xhtml
10
+ option :plugin_syntax, nil
11
+ option :level, 1
12
+ option :allow_bracket_inline_image, true
13
+ option :use_wiki_name, true
14
+ option :use_not_wiki_name, true
15
+
16
+ def initialize(app, options_hash={}, &block)
17
+ super
18
+
19
+ @@options = options
20
+ end
21
+
22
+ # Retuns a Hash of options given in config.rb
23
+ # FIXME: I don't know proper way to pass options to HikidocTemplate...
24
+ def self.options
25
+ @@options.to_h
26
+ end
27
+
9
28
  def after_configuration
10
29
  app.template_extensions :hd => :html
11
30
  end
12
31
 
32
+ # Extend Tilt to handle HikiDoc
13
33
  class HikidocTemplate < ::Tilt::Template
14
34
  def self.engine_initialized?
15
35
  defined? ::HikiDoc
@@ -24,19 +44,25 @@ module Middleman
24
44
  end
25
45
 
26
46
  def evaluate(scope, locals, &block)
27
- @output ||= HikiDoc.to_xhtml(data)
47
+ options = Middleman::Renderers::Hikidoc.options
48
+ method = case options[:format]
49
+ when :html
50
+ :to_html
51
+ when :xhtml, nil
52
+ :to_xhtml
53
+ else
54
+ raise ArgumentError, "unknown value for format: #{options[:format].inspect}"
55
+ end
56
+ @output ||= HikiDoc.__send__(method, data, options)
28
57
  end
29
58
 
30
59
  def allows_script?
31
60
  false
32
61
  end
33
62
  end
34
-
35
63
  ::Tilt.register HikidocTemplate, 'hd'
36
64
  end
37
65
  end
38
66
  end
39
67
 
40
-
41
68
  ::Middleman::Extensions.register(:hikidoc, Middleman::Renderers::Hikidoc)
42
-
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  class Hikidoc
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -0,0 +1,2 @@
1
+ gem 'middleman'
2
+ gem 'middleman-hikidoc', path: '../'
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ middleman-hikidoc (0.0.1)
5
+ hikidoc (~> 0.0.6)
6
+
7
+ GEM
8
+ specs:
9
+ activesupport (3.2.15)
10
+ i18n (~> 0.6, >= 0.6.4)
11
+ multi_json (~> 1.0)
12
+ chunky_png (1.2.9)
13
+ coffee-script (2.2.0)
14
+ coffee-script-source
15
+ execjs
16
+ coffee-script-source (1.6.3)
17
+ compass (0.12.2)
18
+ chunky_png (~> 1.2)
19
+ fssm (>= 0.2.7)
20
+ sass (~> 3.1)
21
+ execjs (1.4.0)
22
+ multi_json (~> 1.0)
23
+ ffi (1.9.0)
24
+ fssm (0.2.10)
25
+ haml (4.0.3)
26
+ tilt
27
+ hike (1.2.3)
28
+ hikidoc (0.0.6)
29
+ i18n (0.6.5)
30
+ kramdown (1.2.0)
31
+ listen (1.3.1)
32
+ rb-fsevent (>= 0.9.3)
33
+ rb-inotify (>= 0.9)
34
+ rb-kqueue (>= 0.2)
35
+ middleman (3.1.6)
36
+ coffee-script (~> 2.2.0)
37
+ compass (>= 0.12.2)
38
+ execjs (~> 1.4.0)
39
+ haml (>= 3.1.6)
40
+ kramdown (~> 1.2)
41
+ middleman-core (= 3.1.6)
42
+ middleman-more (= 3.1.6)
43
+ middleman-sprockets (>= 3.1.2)
44
+ sass (>= 3.1.20)
45
+ uglifier (~> 2.1.0)
46
+ middleman-core (3.1.6)
47
+ activesupport (~> 3.2.6)
48
+ bundler (~> 1.1)
49
+ i18n (~> 0.6.1)
50
+ listen (~> 1.1)
51
+ rack (>= 1.4.5)
52
+ rack-test (~> 0.6.1)
53
+ thor (>= 0.15.2, < 2.0)
54
+ tilt (~> 1.3.6)
55
+ middleman-more (3.1.6)
56
+ middleman-sprockets (3.1.4)
57
+ middleman-core (>= 3.0.14)
58
+ middleman-more (>= 3.0.14)
59
+ sprockets (~> 2.1)
60
+ sprockets-helpers (~> 1.0.0)
61
+ sprockets-sass (~> 1.0.0)
62
+ multi_json (1.8.2)
63
+ rack (1.5.2)
64
+ rack-test (0.6.2)
65
+ rack (>= 1.0)
66
+ rb-fsevent (0.9.3)
67
+ rb-inotify (0.9.2)
68
+ ffi (>= 0.5.0)
69
+ rb-kqueue (0.2.0)
70
+ ffi (>= 0.5.0)
71
+ sass (3.2.12)
72
+ sprockets (2.10.0)
73
+ hike (~> 1.2)
74
+ multi_json (~> 1.0)
75
+ rack (~> 1.0)
76
+ tilt (~> 1.1, != 1.3.0)
77
+ sprockets-helpers (1.0.1)
78
+ sprockets (~> 2.0)
79
+ sprockets-sass (1.0.2)
80
+ sprockets (~> 2.0)
81
+ tilt (~> 1.1)
82
+ thor (0.18.1)
83
+ tilt (1.3.7)
84
+ uglifier (2.1.2)
85
+ execjs (>= 0.3.0)
86
+ multi_json (~> 1.0, >= 1.0.2)
87
+
88
+ PLATFORMS
89
+ ruby
90
+
91
+ DEPENDENCIES
92
+ middleman
93
+ middleman-hikidoc!
@@ -0,0 +1,4 @@
1
+ activate :hikidoc do |f|
2
+ f.level = ENV['LEVEL'].to_i if ENV['LEVEL']
3
+ f.format = :html if ENV['FORMAT'] == "html"
4
+ end
@@ -0,0 +1,28 @@
1
+ describe "middleman-hikidoc" do
2
+ it "should convert *.hd to *.html" do
3
+ Dir.chdir(File.dirname(__FILE__)) do
4
+ system "bundle exec middleman build"
5
+ converted = File.read("build/index.html")
6
+
7
+ expect(converted).to eq("<h1>Hi</h1>\n<hr />\n")
8
+ end
9
+ end
10
+
11
+ it "should be able to handle options" do
12
+ Dir.chdir(File.dirname(__FILE__)) do
13
+ system "LEVEL=2 bundle exec middleman build"
14
+ converted = File.read("build/index.html")
15
+
16
+ expect(converted).to eq("<h2>Hi</h2>\n<hr />\n")
17
+ end
18
+ end
19
+
20
+ it "should support :html mode" do
21
+ Dir.chdir(File.dirname(__FILE__)) do
22
+ system "FORMAT=html bundle exec middleman build"
23
+ converted = File.read("build/index.html")
24
+
25
+ expect(converted).to eq("<h1>Hi</h1>\n<hr>\n")
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,2 @@
1
+ ! Hi
2
+ ----
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-hikidoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yhara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hikidoc
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - .gitignore
48
49
  - Gemfile
49
50
  - Gemfile.lock
50
51
  - README.md
@@ -53,6 +54,11 @@ files:
53
54
  - lib/middleman-hikidoc/version.rb
54
55
  - lib/middleman_extension.rb
55
56
  - middleman-hikidoc.gemspec
57
+ - spec/Gemfile
58
+ - spec/Gemfile.lock
59
+ - spec/config.rb
60
+ - spec/middleman-hikidoc_spec.rb
61
+ - spec/source/index.hd
56
62
  homepage: https://github.com/yhara/middleman-hikidoc
57
63
  licenses:
58
64
  - MIT
@@ -77,4 +83,9 @@ rubygems_version: 2.0.14
77
83
  signing_key:
78
84
  specification_version: 4
79
85
  summary: Add HikiDoc support for middleman
80
- test_files: []
86
+ test_files:
87
+ - spec/Gemfile
88
+ - spec/Gemfile.lock
89
+ - spec/config.rb
90
+ - spec/middleman-hikidoc_spec.rb
91
+ - spec/source/index.hd