markd 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +0 -2
- data/README.md +19 -8
- data/Rakefile +2 -10
- data/VERSION +1 -1
- data/lib/markd/engines.rb +31 -0
- data/lib/markd/markd.rb +43 -0
- data/lib/markd.rb +4 -25
- data/markd.gemspec +10 -14
- data/template/template.html.erb +1 -1
- metadata +12 -33
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
markd
|
2
2
|
===========================
|
3
|
-
markd is rich html builder for markdown, and is especially focused on printing purpose.
|
3
|
+
markd is rich html builder for markdown, wiki and textile format. It is especially focused on printing purpose.
|
4
4
|
You can get well-formatted printings (or PDF by preview) when you print html using modern browser (such as Google Chrome, Firefox, Safari).
|
5
5
|
|
6
|
-
markd is based on [
|
6
|
+
markd is based on [BlueCloth][1], [RedCloth][2], [Wikitext][3] and [google code prittify][4].
|
7
7
|
|
8
8
|
features:
|
9
9
|
|
@@ -13,7 +13,9 @@ features:
|
|
13
13
|
- Code Highlighting
|
14
14
|
|
15
15
|
[1]: http://deveiate.org/projects/BlueCloth
|
16
|
-
[2]: http://
|
16
|
+
[2]: http://redcloth.org/
|
17
|
+
[3]: https://wincent.com/products/wikitext
|
18
|
+
[4]: http://code.google.com/p/google-code-prettify/
|
17
19
|
|
18
20
|
|
19
21
|
## Installation
|
@@ -34,19 +36,28 @@ Use -h (or --help) option to show detail.
|
|
34
36
|
|
35
37
|
$ markd -h
|
36
38
|
|
39
|
+
## Engines
|
40
|
+
markd has three engines:
|
41
|
+
|
42
|
+
- Markdown (default)
|
43
|
+
- Textile
|
44
|
+
- Wiki
|
45
|
+
|
46
|
+
markd automatically select engine by file extention (.md for Markdown, .textile for Textile, .wiki for Wiki).
|
47
|
+
|
37
48
|
## Instructions
|
38
49
|
See more instructions:
|
39
50
|
|
40
|
-
- [my blog post (in Japanese)][
|
51
|
+
- [my blog post (in Japanese)][5]
|
41
52
|
|
42
|
-
[
|
53
|
+
[5]: http://opentechnica.blogspot.com/2011/08/markd.html
|
43
54
|
|
44
55
|
## License
|
45
56
|
markd is released under the MIT license.
|
46
57
|
|
47
58
|
## Copyright
|
48
|
-
Copyright (c) 2011 [daisuke sugimori][
|
59
|
+
Copyright (c) 2011 [daisuke sugimori][6] ([@daixque][7]).
|
49
60
|
|
50
|
-
[
|
51
|
-
[
|
61
|
+
[6]: http://blognewart.blogspot.com/
|
62
|
+
[7]: http://twitter.com/daixque
|
52
63
|
|
data/Rakefile
CHANGED
@@ -17,8 +17,8 @@ Jeweler::Tasks.new do |gem|
|
|
17
17
|
gem.name = "markd"
|
18
18
|
gem.homepage = "http://github.com/daixque/markd"
|
19
19
|
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{html report builder for markdown}
|
21
|
-
gem.description = %Q{markd is html report builder for markdown. markd makes well-formatted html with CSS and prittfied code by Google Code Prettify.}
|
20
|
+
gem.summary = %Q{html report builder for markdown, textile and wiki}
|
21
|
+
gem.description = %Q{markd is html report builder for markdown, textile and wiki. markd makes well-formatted html with CSS and prittfied code by Google Code Prettify.}
|
22
22
|
gem.email = "daixque@gmail.com"
|
23
23
|
gem.authors = ["daisuke sugimori"]
|
24
24
|
gem.executables << "markd"
|
@@ -34,14 +34,6 @@ Rake::TestTask.new(:test) do |test|
|
|
34
34
|
test.verbose = true
|
35
35
|
end
|
36
36
|
|
37
|
-
require 'rcov/rcovtask'
|
38
|
-
Rcov::RcovTask.new do |test|
|
39
|
-
test.libs << 'test'
|
40
|
-
test.pattern = 'test/**/test_*.rb'
|
41
|
-
test.verbose = true
|
42
|
-
test.rcov_opts << '--exclude "gems/*"'
|
43
|
-
end
|
44
|
-
|
45
37
|
task :default => :test
|
46
38
|
|
47
39
|
require 'rake/rdoctask'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
class MarkdownEngine
|
4
|
+
def initialize
|
5
|
+
require 'bluecloth'
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_html(src)
|
9
|
+
BlueCloth.new(src).to_html
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class WikiEngine
|
14
|
+
def initialize
|
15
|
+
require 'wikitext'
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_html(src)
|
19
|
+
Wikitext::Parser.new.parse(src)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class TextileEngine
|
24
|
+
def initialize
|
25
|
+
require 'RedCloth'
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_html(src)
|
29
|
+
RedCloth.new(src).to_html
|
30
|
+
end
|
31
|
+
end
|
data/lib/markd/markd.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'markd/engines'
|
3
|
+
require 'erubis'
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
class MarkD
|
7
|
+
ENGINES = {
|
8
|
+
/md/ => MarkdownEngine,
|
9
|
+
/wiki/ => WikiEngine,
|
10
|
+
/textile/ => TextileEngine,
|
11
|
+
}
|
12
|
+
ENGINES.default = MarkdownEngine
|
13
|
+
|
14
|
+
def create_engine(extname)
|
15
|
+
ENGINES.each do |regex, engine|
|
16
|
+
return engine.new if regex =~ extname
|
17
|
+
end
|
18
|
+
ENGINES[nil].new
|
19
|
+
end
|
20
|
+
|
21
|
+
def publish(filename, out_dir_path)
|
22
|
+
ext = File.extname(filename)
|
23
|
+
engine = create_engine ext
|
24
|
+
src = File.read filename
|
25
|
+
|
26
|
+
# parse
|
27
|
+
@html = engine.to_html(src)
|
28
|
+
|
29
|
+
doc = Nokogiri::HTML::Document.parse @html
|
30
|
+
@title = doc.css("h1:first").text
|
31
|
+
|
32
|
+
# render
|
33
|
+
erb_src = File.read "#{APP_ROOT}/template/template.html.erb"
|
34
|
+
eruby = Erubis::Eruby.new(erb_src)
|
35
|
+
html = eruby.result(binding)
|
36
|
+
|
37
|
+
# output
|
38
|
+
FileUtils.mkdir_p out_dir_path
|
39
|
+
File.open("#{out_dir_path}/index.html", "w") { |f| f.puts html }
|
40
|
+
dirs = ::RESOURCES.map { |d| "#{APP_ROOT}/template/#{d}"}
|
41
|
+
FileUtils.cp_r(dirs, out_dir_path)
|
42
|
+
end
|
43
|
+
end
|
data/lib/markd.rb
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
-
require 'bluecloth'
|
6
|
-
require 'erubis'
|
7
5
|
require 'optparse'
|
8
6
|
require 'fileutils'
|
9
|
-
|
7
|
+
|
8
|
+
require 'markd/markd'
|
10
9
|
|
11
10
|
APP_NAME = 'markd'
|
12
11
|
APP_ROOT = File.dirname File.expand_path(__FILE__ + "/..")
|
@@ -61,28 +60,8 @@ USAGE
|
|
61
60
|
|
62
61
|
filename = argv.first
|
63
62
|
force_exit("#{filename} not file or exists") unless File.file? filename
|
64
|
-
md_src = File.read filename
|
63
|
+
#md_src = File.read filename
|
65
64
|
out_dir = @options[:out_dir] || "docs"
|
66
|
-
MarkD.new.publish(
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
class MarkD
|
71
|
-
def publish(md_src, out_dir_path)
|
72
|
-
# parse
|
73
|
-
@md_html = BlueCloth.new(md_src).to_html
|
74
|
-
doc = Nokogiri::HTML::Document.parse @md_html
|
75
|
-
@title = doc.css("h1:first").text
|
76
|
-
|
77
|
-
# render
|
78
|
-
erb_src = File.read "#{APP_ROOT}/template/template.html.erb"
|
79
|
-
eruby = Erubis::Eruby.new(erb_src)
|
80
|
-
html = eruby.result(binding)
|
81
|
-
|
82
|
-
# output
|
83
|
-
FileUtils.mkdir_p out_dir_path
|
84
|
-
File.open("#{out_dir_path}/index.html", "w") { |f| f.puts html }
|
85
|
-
dirs = ::RESOURCES.map { |d| "#{APP_ROOT}/template/#{d}"}
|
86
|
-
FileUtils.cp_r(dirs, out_dir_path)
|
65
|
+
MarkD.new.publish(filename, out_dir)
|
87
66
|
end
|
88
67
|
end
|
data/markd.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "markd"
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["daisuke sugimori"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-02-27"
|
13
|
+
s.description = "markd is html report builder for markdown, textile and wiki. markd makes well-formatted html with CSS and prittfied code by Google Code Prettify."
|
14
|
+
s.email = "daixque@gmail.com"
|
15
15
|
s.executables = ["markd", "markd"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"README.md"
|
@@ -24,6 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
"VERSION",
|
25
25
|
"bin/markd",
|
26
26
|
"lib/markd.rb",
|
27
|
+
"lib/markd/engines.rb",
|
28
|
+
"lib/markd/markd.rb",
|
27
29
|
"markd.gemspec",
|
28
30
|
"template/css/markd-print.css",
|
29
31
|
"template/css/markd-screen.css",
|
@@ -36,11 +38,11 @@ Gem::Specification.new do |s|
|
|
36
38
|
"test/helper.rb",
|
37
39
|
"test/test_markd.rb"
|
38
40
|
]
|
39
|
-
s.homepage =
|
41
|
+
s.homepage = "http://github.com/daixque/markd"
|
40
42
|
s.licenses = ["MIT"]
|
41
43
|
s.require_paths = ["lib"]
|
42
|
-
s.rubygems_version =
|
43
|
-
s.summary =
|
44
|
+
s.rubygems_version = "1.8.17"
|
45
|
+
s.summary = "html report builder for markdown, textile and wiki"
|
44
46
|
|
45
47
|
if s.respond_to? :specification_version then
|
46
48
|
s.specification_version = 3
|
@@ -49,27 +51,21 @@ Gem::Specification.new do |s|
|
|
49
51
|
s.add_runtime_dependency(%q<erubis>, [">= 0"])
|
50
52
|
s.add_runtime_dependency(%q<bluecloth>, [">= 0"])
|
51
53
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
52
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
54
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
55
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
55
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
56
56
|
else
|
57
57
|
s.add_dependency(%q<erubis>, [">= 0"])
|
58
58
|
s.add_dependency(%q<bluecloth>, [">= 0"])
|
59
59
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
60
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
61
60
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
61
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
63
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
64
62
|
end
|
65
63
|
else
|
66
64
|
s.add_dependency(%q<erubis>, [">= 0"])
|
67
65
|
s.add_dependency(%q<bluecloth>, [">= 0"])
|
68
66
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
69
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
70
67
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
68
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
72
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
73
69
|
end
|
74
70
|
end
|
75
71
|
|
data/template/template.html.erb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: markd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- daisuke sugimori
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-02-27 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: erubis
|
@@ -45,20 +45,9 @@ dependencies:
|
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: shoulda
|
50
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: "0"
|
56
|
-
type: :development
|
57
|
-
prerelease: false
|
58
|
-
version_requirements: *id004
|
59
48
|
- !ruby/object:Gem::Dependency
|
60
49
|
name: bundler
|
61
|
-
requirement: &
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
62
51
|
none: false
|
63
52
|
requirements:
|
64
53
|
- - ~>
|
@@ -66,10 +55,10 @@ dependencies:
|
|
66
55
|
version: 1.0.0
|
67
56
|
type: :development
|
68
57
|
prerelease: false
|
69
|
-
version_requirements: *
|
58
|
+
version_requirements: *id004
|
70
59
|
- !ruby/object:Gem::Dependency
|
71
60
|
name: jeweler
|
72
|
-
requirement: &
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
73
62
|
none: false
|
74
63
|
requirements:
|
75
64
|
- - ~>
|
@@ -77,23 +66,11 @@ dependencies:
|
|
77
66
|
version: 1.6.4
|
78
67
|
type: :development
|
79
68
|
prerelease: false
|
80
|
-
version_requirements: *
|
81
|
-
-
|
82
|
-
name: rcov
|
83
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: "0"
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: *id007
|
92
|
-
description: markd is html report builder for markdown. markd makes well-formatted html with CSS and prittfied code by Google Code Prettify.
|
69
|
+
version_requirements: *id005
|
70
|
+
description: markd is html report builder for markdown, textile and wiki. markd makes well-formatted html with CSS and prittfied code by Google Code Prettify.
|
93
71
|
email: daixque@gmail.com
|
94
72
|
executables:
|
95
73
|
- markd
|
96
|
-
- markd
|
97
74
|
extensions: []
|
98
75
|
|
99
76
|
extra_rdoc_files:
|
@@ -106,6 +83,8 @@ files:
|
|
106
83
|
- VERSION
|
107
84
|
- bin/markd
|
108
85
|
- lib/markd.rb
|
86
|
+
- lib/markd/engines.rb
|
87
|
+
- lib/markd/markd.rb
|
109
88
|
- markd.gemspec
|
110
89
|
- template/css/markd-print.css
|
111
90
|
- template/css/markd-screen.css
|
@@ -130,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
109
|
requirements:
|
131
110
|
- - ">="
|
132
111
|
- !ruby/object:Gem::Version
|
133
|
-
hash: -
|
112
|
+
hash: -454336790150292475
|
134
113
|
segments:
|
135
114
|
- 0
|
136
115
|
version: "0"
|
@@ -143,9 +122,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
122
|
requirements: []
|
144
123
|
|
145
124
|
rubyforge_project:
|
146
|
-
rubygems_version: 1.
|
125
|
+
rubygems_version: 1.8.17
|
147
126
|
signing_key:
|
148
127
|
specification_version: 3
|
149
|
-
summary: html report builder for markdown
|
128
|
+
summary: html report builder for markdown, textile and wiki
|
150
129
|
test_files: []
|
151
130
|
|