m2h 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/bin/m2h +33 -0
- data/lib/m2h.rb +8 -0
- data/lib/m2h/_layout.erb +304 -0
- data/lib/m2h/base.rb +37 -0
- data/lib/m2h/optparser.rb +27 -0
- data/lib/m2h/render.rb +82 -0
- data/lib/m2h/version.rb +3 -0
- data/m2h.gemspec +34 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c26564fb711fae98eb38a5798b8ac51102f0fba6
|
4
|
+
data.tar.gz: b751f65f0c2065b22a6d9a40de25cf6fed0afe72
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 03d70cd766e084eee531a2c4f97291cd15b08658a920170e391a65928d7f43c8102625c6eed7826de9f462cad656cfedea7e48803a713378f4b2aa7dd75240cc
|
7
|
+
data.tar.gz: 1021748158389f2c93a359a2f888683306d209b81ed5c185aa58e5cc00f5de5bd930710dfb5c4661a41079a4587273c916c986cf2d6747817924d92beedfe61d
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Masahiro Arakane
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# m2h
|
2
|
+
|
3
|
+
markdown to html compiler.
|
4
|
+
|
5
|
+
## feature
|
6
|
+
|
7
|
+
- page-break
|
8
|
+
- '////' 4 or more slashes.
|
9
|
+
- header style
|
10
|
+
- with title and page-number
|
11
|
+
- cover
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Install it yourself as:
|
16
|
+
|
17
|
+
$ gem install m2h
|
18
|
+
|
19
|
+
Or dd this line to your application's Gemfile:
|
20
|
+
|
21
|
+
gem 'm2h'
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Usage : m2h <markdonw_file1> <markdonw_file2> ...
|
31
|
+
Options:
|
32
|
+
-s, --serif : font-family -> serif
|
33
|
+
-c, --cover : with cover page
|
34
|
+
-h, --help : show this messages
|
35
|
+
-v, --version : show version infomation
|
36
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/m2h
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift(File.dirname(__FILE__) + "/../lib")
|
4
|
+
require 'm2h'
|
5
|
+
|
6
|
+
option = {
|
7
|
+
serif: false,
|
8
|
+
toc: false,
|
9
|
+
}
|
10
|
+
|
11
|
+
M2H::OptParser.new do |opt|
|
12
|
+
opt.on('-s', '--serif') {|v| option[:serif] = true}
|
13
|
+
opt.on('-c', '--cover') {|v| option[:cover] = true}
|
14
|
+
opt.on('-d', '--header') {|v| option[:header] = true}
|
15
|
+
opt.on('-t', '--toc') {|v| option[:toc] = true}
|
16
|
+
opt.on('-h', '--help') {|v| puts opt.help; exit}
|
17
|
+
opt.on('-v', '--version') {|v| puts "M2H::VERSION => #{M2H::VERSION}"; exit}
|
18
|
+
|
19
|
+
begin
|
20
|
+
opt.parse!(ARGV)
|
21
|
+
if ARGV.empty?
|
22
|
+
puts opt.help
|
23
|
+
exit 0
|
24
|
+
end
|
25
|
+
M2H::Render.render! M2H::Base.new(ARGV, option)
|
26
|
+
rescue OptionParser::InvalidOption => e
|
27
|
+
M2H::OptionError.new(e.message)
|
28
|
+
puts opt.help
|
29
|
+
exit 3
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# vim set: ft=ruby fenc= utf-8 ff=unix
|
data/lib/m2h.rb
ADDED
data/lib/m2h/_layout.erb
ADDED
@@ -0,0 +1,304 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title><%= @title %></title>
|
6
|
+
<style type="text/css">
|
7
|
+
body {
|
8
|
+
color: #333333;
|
9
|
+
font-family: "Century Gothic", Helvetica, Meiryo, arial, sans-serif;
|
10
|
+
<%= "font-family: serif;" if @serif %>
|
11
|
+
font-size: 13px;
|
12
|
+
line-height: 1.6;
|
13
|
+
background-color: white;
|
14
|
+
padding: 10px 20px;
|
15
|
+
margin: 0;
|
16
|
+
padding-top: 0;}
|
17
|
+
|
18
|
+
body > *:first-child {
|
19
|
+
margin-top: 0 !important; }
|
20
|
+
body > *:last-child {
|
21
|
+
margin-bottom: 0 !important; }
|
22
|
+
|
23
|
+
a {
|
24
|
+
color: #4183C4; }
|
25
|
+
a.absent {
|
26
|
+
color: #cc0000; }
|
27
|
+
a.anchor {
|
28
|
+
display: block;
|
29
|
+
padding-left: 30px;
|
30
|
+
margin-left: -30px;
|
31
|
+
cursor: pointer;
|
32
|
+
position: absolute;
|
33
|
+
top: 0;
|
34
|
+
left: 0;
|
35
|
+
bottom: 0; }
|
36
|
+
|
37
|
+
h1, h2, h3, h4, h5, h6 {
|
38
|
+
margin: 10px 0;
|
39
|
+
padding: 0;
|
40
|
+
font-weight: normal;
|
41
|
+
-webkit-font-smoothing: antialiased;
|
42
|
+
cursor: text;
|
43
|
+
position: relative; }
|
44
|
+
h4, h5, h6 {
|
45
|
+
font-weight: normal;}
|
46
|
+
|
47
|
+
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
|
48
|
+
text-decoration: none; }
|
49
|
+
h1 tt, h1 code {
|
50
|
+
font-size: inherit; }
|
51
|
+
h2 tt, h2 code {
|
52
|
+
font-size: inherit; }
|
53
|
+
h3 tt, h3 code {
|
54
|
+
font-size: inherit; }
|
55
|
+
h4 tt, h4 code {
|
56
|
+
font-size: inherit; }
|
57
|
+
h5 tt, h5 code {
|
58
|
+
font-size: inherit; }
|
59
|
+
h6 tt, h6 code {
|
60
|
+
font-size: inherit; }
|
61
|
+
|
62
|
+
h1 {
|
63
|
+
font-size: 25px;
|
64
|
+
border-bottom: 1px solid #ddd;
|
65
|
+
color: black; }
|
66
|
+
h2 {
|
67
|
+
font-size: 20px;
|
68
|
+
border-bottom: 1px solid #eee;
|
69
|
+
color: black; }
|
70
|
+
h3 {
|
71
|
+
font-size: 16px; }
|
72
|
+
h4 {
|
73
|
+
font-size: 15px; }
|
74
|
+
h5 {
|
75
|
+
font-size: 14px; }
|
76
|
+
h6 {
|
77
|
+
color: #777777;
|
78
|
+
font-size: 13px; }
|
79
|
+
p, blockquote, ul, ol, dl, li, table, pre {
|
80
|
+
margin: 15px 0; }
|
81
|
+
|
82
|
+
hr {
|
83
|
+
border: 0 none;
|
84
|
+
color: #cccccc;
|
85
|
+
height: 4px;
|
86
|
+
padding: 0; }
|
87
|
+
|
88
|
+
body > h2:first-child {
|
89
|
+
margin-top: 0;
|
90
|
+
padding-top: 0; }
|
91
|
+
body > h1:first-child {
|
92
|
+
margin-top: 0;
|
93
|
+
padding-top: 0; }
|
94
|
+
body > h1:first-child + h2 {
|
95
|
+
margin-top: 0;
|
96
|
+
padding-top: 0; }
|
97
|
+
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
|
98
|
+
margin-top: 0;
|
99
|
+
padding-top: 0; }
|
100
|
+
|
101
|
+
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
|
102
|
+
margin-top: 0;
|
103
|
+
padding-top: 0; }
|
104
|
+
|
105
|
+
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
|
106
|
+
margin-top: 0; }
|
107
|
+
|
108
|
+
li p.first {
|
109
|
+
display: inline-block; }
|
110
|
+
ul, ol {
|
111
|
+
padding-left: 30px; }
|
112
|
+
ul :first-child, ol :first-child {
|
113
|
+
margin-top: 0; }
|
114
|
+
ul :last-child, ol :last-child {
|
115
|
+
margin-bottom: 0; }
|
116
|
+
dl {
|
117
|
+
padding: 0; }
|
118
|
+
dl dt {
|
119
|
+
font-size: 14px;
|
120
|
+
font-weight: bold;
|
121
|
+
font-style: italic;
|
122
|
+
padding: 0;
|
123
|
+
margin: 15px 0 5px; }
|
124
|
+
dl dt:first-child {
|
125
|
+
padding: 0; }
|
126
|
+
dl dt > :first-child {
|
127
|
+
margin-top: 0; }
|
128
|
+
dl dt > :last-child {
|
129
|
+
margin-bottom: 0; }
|
130
|
+
dl dd {
|
131
|
+
margin: 0 0 15px;
|
132
|
+
padding: 0 15px; }
|
133
|
+
dl dd > :first-child {
|
134
|
+
margin-top: 0; }
|
135
|
+
dl dd > :last-child {
|
136
|
+
margin-bottom: 0; }
|
137
|
+
|
138
|
+
blockquote {
|
139
|
+
border-left: 4px solid #dddddd;
|
140
|
+
padding: 0 15px;
|
141
|
+
color: #555555; }
|
142
|
+
blockquote > :first-child {
|
143
|
+
margin-top: 0; }
|
144
|
+
blockquote > :last-child {
|
145
|
+
margin-bottom: 0; }
|
146
|
+
|
147
|
+
table {
|
148
|
+
border-collapse: collapse;
|
149
|
+
padding: 0; }
|
150
|
+
table tr {
|
151
|
+
border-top: 1px solid #cccccc;
|
152
|
+
background-color: white;
|
153
|
+
margin: 0;
|
154
|
+
padding: 0; }
|
155
|
+
table tr:nth-child(2n) {
|
156
|
+
background-color: #f8f8f8; }
|
157
|
+
table tr th {
|
158
|
+
font-weight: bold;
|
159
|
+
background: #fbfbfb;
|
160
|
+
border: 1px solid #cccccc;
|
161
|
+
text-align: left;
|
162
|
+
margin: 0;
|
163
|
+
padding: 6px 13px; }
|
164
|
+
table tr td {
|
165
|
+
border: 1px solid #cccccc;
|
166
|
+
text-align: left;
|
167
|
+
margin: 0;
|
168
|
+
padding: 6px 13px; }
|
169
|
+
table tr th :first-child, table tr td :first-child {
|
170
|
+
margin-top: 0; }
|
171
|
+
table tr th :last-child, table tr td :last-child {
|
172
|
+
margin-bottom: 0; }
|
173
|
+
|
174
|
+
img {
|
175
|
+
max-width: 100%; }
|
176
|
+
|
177
|
+
span.frame {
|
178
|
+
display: block;
|
179
|
+
overflow: hidden; }
|
180
|
+
span.frame > span {
|
181
|
+
border: 1px solid #dddddd;
|
182
|
+
display: block;
|
183
|
+
float: left;
|
184
|
+
overflow: hidden;
|
185
|
+
margin: 13px 0 0;
|
186
|
+
padding: 7px;
|
187
|
+
width: auto; }
|
188
|
+
span.frame span img {
|
189
|
+
display: block;
|
190
|
+
float: left; }
|
191
|
+
span.frame span span {
|
192
|
+
clear: both;
|
193
|
+
color: #333333;
|
194
|
+
display: block;
|
195
|
+
padding: 5px 0 0; }
|
196
|
+
span.align-center {
|
197
|
+
display: block;
|
198
|
+
overflow: hidden;
|
199
|
+
clear: both; }
|
200
|
+
span.align-center > span {
|
201
|
+
display: block;
|
202
|
+
overflow: hidden;
|
203
|
+
margin: 13px auto 0;
|
204
|
+
text-align: center; }
|
205
|
+
span.align-center span img {
|
206
|
+
margin: 0 auto;
|
207
|
+
text-align: center; }
|
208
|
+
span.align-right {
|
209
|
+
display: block;
|
210
|
+
overflow: hidden;
|
211
|
+
clear: both; }
|
212
|
+
span.align-right > span {
|
213
|
+
display: block;
|
214
|
+
overflow: hidden;
|
215
|
+
margin: 13px 0 0;
|
216
|
+
text-align: right; }
|
217
|
+
span.align-right span img {
|
218
|
+
margin: 0;
|
219
|
+
text-align: right; }
|
220
|
+
span.float-left {
|
221
|
+
display: block;
|
222
|
+
margin-right: 13px;
|
223
|
+
overflow: hidden;
|
224
|
+
float: left; }
|
225
|
+
span.float-left span {
|
226
|
+
margin: 13px 0 0; }
|
227
|
+
span.float-right {
|
228
|
+
display: block;
|
229
|
+
margin-left: 13px;
|
230
|
+
overflow: hidden;
|
231
|
+
float: right; }
|
232
|
+
span.float-right > span {
|
233
|
+
display: block;
|
234
|
+
overflow: hidden;
|
235
|
+
margin: 13px auto 0;
|
236
|
+
text-align: right; }
|
237
|
+
|
238
|
+
code, tt {
|
239
|
+
margin: 0 2px;
|
240
|
+
padding: 0 5px;
|
241
|
+
white-space: nowrap;
|
242
|
+
border: 1px solid #eaeaea;
|
243
|
+
background-color: #f8f8f8;
|
244
|
+
border-radius: 3px; }
|
245
|
+
pre code {
|
246
|
+
margin: 0;
|
247
|
+
padding: 0;
|
248
|
+
white-space: pre;
|
249
|
+
border: none;
|
250
|
+
background: transparent; }
|
251
|
+
.highlight pre {
|
252
|
+
background-color: #f8f8f8;
|
253
|
+
border: 1px solid #cccccc;
|
254
|
+
font-size: 13px;
|
255
|
+
line-height: 19px;
|
256
|
+
overflow: auto;
|
257
|
+
padding: 6px 10px;
|
258
|
+
border-radius: 3px; }
|
259
|
+
pre {
|
260
|
+
background-color: #f8f8f8;
|
261
|
+
border: 1px solid #cccccc;
|
262
|
+
font-size: 13px;
|
263
|
+
line-height: 19px;
|
264
|
+
overflow: auto;
|
265
|
+
padding: 6px 10px;
|
266
|
+
border-radius: 3px; }
|
267
|
+
pre code, pre tt {
|
268
|
+
background-color: transparent;
|
269
|
+
border: none; }
|
270
|
+
|
271
|
+
.page_number {
|
272
|
+
margin: 0;
|
273
|
+
padding: 0;
|
274
|
+
text-align: right;
|
275
|
+
font-size: small;
|
276
|
+
color: #555555;
|
277
|
+
border-bottom: 1px solid #e1e1e1;}
|
278
|
+
.break {
|
279
|
+
page-break-before: always;}
|
280
|
+
|
281
|
+
@media screen {
|
282
|
+
.cover {
|
283
|
+
display: none;}
|
284
|
+
}
|
285
|
+
|
286
|
+
@media print {
|
287
|
+
.cover h1 {
|
288
|
+
margin-top: 50%;
|
289
|
+
border-bottom: 0;
|
290
|
+
text-align: center;}
|
291
|
+
}
|
292
|
+
|
293
|
+
<%= ".page_number {display: none;}" unless @header %>
|
294
|
+
|
295
|
+
</style>
|
296
|
+
</head>
|
297
|
+
<body>
|
298
|
+
|
299
|
+
<%= @cover %>
|
300
|
+
|
301
|
+
<%= @html %>
|
302
|
+
|
303
|
+
</body>
|
304
|
+
</html>
|
data/lib/m2h/base.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module M2H
|
2
|
+
class Base
|
3
|
+
attr_reader :files, :sys_enc, :serif, :header, :cover, :toc
|
4
|
+
|
5
|
+
def initialize(argv, option)
|
6
|
+
@errors = []
|
7
|
+
@files = path_inspect(argv)
|
8
|
+
@sys_enc = Encoding.locale_charmap
|
9
|
+
@serif = option[:serif] ? true : false
|
10
|
+
@header = option[:header] ? true : false
|
11
|
+
@cover = option[:cover] ? true : false
|
12
|
+
@toc = option[:toc] ? true : false
|
13
|
+
if @errors.empty?
|
14
|
+
return self
|
15
|
+
else
|
16
|
+
@errors.each do |e|
|
17
|
+
puts e
|
18
|
+
end
|
19
|
+
exit 3
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def path_inspect(files)
|
24
|
+
is_valid = true
|
25
|
+
expanded_paths = []
|
26
|
+
files.each { |f|
|
27
|
+
unless File.exists?(File.expand_path(f))
|
28
|
+
is_valid = false
|
29
|
+
@errors.push("PathError: Could not found #{f}")
|
30
|
+
else
|
31
|
+
expanded_paths.push(File.expand_path(f))
|
32
|
+
end
|
33
|
+
}
|
34
|
+
return expanded_paths
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module M2H
|
2
|
+
require "optparse"
|
3
|
+
|
4
|
+
class OptParser < OptionParser
|
5
|
+
attr_reader :help
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@help = <<-HELP
|
9
|
+
Usage : m2h <markdonw_file1> <markdonw_file2> ...
|
10
|
+
Options:
|
11
|
+
-s, --serif : font-family -> serif
|
12
|
+
-d, --header : with header
|
13
|
+
-c, --cover : with cover page
|
14
|
+
-t, --toc : use tocify.js
|
15
|
+
-h, --help : show this messages
|
16
|
+
-v, --version : show version infomation
|
17
|
+
HELP
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class OptionError
|
23
|
+
def initialize(message)
|
24
|
+
$stderr.puts "!!! " << message << " !!!"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/m2h/render.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
module M2H
|
2
|
+
class Render
|
3
|
+
require "redcarpet"
|
4
|
+
require "erb"
|
5
|
+
|
6
|
+
class Document
|
7
|
+
attr_accessor :html_body
|
8
|
+
|
9
|
+
def initialize(html_body)
|
10
|
+
@erb_template = File.open(File.dirname(__FILE__) + "/_layout.erb").read
|
11
|
+
@html = generate_html(html_body)
|
12
|
+
@header = false
|
13
|
+
end
|
14
|
+
|
15
|
+
def generate_html(html_body)
|
16
|
+
@title = $1 if /h1>(.+)\<\/h1./ =~ html_body
|
17
|
+
@pages = html_body.split(/\/{4,}/) # page_break
|
18
|
+
@page_count = @pages.size
|
19
|
+
html = @pages.map.with_index { |page, i|
|
20
|
+
unless (i + 1) == @page_count
|
21
|
+
"<div class='page_number'>#{i+1}/#{@page_count}</div>\n" + page + "\n<div class='break'/>\n"
|
22
|
+
else
|
23
|
+
"<div class='page_number'>#{i+1}/#{@page_count}</div>\n" + page
|
24
|
+
end
|
25
|
+
}.join
|
26
|
+
html.gsub!(/page_number'>/, "page_number'>#{@title} ")
|
27
|
+
return html
|
28
|
+
end
|
29
|
+
|
30
|
+
def bind!
|
31
|
+
return ERB.new(@erb_template).result(binding)
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_header
|
35
|
+
@header = true
|
36
|
+
end
|
37
|
+
|
38
|
+
def write(path, enc)
|
39
|
+
File.open(path, enc).write(self.bind!)
|
40
|
+
end
|
41
|
+
|
42
|
+
def set_serif
|
43
|
+
@serif = "serif, "
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_cover
|
47
|
+
cover = "\n<div class='cover'><h1>#{@title}</h1></div>\n"
|
48
|
+
cover += "<div class='break'/>\n"
|
49
|
+
@cover = cover
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_toc
|
53
|
+
@toc = true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.render!(base)
|
58
|
+
markdown = Redcarpet::Markdown.new(
|
59
|
+
Redcarpet::Render::HTML,
|
60
|
+
space_after_headers: true,
|
61
|
+
fenced_code_blocks: true,
|
62
|
+
no_intra_emphasis: true,
|
63
|
+
strikethrough: true,
|
64
|
+
footnotes: true,
|
65
|
+
autolink: true,
|
66
|
+
tables: true,
|
67
|
+
with_toc_data: true,
|
68
|
+
)
|
69
|
+
|
70
|
+
base.files.each { |bf|
|
71
|
+
doc = Document.new(markdown.render(File.open(bf, "r:utf-8").read))
|
72
|
+
doc.set_serif if base.serif
|
73
|
+
doc.set_header if base.header
|
74
|
+
doc.set_cover if base.cover
|
75
|
+
doc.set_toc if base.toc
|
76
|
+
doc.write("#{bf}.html".encode(base.sys_enc), "w:#{base.sys_enc}")
|
77
|
+
puts "render: #{bf}.html"
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
data/lib/m2h/version.rb
ADDED
data/m2h.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'm2h/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "m2h"
|
8
|
+
s.version = "0.2.0"
|
9
|
+
s.authors = ["arakanemacs"]
|
10
|
+
s.email = ["arakanemacs@gmail.com"]
|
11
|
+
s.description = %q{styled markdown parser}
|
12
|
+
s.summary = %q{markdown to html}
|
13
|
+
s.homepage = "https://github.com/arakanemacs/m2h"
|
14
|
+
s.license = "MIT"
|
15
|
+
|
16
|
+
s.add_runtime_dependency "redcarpet", [">= 3.0.0"]
|
17
|
+
|
18
|
+
s.files = %w[
|
19
|
+
Gemfile
|
20
|
+
LICENSE
|
21
|
+
README.md
|
22
|
+
Rakefile
|
23
|
+
bin/m2h
|
24
|
+
lib/m2h.rb
|
25
|
+
lib/m2h/_layout.erb
|
26
|
+
lib/m2h/base.rb
|
27
|
+
lib/m2h/optparser.rb
|
28
|
+
lib/m2h/render.rb
|
29
|
+
lib/m2h/version.rb
|
30
|
+
m2h.gemspec
|
31
|
+
]
|
32
|
+
s.executables = 'm2h'
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: m2h
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- arakanemacs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redcarpet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.0
|
27
|
+
description: styled markdown parser
|
28
|
+
email:
|
29
|
+
- arakanemacs@gmail.com
|
30
|
+
executables:
|
31
|
+
- m2h
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- bin/m2h
|
40
|
+
- lib/m2h.rb
|
41
|
+
- lib/m2h/_layout.erb
|
42
|
+
- lib/m2h/base.rb
|
43
|
+
- lib/m2h/optparser.rb
|
44
|
+
- lib/m2h/render.rb
|
45
|
+
- lib/m2h/version.rb
|
46
|
+
- m2h.gemspec
|
47
|
+
homepage: https://github.com/arakanemacs/m2h
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.1.11
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: markdown to html
|
71
|
+
test_files: []
|