transmuter 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/MIT-LICENSE +1 -1
- data/README.md +41 -36
- data/Rakefile +35 -1
- data/bin/transmute +0 -3
- data/lib/transmuter/format/html.rb +2 -2
- data/lib/transmuter/version.rb +2 -2
- data/spec/transmuter/format/html_spec.rb +2 -2
- data/transmuter.gemspec +3 -3
- metadata +38 -35
data/.gitignore
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,82 +1,87 @@
|
|
1
|
-
# Transmuter [![Build Status](http://travis-ci.org/TechnoGate/transmuter.png)](http://travis-ci.org/TechnoGate/transmuter)
|
1
|
+
# Transmuter [![Build Status](http://travis-ci.org/TechnoGate/transmuter.png)](http://travis-ci.org/TechnoGate/transmuter) [![Still Maintained](http://stillmaintained.com/TechnoGate/transmuter.png)](http://stillmaintained.com/TechnoGate/transmuter)
|
2
2
|
|
3
|
-
Transmuter is a command line tool to convert Markdown files into HTML or PDF
|
4
|
-
files, it can also be used to convert HTML files to PDF, it uses in the
|
5
|
-
backgound
|
6
|
-
[Redcarpet](https://github.com/tanoku/redcarpet),
|
7
|
-
[RedCloth](http://redcloth.org),
|
8
|
-
[Albino](https://github.com/github/albino) and
|
9
|
-
[PDFkit](https://github.com/jdpace/PDFKit).
|
3
|
+
Transmuter is a command line tool to convert Markdown and Textile files into HTML or PDF, or HTML files to PDF.
|
10
4
|
|
11
|
-
|
5
|
+
It uses [pygments.rb](https://github.com/tmm1/pygments.rb),
|
6
|
+
[PDFkit](https://github.com/jdpace/PDFKit),
|
7
|
+
[Redcarpet](https://github.com/tanoku/redcarpet), and
|
8
|
+
[RedCloth](http://redcloth.org).
|
12
9
|
|
13
|
-
|
10
|
+
[![Click here to lend your support to: Open Source Projects and make a donation at www.pledgie.com!](http://pledgie.com/campaigns/16123.png?skin_name=chrome)](http://www.pledgie.com/campaigns/16123)
|
14
11
|
|
15
|
-
|
12
|
+
# Getting Started
|
16
13
|
|
17
|
-
|
18
|
-
$ gem install transmuter
|
19
|
-
```
|
20
|
-
|
21
|
-
You also need to install (as a requirements),
|
22
|
-
[*pygments*](http://pygments.org/) (needed by Albino) and
|
23
|
-
[*WKHTMLTOPDF*](http://wkhtmltopdf.googlecode.com/) (needed by PDFkit)
|
14
|
+
1. Install the Transmuter gem if you haven't already:
|
24
15
|
|
25
|
-
|
16
|
+
```bash
|
17
|
+
$ gem install transmuter
|
18
|
+
```
|
26
19
|
|
27
|
-
You can install
|
28
|
-
|
29
|
-
```bash
|
30
|
-
$ sudo easy_install pygments
|
31
|
-
```
|
20
|
+
2. Transmuter uses [pygments.rb](https://github.com/tmm1/pygments.rb), which requires [Pygments](http://pygments.org/). You can install Pygments using the Python [Easy_Install](http://peak.telecommunity.com/DevCenter/EasyInstall) tool. After installing Easy_Install, you can install Pygments as a Python egg:
|
32
21
|
|
33
|
-
|
22
|
+
```bash
|
23
|
+
$ sudo easy_install pygments
|
24
|
+
```
|
34
25
|
|
35
|
-
|
26
|
+
Pygments is also part of the Debian and Gentoo Linux distributions, and you can install it via the regular package managers. For example, in Ubuntu:
|
36
27
|
|
37
|
-
|
28
|
+
```bash
|
29
|
+
$ sudo aptitude install python-pygments
|
30
|
+
```
|
38
31
|
|
39
|
-
|
32
|
+
You can also install it from [source](https://bitbucket.org/birkenfeld/pygments-main).
|
40
33
|
|
41
|
-
|
34
|
+
3. Transmuter also uses [PDFkit](https://github.com/jdpace/PDFKit), which requires [WKHTMLTOPDF](http://wkhtmltopdf.googlecode.com/). The PDFKit project on GitHub has excellent [installation instructions for WKHTMLTOPDF](https://github.com/jdpace/PDFKit/wiki/Installing-WKHTMLTOPDF).
|
42
35
|
|
43
36
|
# Usage
|
44
37
|
|
45
|
-
You
|
38
|
+
You can check the help facility:
|
46
39
|
|
47
40
|
```bash
|
48
41
|
$ transmute --help
|
49
42
|
```
|
50
43
|
|
51
|
-
|
44
|
+
Generate PDF from a Markdown file with the default CSS:
|
52
45
|
|
53
46
|
```bash
|
54
47
|
$ transmute file.md
|
55
48
|
```
|
56
49
|
|
57
|
-
|
50
|
+
Generate HTML from a Markdown file with the default CSS:
|
58
51
|
|
59
52
|
```bash
|
60
53
|
$ transmute file.md -t html
|
61
54
|
```
|
62
55
|
|
63
|
-
|
56
|
+
Generate HTML from a Markdown file with custom CSS:
|
64
57
|
|
65
58
|
```bash
|
66
59
|
$ transmute file.md -t html -s custom.css
|
67
60
|
```
|
68
61
|
|
69
|
-
|
62
|
+
Generate HTML from a Markdown file with several custom CSS files specified by separating the file names with spaces:
|
70
63
|
|
71
64
|
```bash
|
72
65
|
$ transmute file.md -t html -s custom1.css custom2.css
|
73
66
|
```
|
74
67
|
|
68
|
+
# Contact
|
69
|
+
|
70
|
+
For bugs and feature request, please use __Github issues__, for other
|
71
|
+
requests, you can contact us:
|
72
|
+
|
73
|
+
- [Github private
|
74
|
+
message](https://github.com/inbox/new/eMxyzptlk)
|
75
|
+
- Email: [contact@technogate.fr](mailto:contact@technogate.fr)
|
76
|
+
|
77
|
+
Don't forget to follow me on [Github](https://github.com/eMxyzptlk) and
|
78
|
+
[Twitter](https://twitter.com/eMxyzptlk) for news and updates.
|
79
|
+
|
75
80
|
# License
|
76
81
|
|
77
82
|
## This code is free to use under the terms of the MIT license.
|
78
83
|
|
79
|
-
Copyright (c) 2011
|
84
|
+
Copyright (c) 2011 TechnoGate <support@technogate.fr>
|
80
85
|
|
81
86
|
Permission is hereby granted, free of charge, to any person obtaining
|
82
87
|
a copy of this software and associated documentation files (the
|
@@ -95,4 +100,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
95
100
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
96
101
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
97
102
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
98
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
103
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -4,5 +4,39 @@ require "bundler/gem_tasks"
|
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
|
7
|
+
# Monkey patch Bundler::GemHelper
|
8
|
+
#
|
9
|
+
# Git flow create the tag after finishing a release however this breaks
|
10
|
+
# <b>rake release</b> because it expects that no tag for the current version
|
11
|
+
# is present, this patch overrides this behaviour to skip version tagging if
|
12
|
+
# the tag already exists instead of raising an exception
|
13
|
+
Bundler::GemHelper.class_eval <<-END, __FILE__, __LINE__ + 1
|
14
|
+
# Tag the current version
|
15
|
+
def tag_version
|
16
|
+
unless already_tagged?
|
17
|
+
sh %(git tag -a -m "Version \#{version}" \#{version_tag})
|
18
|
+
Bundler.ui.confirm "Tagged \#{version_tag}"
|
19
|
+
end
|
20
|
+
yield if block_given?
|
21
|
+
rescue
|
22
|
+
Bundler.ui.error "Untagged \#{version_tag} due to error"
|
23
|
+
sh_with_code "git tag -d \#{version_tag}"
|
24
|
+
raise
|
25
|
+
end
|
26
|
+
|
27
|
+
# The original method raises an exception, we should override it
|
28
|
+
def guard_already_tagged
|
29
|
+
end
|
30
|
+
|
31
|
+
# This method check if the tag has already been tagged
|
32
|
+
def already_tagged?
|
33
|
+
if sh('git tag').split(/\n/).include?(version_tag)
|
34
|
+
true
|
35
|
+
else
|
36
|
+
false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
END
|
40
|
+
|
7
41
|
# The default task is tests
|
8
|
-
task :default => :spec
|
42
|
+
task :default => :spec
|
data/bin/transmute
CHANGED
@@ -6,9 +6,6 @@ $:.push File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
6
6
|
require 'transmuter'
|
7
7
|
|
8
8
|
# Verify requirements
|
9
|
-
unless which("pygmentize")
|
10
|
-
abort "Please install pygments, please read the README.md file for more information"
|
11
|
-
end
|
12
9
|
|
13
10
|
unless which("wkhtmltopdf")
|
14
11
|
abort "Please install wkhtmltopdf, please read the README.md file for more information"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'pygments.rb'
|
2
2
|
require 'nokogiri'
|
3
3
|
|
4
4
|
module Transmuter
|
@@ -72,7 +72,7 @@ module Transmuter
|
|
72
72
|
def syntax_highlighter
|
73
73
|
doc = Nokogiri::HTML(@html)
|
74
74
|
doc.search("//pre[@lang]").each do |pre|
|
75
|
-
pre.replace
|
75
|
+
pre.replace Pygments.highlight(pre.text.rstrip, :lexer => pre[:lang].downcase.to_sym)
|
76
76
|
end
|
77
77
|
doc.to_s
|
78
78
|
end
|
data/lib/transmuter/version.rb
CHANGED
@@ -95,7 +95,7 @@ module Format
|
|
95
95
|
subject.send :syntax_highlighter
|
96
96
|
end
|
97
97
|
|
98
|
-
it "should call
|
98
|
+
it "should call Pygments.highlight" do
|
99
99
|
pre = mock
|
100
100
|
pre.stubs(:text).returns("some html")
|
101
101
|
pre.stubs(:[]).with(:lang).returns(:ruby)
|
@@ -104,7 +104,7 @@ module Format
|
|
104
104
|
nokogiri_document.stubs(:search).returns([pre])
|
105
105
|
Nokogiri.expects(:HTML).with(html_h1).once.returns(nokogiri_document)
|
106
106
|
|
107
|
-
|
107
|
+
Pygments.expects(:highlight).once.returns("")
|
108
108
|
subject.send(:syntax_highlighter)
|
109
109
|
end
|
110
110
|
end
|
data/transmuter.gemspec
CHANGED
@@ -25,13 +25,13 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'pdfkit', '~>0.5.2'
|
26
26
|
s.add_dependency 'redcarpet', '~>1.17.2'
|
27
27
|
s.add_dependency 'RedCloth', '~>4.2.8'
|
28
|
-
s.add_dependency '
|
28
|
+
s.add_dependency 'pygments.rb', '~>0.2.4'
|
29
29
|
s.add_dependency 'nokogiri', '~>1.5.0'
|
30
30
|
|
31
31
|
# Development dependencies
|
32
|
-
s.add_development_dependency 'guard', '~>0.
|
32
|
+
s.add_development_dependency 'guard', '~>0.8.4'
|
33
33
|
s.add_development_dependency 'guard-bundler', '~>0.1.3'
|
34
|
-
s.add_development_dependency 'guard-rspec', '~>0.4.
|
34
|
+
s.add_development_dependency 'guard-rspec', '~>0.4.5'
|
35
35
|
|
36
36
|
# Development / Test dependencies
|
37
37
|
s.add_development_dependency 'rspec', '~>2.6.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transmuter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement: &
|
16
|
+
requirement: &70364279245280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.6.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70364279245280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70364279244820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70364279244820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: thor
|
38
|
-
requirement: &
|
38
|
+
requirement: &70364279244360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.14.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70364279244360
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: pdfkit
|
49
|
-
requirement: &
|
49
|
+
requirement: &70364279243900 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.5.2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70364279243900
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: redcarpet
|
60
|
-
requirement: &
|
60
|
+
requirement: &70364279243440 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.17.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70364279243440
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: RedCloth
|
71
|
-
requirement: &
|
71
|
+
requirement: &70364277600160 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,21 +76,21 @@ dependencies:
|
|
76
76
|
version: 4.2.8
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70364277600160
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement: &
|
81
|
+
name: pygments.rb
|
82
|
+
requirement: &70364277596880 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
version: 0.2.4
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70364277596880
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: nokogiri
|
93
|
-
requirement: &
|
93
|
+
requirement: &70364277595640 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,21 +98,21 @@ dependencies:
|
|
98
98
|
version: 1.5.0
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70364277595640
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: guard
|
104
|
-
requirement: &
|
104
|
+
requirement: &70364277594740 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
109
|
+
version: 0.8.4
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70364277594740
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: guard-bundler
|
115
|
-
requirement: &
|
115
|
+
requirement: &70364275266000 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,21 +120,21 @@ dependencies:
|
|
120
120
|
version: 0.1.3
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70364275266000
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: guard-rspec
|
126
|
-
requirement: &
|
126
|
+
requirement: &70364275265540 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.4.
|
131
|
+
version: 0.4.5
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70364275265540
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: rspec
|
137
|
-
requirement: &
|
137
|
+
requirement: &70364275265080 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: 2.6.0
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70364275265080
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: mocha
|
148
|
-
requirement: &
|
148
|
+
requirement: &70364275264620 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ~>
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: 0.10.0
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70364275264620
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: pry
|
159
|
-
requirement: &
|
159
|
+
requirement: &70364275264160 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ~>
|
@@ -164,7 +164,7 @@ dependencies:
|
|
164
164
|
version: 0.9.6.2
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *70364275264160
|
168
168
|
description: The Alien device to convert Markdown and Textile files to HTML or PDF.
|
169
169
|
email:
|
170
170
|
- wael.nasreddine@gmail.com
|
@@ -224,9 +224,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
- - ! '>='
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: '0'
|
227
|
+
segments:
|
228
|
+
- 0
|
229
|
+
hash: -1915371722139529835
|
227
230
|
requirements: []
|
228
231
|
rubyforge_project:
|
229
|
-
rubygems_version: 1.8.
|
232
|
+
rubygems_version: 1.8.13
|
230
233
|
signing_key:
|
231
234
|
specification_version: 3
|
232
235
|
summary: The Alien device to convert Markdown and Textile files to HTML or PDF.
|