hamdown 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/hamdown +6 -0
  2. data/lib/hamdown.rb +12 -3
  3. metadata +5 -5
@@ -3,3 +3,9 @@
3
3
  # Convert a file from markdown to html wrapped in a haml layout
4
4
 
5
5
  require 'hamdown'
6
+
7
+ options = {}
8
+ options[:file_path] = ARGV[0] if ARGV[0]
9
+
10
+ hdown = Hamdown.new(options)
11
+ puts hdown.to_html
@@ -2,6 +2,15 @@ require 'rubygems'
2
2
  require 'rdiscount'
3
3
  require 'haml'
4
4
 
5
- innerfile = RDiscount.new(File.open(ARGV[0]).read)
6
- outerfile = File.open('layout.haml')
7
- puts Haml::Engine.new(outerfile.read).render { innerfile.to_html }
5
+ class Hamdown
6
+ def initialize(options={})
7
+ file = options.delete(:file_path) { raise "you need to specify a file name" }
8
+ @innerfile = RDiscount.new(File.open(file).read)
9
+ @outerfile = File.open('layout.haml')
10
+ end
11
+
12
+ def to_html
13
+ puts Haml::Engine.new(@outerfile.read).render { @innerfile.to_html }
14
+ end
15
+
16
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamdown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Robert Fletcher
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-27 00:00:00 -07:00
18
+ date: 2011-05-15 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -31,7 +31,7 @@ files:
31
31
  - lib/hamdown.rb
32
32
  - bin/hamdown
33
33
  has_rdoc: true
34
- homepage: http://www.knowledgepile.net
34
+ homepage: https://github.com/mockdeep/hamdown
35
35
  licenses: []
36
36
 
37
37
  post_install_message: