mdtopdf 1.0.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.
- checksums.yaml +7 -0
- data/bin/md2pdf +18 -0
- data/lib/mdtopdf.rb +20 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7a4ddcf25d131e8c9bb4ea8d4878181868338f6d
|
4
|
+
data.tar.gz: dbca4ff1b4672722428e69d87a9220f6838f00dd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7194a2855361693cadf5a63bcbd19f6632b5ffc5993bc769bf1c7433860876bdca30828e4886552bf8013d201354ee9cd696a3403b54b35e83d89b0f042a261e
|
7
|
+
data.tar.gz: 6ce48adc4934495387bdef0698f9e34fe3e129760fa4b57f8440781e0d8cb29b2c3b7eefb9cdf96f5e67896c8450a2a14431662526c1e7b139d26e6d2a16d9b8
|
data/bin/md2pdf
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'mdtopdf'
|
5
|
+
|
6
|
+
if ARGV.count < 1 || ARGV[0] == '-h' || ARGV[0] == '--help'
|
7
|
+
p "Usage: md2pdf <filename>"
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
file_in_path = ARGV.pop
|
12
|
+
|
13
|
+
unless File.exist? file_in_path
|
14
|
+
p "Given file `#{file_in_path}` doesn't exist"
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
MDToPDF.Convert file_in_path
|
data/lib/mdtopdf.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "pdfkit"
|
3
|
+
require "redcarpet"
|
4
|
+
|
5
|
+
class MDToPDF
|
6
|
+
def self.Convert file_in_path
|
7
|
+
file_in = File.open(file_in_path, "rb")
|
8
|
+
contents = file_in.read
|
9
|
+
file_in.close
|
10
|
+
|
11
|
+
file_out_path = File.basename(file_in_path, ".*")
|
12
|
+
file_out_path += ".pdf"
|
13
|
+
|
14
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
|
15
|
+
html = markdown.render contents
|
16
|
+
|
17
|
+
kit = PDFKit.new(html, :page_size => 'Letter')
|
18
|
+
kit.to_file file_out_path
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mdtopdf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Oscar Moreno Garza
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pdfkit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.8'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.8.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.8'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.8.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: redcarpet
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.3'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.3.2
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.3'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.3.2
|
53
|
+
description: Simple cli utility for converting markdown into pdf.
|
54
|
+
email: ozkar@ozkar.org
|
55
|
+
executables:
|
56
|
+
- md2pdf
|
57
|
+
extensions: []
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- bin/md2pdf
|
61
|
+
- lib/mdtopdf.rb
|
62
|
+
homepage: http://github.com/ozkar99/mdtopdf
|
63
|
+
licenses:
|
64
|
+
- BSD 2-Clause
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.4.3
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: mdtopdf
|
86
|
+
test_files: []
|