mdc 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.html +92 -0
- data/README.md +25 -0
- data/README.pdf +0 -0
- data/Rakefile +2 -0
- data/bin/mdc +41 -0
- data/lib/mdc.rb +5 -0
- data/lib/mdc/version.rb +3 -0
- data/mdc.gemspec +25 -0
- data/templates/default.html.erb +67 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 590a87bf4529fc0b39e49ee89625268b7f9f7cb1
|
4
|
+
data.tar.gz: 9e4a6b840467bd7a03d692435d4275c293fdd756
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e5056f7aae6dd28acb5da328ed0b29c55c6a878ea85302e9017cf550f25233419b135050468de0d50627077fc55828b89eec461ef0410b81de867de33469a4f
|
7
|
+
data.tar.gz: 48ec187800e972313461ef23351c06591aab5046173353ca69777c82a1a508cb1fadff933c324d38446c5cb4751c29c3554bdb0488ea1a32ddbfca3c3f161ad9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Americo Duarte
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.html
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta charset="UTF-8">
|
4
|
+
<title></title>
|
5
|
+
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
|
6
|
+
<link rel="stylesheet" href="https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css">
|
7
|
+
<style>
|
8
|
+
body {
|
9
|
+
margin: 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
.markdown-body {
|
13
|
+
min-width: 200px;
|
14
|
+
max-width: 720px;
|
15
|
+
margin: 0 auto;
|
16
|
+
padding: 30px;
|
17
|
+
}
|
18
|
+
|
19
|
+
footer {
|
20
|
+
margin: 20px 0 20px 0;
|
21
|
+
text-align: center;
|
22
|
+
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
|
23
|
+
font-size: 16px;
|
24
|
+
line-height: 1.6;
|
25
|
+
word-wrap: break-word;
|
26
|
+
}
|
27
|
+
|
28
|
+
table, tr, td, th, tbody, thead, tfoot {
|
29
|
+
page-break-inside: avoid !important;
|
30
|
+
}
|
31
|
+
|
32
|
+
@media screen {
|
33
|
+
body {
|
34
|
+
background-color: rgb(225, 231, 234);
|
35
|
+
}
|
36
|
+
|
37
|
+
.markdown-body {
|
38
|
+
background-color: rgb(255, 255, 255);
|
39
|
+
border: 1px solid black;
|
40
|
+
margin: 20px auto;
|
41
|
+
-webkit-box-shadow: 7px 7px 0px 0px rgba(50, 50, 50, 0.75);
|
42
|
+
-moz-box-shadow: 7px 7px 0px 0px rgba(50, 50, 50, 0.75);
|
43
|
+
box-shadow: 7px 7px 0px 0px rgba(50, 50, 50, 0.75);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
@media print {
|
48
|
+
footer {
|
49
|
+
display: none;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
</head>
|
54
|
+
<body>
|
55
|
+
<header>
|
56
|
+
|
57
|
+
</header>
|
58
|
+
|
59
|
+
<article class="markdown-body">
|
60
|
+
<h1 id="mdc">MDC</h1>
|
61
|
+
|
62
|
+
<p>A simple executable that generate html and pdf from markdown files.</p>
|
63
|
+
|
64
|
+
<h2 id="installation">Installation</h2>
|
65
|
+
|
66
|
+
<p>Simple install it yourself as:</p>
|
67
|
+
|
68
|
+
<pre><code class="prettyprint shell"> $ gem install mdc
|
69
|
+
</code></pre>
|
70
|
+
|
71
|
+
<h2 id="usage">Usage</h2>
|
72
|
+
|
73
|
+
<pre><code class="prettyprint shell"> mdc file.md
|
74
|
+
</code></pre>
|
75
|
+
|
76
|
+
<h2 id="contributing">Contributing</h2>
|
77
|
+
|
78
|
+
<ol>
|
79
|
+
<li>Fork it ( <a href="https://github.com/americodls/mdc/fork">https://github.com/americodls/mdc/fork</a> )</li>
|
80
|
+
<li>Create your feature branch (<code class="prettyprint">git checkout -b my-new-feature</code>)</li>
|
81
|
+
<li>Commit your changes (<code class="prettyprint">git commit -am 'Add some feature'</code>)</li>
|
82
|
+
<li>Push to the branch (<code class="prettyprint">git push origin my-new-feature</code>)</li>
|
83
|
+
<li>Create a new Pull Request</li>
|
84
|
+
</ol>
|
85
|
+
|
86
|
+
</article>
|
87
|
+
|
88
|
+
<footer>
|
89
|
+
© 2014 @americodls
|
90
|
+
</footer>
|
91
|
+
</body>
|
92
|
+
</html>
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# MDC
|
2
|
+
|
3
|
+
A simple executable that generate html and pdf from markdown files.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Simple install it yourself as:
|
8
|
+
|
9
|
+
```shell
|
10
|
+
$ gem install mdc
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```shell
|
16
|
+
mdc file.md
|
17
|
+
```
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it ( https://github.com/americodls/mdc/fork )
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create a new Pull Request
|
data/README.pdf
ADDED
Binary file
|
data/Rakefile
ADDED
data/bin/mdc
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
fail "You need to install `wkhtmltopdf` first." unless system("which wkhtmltopdf")
|
4
|
+
|
5
|
+
require 'erb'
|
6
|
+
require 'redcarpet'
|
7
|
+
require 'pathname'
|
8
|
+
|
9
|
+
markdown_extensions = { no_intra_emphasis: true, tables: true, fenced_code_blocks: true, autolink: true, disable_indented_code_blocks: true, strikethrough: true, lax_spacing: true, space_after_headers: true, superscript: true, underline: true, highlight: true, quote: true, footnotes: true }
|
10
|
+
markdown_renderer = Redcarpet::Render::HTML.new(with_toc_data: true, prettify: true)
|
11
|
+
markdown = Redcarpet::Markdown.new(markdown_renderer, markdown_extensions)
|
12
|
+
|
13
|
+
TEMPLATE = File.expand_path("../templates/default.html.erb", __dir__)
|
14
|
+
|
15
|
+
class Renderer
|
16
|
+
def initialize(body)
|
17
|
+
@body = body
|
18
|
+
end
|
19
|
+
|
20
|
+
def render(template = File.read(TEMPLATE))
|
21
|
+
renderer = ERB.new(template)
|
22
|
+
renderer.result(binding)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
ARGV.each do|markdown_file|
|
27
|
+
markdown_file = File.expand_path(markdown_file)
|
28
|
+
dirname = Pathname.new(File.dirname(markdown_file))
|
29
|
+
basename = File.basename(markdown_file, ".*")
|
30
|
+
|
31
|
+
html_filename = dirname.join(basename + ".html")
|
32
|
+
pdf_filename = dirname.join(basename + ".pdf")
|
33
|
+
|
34
|
+
input = File.read(markdown_file)
|
35
|
+
markdown_output = markdown.render(input)
|
36
|
+
|
37
|
+
html_output = Renderer.new(markdown_output).render
|
38
|
+
File.open(html_filename, "w") { |file| file.puts html_output }
|
39
|
+
|
40
|
+
system("wkhtmltopdf --print-media-type #{html_filename} #{pdf_filename}")
|
41
|
+
end
|
data/lib/mdc.rb
ADDED
data/lib/mdc/version.rb
ADDED
data/mdc.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mdc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mdc"
|
8
|
+
spec.version = MDC::VERSION
|
9
|
+
spec.authors = ["Americo Duarte"]
|
10
|
+
spec.email = ["americodls@gmail.com"]
|
11
|
+
spec.summary = %q{A simple executable that generate html and pdf from markdown files.}
|
12
|
+
spec.description = %q{A simple executable that generate html and pdf from markdown files.}
|
13
|
+
spec.homepage = "https://github.com/americodls/mdc"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "redcarpet"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta charset="UTF-8">
|
4
|
+
<title></title>
|
5
|
+
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
|
6
|
+
<link rel="stylesheet" href="https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css">
|
7
|
+
<style>
|
8
|
+
body {
|
9
|
+
margin: 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
.markdown-body {
|
13
|
+
min-width: 200px;
|
14
|
+
max-width: 720px;
|
15
|
+
margin: 0 auto;
|
16
|
+
padding: 30px;
|
17
|
+
}
|
18
|
+
|
19
|
+
footer {
|
20
|
+
margin: 20px 0 20px 0;
|
21
|
+
text-align: center;
|
22
|
+
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
|
23
|
+
font-size: 16px;
|
24
|
+
line-height: 1.6;
|
25
|
+
word-wrap: break-word;
|
26
|
+
}
|
27
|
+
|
28
|
+
table, tr, td, th, tbody, thead, tfoot {
|
29
|
+
page-break-inside: avoid !important;
|
30
|
+
}
|
31
|
+
|
32
|
+
@media screen {
|
33
|
+
body {
|
34
|
+
background-color: rgb(225, 231, 234);
|
35
|
+
}
|
36
|
+
|
37
|
+
.markdown-body {
|
38
|
+
background-color: rgb(255, 255, 255);
|
39
|
+
border: 1px solid black;
|
40
|
+
margin: 20px auto;
|
41
|
+
-webkit-box-shadow: 7px 7px 0px 0px rgba(50, 50, 50, 0.75);
|
42
|
+
-moz-box-shadow: 7px 7px 0px 0px rgba(50, 50, 50, 0.75);
|
43
|
+
box-shadow: 7px 7px 0px 0px rgba(50, 50, 50, 0.75);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
@media print {
|
48
|
+
footer {
|
49
|
+
display: none;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
</head>
|
54
|
+
<body>
|
55
|
+
<header>
|
56
|
+
|
57
|
+
</header>
|
58
|
+
|
59
|
+
<article class="markdown-body">
|
60
|
+
<%= @body %>
|
61
|
+
</article>
|
62
|
+
|
63
|
+
<footer>
|
64
|
+
© 2014 @americodls
|
65
|
+
</footer>
|
66
|
+
</body>
|
67
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mdc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Americo Duarte
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-07 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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: A simple executable that generate html and pdf from markdown files.
|
56
|
+
email:
|
57
|
+
- americodls@gmail.com
|
58
|
+
executables:
|
59
|
+
- mdc
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.html
|
67
|
+
- README.md
|
68
|
+
- README.pdf
|
69
|
+
- Rakefile
|
70
|
+
- bin/mdc
|
71
|
+
- lib/mdc.rb
|
72
|
+
- lib/mdc/version.rb
|
73
|
+
- mdc.gemspec
|
74
|
+
- templates/default.html.erb
|
75
|
+
homepage: https://github.com/americodls/mdc
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.2.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: A simple executable that generate html and pdf from markdown files.
|
99
|
+
test_files: []
|