gimli 0.5.9 → 0.6.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +79 -0
- data/lib/gimli/converter.rb +6 -8
- data/lib/gimli/path.rb +1 -1
- data/lib/gimli/setup.rb +1 -1
- data/lib/gimli/version.rb +1 -1
- data/spec/gimli/converter_spec.rb +3 -2
- data/spec/gimli/markup_file_spec.rb +3 -3
- data/spec/gimli/path_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -3
- metadata +42 -43
- data/CHANGELOG.md +0 -77
- data/README.md +0 -104
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b84d39c6c0ac2ce7c3ecff0d47df9b6e9ac0c3ba
|
4
|
+
data.tar.gz: cfcf90b95333dd707228831fc416f70f90aa0af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 831b59d7a468451cdb341d81ffd141f448f0e0dceddb03ecdbf836714c377586abe5f4becc431dd2ff1229506c53e7a2c0944c7e6266d604d6d929c9eb918703
|
7
|
+
data.tar.gz: 7e9b8c0575454d38f4674213426782dc232ee0f8718667d79d64f54ce00f6b6fcefd4287944a7ecde501408befdb302c5859d802c74b23338bab590d77646574
|
data/README.textile
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
h1. gimli - utility for converting markup to pdf
|
2
|
+
|
3
|
+
"!https://secure.travis-ci.org/walle/gimli.png!":http://travis-ci.org/walle/gimli
|
4
|
+
|
5
|
+
h2. Description
|
6
|
+
|
7
|
+
Gimli is a utility for converting markup to pdf files. Useful for reports and such things.
|
8
|
+
It's a developed version of "textile2pdf":https://github.com/walle/textile2pdf to support multiple markup styles and to get syntax highlighting.
|
9
|
+
|
10
|
+
It's inspired by the markup convertion in "gollum":https://github.com/github/gollum. The markup code is adapted from gollum.
|
11
|
+
It works by converting the markup to pdf using "wkhtmltopdf":https://github.com/antialize/wkhtmltopdf
|
12
|
+
The markup is converted to html using "github/markup":https://github.com/github/markup
|
13
|
+
|
14
|
+
h3. Markup
|
15
|
+
|
16
|
+
Markup files may be written in any format supported by GitHub-Markup (except roff).
|
17
|
+
|
18
|
+
h3. Images
|
19
|
+
|
20
|
+
Images can be included by absolute url on your hard drive or a absolute url on the Internet. You can also refer to an image relative from the markup file. Example in textile.
|
21
|
+
|
22
|
+
<pre>
|
23
|
+
!/tmp/test.jpg!
|
24
|
+
!http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png!
|
25
|
+
!../images/test.jpg!
|
26
|
+
</pre>
|
27
|
+
|
28
|
+
h2. Installation
|
29
|
+
|
30
|
+
The best way to install Gimli is with RubyGems:
|
31
|
+
|
32
|
+
bc. $ [sudo] gem install gimli
|
33
|
+
|
34
|
+
You can install from source:
|
35
|
+
|
36
|
+
bc. $ cd gimli/
|
37
|
+
$ bundle
|
38
|
+
$ rake install
|
39
|
+
|
40
|
+
h2. Running
|
41
|
+
|
42
|
+
The standard way to run gimli is to go to a folder with markup files and running
|
43
|
+
|
44
|
+
bc. $ gimli
|
45
|
+
|
46
|
+
To apply some style to the pdf or override the standard style add a css file in the directory named @gimli.css@ or use the @-s@ flag to point out another css file.
|
47
|
+
|
48
|
+
Standard behavior is for gimli to output the files in the current directory. To override this use the @-o@ flag to point out another output directory. Gimli tries to create it if it doesn't exist.
|
49
|
+
|
50
|
+
Gimli also plays nice with Jekyll style markup files. You can pass gimli the @-y@ flag to have it remove Jekyll's YAML front matter from the top of your markup files. Allowing you to use gimli & Jekyll together on your Blog/Resume/Catalogue to create nicely formatted versions for online and offline viewing.
|
51
|
+
|
52
|
+
To pass parameters directly to wkhtmltopdf, use the @-w@ flag. eg.
|
53
|
+
|
54
|
+
bc. $ gimli -f test.md -w '--toc --footer-right "[page]/[toPage]"'
|
55
|
+
|
56
|
+
This gives a pdf with a table of contents and page numbers in the footer.
|
57
|
+
|
58
|
+
See the "man page":http://wkhtmltopdf.org/usage/wkhtmltopdf.txt for wkhtmltopdf for all possible parameters.
|
59
|
+
|
60
|
+
Run @gimli -h@ for a full list of options available
|
61
|
+
|
62
|
+
h2. Syntax highlighting
|
63
|
+
|
64
|
+
In page files you can get automatic syntax highlighting for a wide range of languages by using the following syntax:
|
65
|
+
|
66
|
+
bc. ```ruby
|
67
|
+
def foo
|
68
|
+
puts 'bar'
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
The block must start with three backticks (as the first characters on the line). After that comes the name of the language that is contained by the block. The language must be one of the short name lexer strings supported by coderay. See the list of lexers for valid options.
|
73
|
+
|
74
|
+
If the block contents are indented two spaces or one tab, then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
|
75
|
+
|
76
|
+
The block must end with three backticks as the first characters on a line.
|
77
|
+
|
78
|
+
The syntax highlightning is powered by "coderay":https://github.com/rubychan/coderay and is using a "github theme":https://github.com/pie4dan/CodeRay-GitHub-Theme.
|
79
|
+
|
data/lib/gimli/converter.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
|
-
require 'tempfile'
|
5
4
|
|
6
5
|
require 'gimli/markup'
|
7
6
|
|
@@ -10,6 +9,8 @@ module Gimli
|
|
10
9
|
# The class that converts the files
|
11
10
|
class Converter
|
12
11
|
|
12
|
+
COVER_FILE_PATH = ::File.expand_path("../../../config/cover.html", __FILE__)
|
13
|
+
|
13
14
|
# Initialize the converter with a File
|
14
15
|
# @param [Array] files The list of Gimli::MarkupFile to convert (passing a single file will still work)
|
15
16
|
# @param [Gimli::Config] config
|
@@ -18,10 +19,7 @@ module Gimli
|
|
18
19
|
|
19
20
|
@stylesheets = []
|
20
21
|
parameters = [@config.wkhtmltopdf_parameters]
|
21
|
-
if config.cover
|
22
|
-
@coverfile = Tempfile.new(['coverfile', '.html'])
|
23
|
-
parameters << '--cover' << @coverfile.path
|
24
|
-
end
|
22
|
+
parameters << '--cover' << COVER_FILE_PATH if config.cover
|
25
23
|
@wkhtmltopdf = Wkhtmltopdf.new parameters.join(' ')
|
26
24
|
end
|
27
25
|
|
@@ -66,7 +64,6 @@ module Gimli
|
|
66
64
|
load_stylesheets
|
67
65
|
generate_cover!
|
68
66
|
append_stylesheets html
|
69
|
-
puts @wkhtmltopdf.command(output_file(filename)).join(' ') if @config.debug
|
70
67
|
@wkhtmltopdf.output_pdf html, output_file(filename)
|
71
68
|
end
|
72
69
|
|
@@ -132,8 +129,9 @@ module Gimli
|
|
132
129
|
html = "<div class=\"cover\">\n#{markup.render}\n</div>"
|
133
130
|
append_stylesheets(html)
|
134
131
|
html = add_head(html)
|
135
|
-
|
136
|
-
|
132
|
+
File.open(COVER_FILE_PATH, 'w') do |f|
|
133
|
+
f.write html
|
134
|
+
end
|
137
135
|
end
|
138
136
|
end
|
139
137
|
end
|
data/lib/gimli/path.rb
CHANGED
data/lib/gimli/setup.rb
CHANGED
@@ -33,7 +33,7 @@ module Gimli extend OptiFlagSet
|
|
33
33
|
alternate_forms 'm'
|
34
34
|
end
|
35
35
|
optional_switch_flag 'debug' do
|
36
|
-
description 'Debugs
|
36
|
+
description 'Debugs html output to stdout'
|
37
37
|
alternate_forms 'd'
|
38
38
|
end
|
39
39
|
optional_switch_flag 'removefrontmatter' do
|
data/lib/gimli/version.rb
CHANGED
@@ -131,9 +131,10 @@ describe Gimli::Converter do
|
|
131
131
|
stub(renderer).render { 'fake' }
|
132
132
|
end
|
133
133
|
|
134
|
+
FileUtils.rm_f(Gimli::Converter::COVER_FILE_PATH)
|
134
135
|
converter.generate_cover!
|
135
|
-
|
136
|
-
|
136
|
+
File.exists?(Gimli::Converter::COVER_FILE_PATH).should == true
|
137
|
+
FileUtils.rm_f(Gimli::Converter::COVER_FILE_PATH)
|
137
138
|
end
|
138
139
|
end
|
139
140
|
|
@@ -11,15 +11,15 @@ describe Gimli::MarkupFile do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should recognize valid format' do
|
14
|
-
@file.valid_format?('textile').should
|
14
|
+
@file.valid_format?('textile').should be_true
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should recognize invalid format' do
|
18
|
-
@file.valid_format?('abc123').should
|
18
|
+
@file.valid_format?('abc123').should be_false
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should recognize nil as invalid format' do
|
22
|
-
@file.valid_format?(nil).should
|
22
|
+
@file.valid_format?(nil).should be_false
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should give the name as the filename without the extension' do
|
data/spec/gimli/path_spec.rb
CHANGED
@@ -26,7 +26,7 @@ describe Gimli::Path do
|
|
26
26
|
|
27
27
|
# What is the sound of one file recursing?
|
28
28
|
it 'should find one file, with a specified file, with recursion' do
|
29
|
-
Gimli::Path.list_valid('README.
|
29
|
+
Gimli::Path.list_valid('README.textile', true).length.should == 1
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,167 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fredrik Wallgren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-markup
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.7.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.7.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redcarpet
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.1.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: RedCloth
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.2.7
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.2.7
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coderay
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.0.7
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.0.7
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: nokogiri
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.5.5
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.5.5
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: wkhtmltopdf-binary
|
84
|
+
name: wkhtmltopdf-binary-11
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.1.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: optiflag
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.7'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.7'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rr
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: bundler
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
description: Utility for converting markup files to pdf files. Useful for reports
|
@@ -171,7 +171,7 @@ executables:
|
|
171
171
|
- gimli
|
172
172
|
extensions: []
|
173
173
|
extra_rdoc_files:
|
174
|
-
- README.
|
174
|
+
- README.textile
|
175
175
|
- LICENSE
|
176
176
|
files:
|
177
177
|
- bin/gimli
|
@@ -214,29 +214,28 @@ files:
|
|
214
214
|
- spec/spec_helper.rb
|
215
215
|
- config/style.css
|
216
216
|
- LICENSE
|
217
|
-
- README.
|
218
|
-
- CHANGELOG.md
|
217
|
+
- README.textile
|
219
218
|
homepage: https://github.com/walle/gimli
|
220
219
|
licenses: []
|
221
220
|
metadata: {}
|
222
221
|
post_install_message:
|
223
222
|
rdoc_options:
|
224
|
-
- --charset=UTF-8
|
223
|
+
- "--charset=UTF-8"
|
225
224
|
require_paths:
|
226
225
|
- lib
|
227
226
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
227
|
requirements:
|
229
|
-
- -
|
228
|
+
- - ">="
|
230
229
|
- !ruby/object:Gem::Version
|
231
230
|
version: '0'
|
232
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
232
|
requirements:
|
234
|
-
- -
|
233
|
+
- - ">"
|
235
234
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
235
|
+
version: 1.3.1
|
237
236
|
requirements: []
|
238
237
|
rubyforge_project: gimli
|
239
|
-
rubygems_version: 2.0.
|
238
|
+
rubygems_version: 2.0.3
|
240
239
|
signing_key:
|
241
240
|
specification_version: 4
|
242
241
|
summary: Utility for converting markup files to pdf files.
|
data/CHANGELOG.md
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
|
3
|
-
## 0.5.9
|
4
|
-
|
5
|
-
* Add sort on files in path to ensure the alphabetical order is maintained.
|
6
|
-
|
7
|
-
## 0.5.8
|
8
|
-
|
9
|
-
* Use a tempfile for the cover option. Fixes bug where using system ruby on
|
10
|
-
OSX gets write error.
|
11
|
-
|
12
|
-
## 0.5.5
|
13
|
-
|
14
|
-
* Add --cover option for creating cover with markdown file https://github.com/walle/gimli/pull/48 Thanks @k0kubun
|
15
|
-
|
16
|
-
## 0.5.4
|
17
|
-
|
18
|
-
* Use the -q parameter instead of --quiet. https://github.com/walle/gimli/pull/52 Thanks @nelsonsar
|
19
|
-
* Bugfix with UTF-8 characters. Thanks @toshi-kawanishi
|
20
|
-
|
21
|
-
## 0.5.3
|
22
|
-
|
23
|
-
* Merge fixes for gemfile and gitignore. Thanks @docwhat
|
24
|
-
|
25
|
-
## 0.5.0
|
26
|
-
|
27
|
-
* Support for autolinks and tables using PHP-Markdown style. This version monley patches github/markup to use redcarpet directly in order to be able to pass in extensions.
|
28
|
-
|
29
|
-
## 0.4.2
|
30
|
-
|
31
|
-
* Fix bug with wkhtmltopdf arguments not being passed to said command #38 (@apognu)
|
32
|
-
* Adds debug flag to output generated html to stdout
|
33
|
-
* Add css styling to fix issue #36
|
34
|
-
|
35
|
-
## 0.4.1
|
36
|
-
|
37
|
-
Add utf-8 meta tag to fix display of utf-8 characters
|
38
|
-
|
39
|
-
## 0.4.0
|
40
|
-
|
41
|
-
* Remove some markup gems as dependencies. Install them outside of gimli to use them. Like all other more "unkommon" markup languages.
|
42
|
-
|
43
|
-
## 0.3.2
|
44
|
-
|
45
|
-
* Code refactorings
|
46
|
-
* Removed support for gollum's "tags" eg. [[File]]. Use markup to create links
|
47
|
-
|
48
|
-
## 0.3.1
|
49
|
-
|
50
|
-
* Use coderay instead of albino and pygments. This fixes issues with
|
51
|
-
pygments not being installed and simplifies testing.
|
52
|
-
|
53
|
-
## 0.3.0
|
54
|
-
|
55
|
-
* Remove flags for table of contents and page numbering. Add flag for wkhtmltopdf parameters instead to give more flexibility.
|
56
|
-
|
57
|
-
**This version changes the way you use gimli if you are using the -t or
|
58
|
-
-p flags. Use the -w flag instead to send the parameters directly to
|
59
|
-
wkhtmltopdf.**
|
60
|
-
|
61
|
-
## 0.2.3
|
62
|
-
|
63
|
-
* Bugfix: Transcode to ISO-8859-1 in 1.9 also (@svendahlstrand)
|
64
|
-
* Add support for table of contents
|
65
|
-
* Bugfix: Fix incompatible character encodings with code fragments
|
66
|
-
(@ebeigarts)
|
67
|
-
* Remove warning of iconv being depricated
|
68
|
-
|
69
|
-
## 0.2.2
|
70
|
-
|
71
|
-
* Add support for printing out page numbers
|
72
|
-
|
73
|
-
## 0.2.1
|
74
|
-
|
75
|
-
* Add the ability to remove yaml front matter from documents before they are converted (@clowder)
|
76
|
-
|
77
|
-
|
data/README.md
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
# gimli – utility for converting markup to pdf
|
2
|
-
|
3
|
-
[![](https://secure.travis-ci.org/walle/gimli.png)](http://travis-ci.org/walle/gimli)
|
4
|
-
|
5
|
-
## Description
|
6
|
-
|
7
|
-
Gimli is a utility for converting markup to pdf files. Useful for reports and such things.
|
8
|
-
It’s a developed version of [textile2pdf](https://github.com/walle/textile2pdf) to support multiple markup styles and to get syntax highlighting.
|
9
|
-
|
10
|
-
It’s inspired by the markup convertion in [gollum](https://github.com/github/gollum). The markup code is adapted from gollum.
|
11
|
-
It works by converting the markup to pdf using [wkhtmltopdf](https://github.com/antialize/wkhtmltopdf)
|
12
|
-
The markup is converted to html using [github/markup](https://github.com/github/markup)
|
13
|
-
|
14
|
-
### Markup
|
15
|
-
|
16
|
-
Markup files may be written in any format supported by GitHub-Markup (except roff).
|
17
|
-
|
18
|
-
### Images
|
19
|
-
|
20
|
-
Images can be included by absolute url on your hard drive or a absolute url on the Internet. You can also refer to an image relative from the markup file. Example in textile.
|
21
|
-
|
22
|
-
<pre>
|
23
|
-
!/tmp/test.jpg!
|
24
|
-
!http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png!
|
25
|
-
!../images/test.jpg!
|
26
|
-
</pre>
|
27
|
-
|
28
|
-
## Installation
|
29
|
-
|
30
|
-
The best way to install Gimli is with RubyGems:
|
31
|
-
|
32
|
-
$ [sudo] gem install gimli
|
33
|
-
|
34
|
-
You can install from source:
|
35
|
-
|
36
|
-
```
|
37
|
-
$ cd gimli/
|
38
|
-
$ bundle
|
39
|
-
$ rake install
|
40
|
-
```
|
41
|
-
|
42
|
-
## Running
|
43
|
-
|
44
|
-
The standard way to run gimli is to go to a folder with markup files and running
|
45
|
-
|
46
|
-
$ gimli
|
47
|
-
|
48
|
-
To apply some style to the pdf or override the standard style add a css file in the directory named `gimli.css` or use the `-s` flag to point out another css file.
|
49
|
-
|
50
|
-
Standard behavior is for gimli to output the files in the current directory. To override this use the `-o` flag to point out another output directory. Gimli tries to create it if it doesn’t exist.
|
51
|
-
|
52
|
-
Gimli also plays nice with Jekyll style markup files. You can pass gimli the `-y` flag to have it remove Jekyll’s YAML front matter from the top of your markup files. Allowing you to use gimli & Jekyll together on your Blog/Resume/Catalogue to create nicely formatted versions for online and offline viewing.
|
53
|
-
|
54
|
-
To pass parameters directly to wkhtmltopdf, use the `-w` flag. eg.
|
55
|
-
|
56
|
-
$ gimli -f test.md -w '--toc --footer-right "[page]/[toPage]"'
|
57
|
-
|
58
|
-
This gives a pdf with a table of contents and page numbers in the footer.
|
59
|
-
|
60
|
-
See the [man page](http://wkhtmltopdf.org/usage/wkhtmltopdf.txt) for wkhtmltopdf for all possible parameters.
|
61
|
-
|
62
|
-
Run `gimli -h` for a full list of options available
|
63
|
-
|
64
|
-
### Gimli Docker Container
|
65
|
-
|
66
|
-
There is a Docker container to use for converting files using gimli without installing gimli to your computer, you can see more about it at https://registry.hub.docker.com/u/walle/gimli/
|
67
|
-
|
68
|
-
#### Running the image
|
69
|
-
|
70
|
-
$ docker run -v <host_dir>:<container_dir> walle/gimli -f <container_dir>/my-file.md -o <container_dir>
|
71
|
-
|
72
|
-
Where `<host_dir>` is the directory with the files you want to convert and `<container_dir>` is the directory in the image where the files will be put. This will write the pdf files to the same directory as where your source files is. If you want to make a new directory for the pdfs you can call the image like this:
|
73
|
-
|
74
|
-
$ docker run -v <host_dir>:<container_dir> walle/gimli -f <container_dir>/my-file.md -o <container_dir>/pdfs
|
75
|
-
|
76
|
-
This will put the pdfs in a folder named pdfs in your `<host_dir>`.
|
77
|
-
|
78
|
-
##### A real example
|
79
|
-
|
80
|
-
$ docker run -v /home/walle/gimlidocuments:/tmp/gimli walle/gimli -f /tmp/gimli/my-file.md -o /tmp/gimli
|
81
|
-
|
82
|
-
This will generate a pdf from the file in `/home/walle/gimlidocuments/my-file.md` in the `/home/walle/gimlidocuments` directory.
|
83
|
-
|
84
|
-
##### Arguments
|
85
|
-
|
86
|
-
All arguments you supply to running the image will end up in gimli, so for an example you could supply the `-s` flag to use a custom stylesheet. But the stylesheet must be in `<host_dir>` to be readable by gimli.
|
87
|
-
|
88
|
-
## Syntax highlighting
|
89
|
-
|
90
|
-
In page files you can get automatic syntax highlighting for a wide range of languages by using the following syntax:
|
91
|
-
|
92
|
-
```ruby
|
93
|
-
def foo
|
94
|
-
puts 'bar'
|
95
|
-
end
|
96
|
-
```
|
97
|
-
|
98
|
-
The block must start with three backticks (as the first characters on the line). After that comes the name of the language that is contained by the block. The language must be one of the short name lexer strings supported by coderay. See the list of lexers for valid options.
|
99
|
-
|
100
|
-
If the block contents are indented two spaces or one tab, then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
|
101
|
-
|
102
|
-
The block must end with three backticks as the first characters on a line.
|
103
|
-
|
104
|
-
The syntax highlightning is powered by [coderay](https://github.com/rubychan/coderay) and is using a [github theme](https://github.com/pie4dan/CodeRay-GitHub-Theme).
|