gimli 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/bin/gimli +1 -1
- data/lib/gimli.rb +2 -2
- data/lib/gimli/converter.rb +6 -2
- data/lib/gimli/setup.rb +4 -0
- data/lib/gimli/version.rb +1 -1
- data/spec/gimli/converter_spec.rb +3 -3
- metadata +34 -34
data/README.textile
CHANGED
data/bin/gimli
CHANGED
@@ -9,5 +9,5 @@ if ARGV.flags.version?
|
|
9
9
|
exit
|
10
10
|
end
|
11
11
|
|
12
|
-
Gimli.process! ARGV.flags.file, ARGV.flags.recursive?, ARGV.flags.merge?, ARGV.flags.removefrontmatter, ARGV.flags.outputfilename, ARGV.flags.outputdir, ARGV.flags.stylesheet
|
12
|
+
Gimli.process! ARGV.flags.file, ARGV.flags.recursive?, ARGV.flags.merge?, ARGV.flags.pagenumbers?, ARGV.flags.removefrontmatter, ARGV.flags.outputfilename, ARGV.flags.outputdir, ARGV.flags.stylesheet
|
13
13
|
|
data/lib/gimli.rb
CHANGED
@@ -10,10 +10,10 @@ require 'gimli/path'
|
|
10
10
|
module Gimli
|
11
11
|
|
12
12
|
# Starts the processing of selected files
|
13
|
-
def self.process!(file, recursive = false, merge = false, remove_front_matter = false, output_filename = nil, output_dir = nil, stylesheet = nil)
|
13
|
+
def self.process!(file, recursive = false, merge = false, pagenumbers = false, remove_front_matter = false, output_filename = nil, output_dir = nil, stylesheet = nil)
|
14
14
|
|
15
15
|
|
16
16
|
@files = Path.list_valid(file, recursive).map { |file| MarkupFile.new(file) }
|
17
|
-
Converter.new(@files, merge, remove_front_matter, output_filename, output_dir, stylesheet).convert!
|
17
|
+
Converter.new(@files, merge, pagenumbers, remove_front_matter, output_filename, output_dir, stylesheet).convert!
|
18
18
|
end
|
19
19
|
end
|
data/lib/gimli/converter.rb
CHANGED
@@ -14,13 +14,15 @@ module Gimli
|
|
14
14
|
# Initialize the converter with a File
|
15
15
|
# @param [Array] files The list of Gimli::MarkupFile to convert (passing a single file will still work)
|
16
16
|
# @param [Boolean] merge
|
17
|
+
# @param [Boolean] pagenumbers
|
17
18
|
# @param [Boolean] remove_front_matter
|
18
19
|
# @param [String] output_filename
|
19
20
|
# @param [String] output_dir
|
20
21
|
# @param [String] stylesheet
|
21
|
-
def initialize(files, merge = false, remove_front_matter = false, output_filename = nil, output_dir = nil, stylesheet = nil)
|
22
|
+
def initialize(files, merge = false, pagenumbers = false, remove_front_matter = false, output_filename = nil, output_dir = nil, stylesheet = nil)
|
22
23
|
@files = files
|
23
24
|
@merge = merge
|
25
|
+
@pagenumbers = pagenumbers
|
24
26
|
@remove_front_matter = remove_front_matter
|
25
27
|
@output_filename = output_filename
|
26
28
|
@output_dir = output_dir
|
@@ -63,7 +65,9 @@ module Gimli
|
|
63
65
|
# @param [String] html
|
64
66
|
# @return [PDFKit]
|
65
67
|
def pdf_kit(html)
|
66
|
-
|
68
|
+
options = {}
|
69
|
+
options.merge!({ :footer_right => '[page]/[toPage]' }) if @pagenumbers
|
70
|
+
kit = PDFKit.new(html, options)
|
67
71
|
|
68
72
|
load_stylesheets kit
|
69
73
|
|
data/lib/gimli/setup.rb
CHANGED
@@ -28,6 +28,10 @@ module Gimli extend OptiFlagSet
|
|
28
28
|
description 'Merge markup files into single pdf file'
|
29
29
|
alternate_forms 'm'
|
30
30
|
end
|
31
|
+
optional_switch_flag 'pagenumbers' do
|
32
|
+
description 'Print the page numbers in the lower right corner of all pages in pdf'
|
33
|
+
alternate_forms 'p'
|
34
|
+
end
|
31
35
|
optional_switch_flag 'removefrontmatter' do
|
32
36
|
description 'Remove yaml frontmatter from your files.'
|
33
37
|
alternate_forms 'y'
|
data/lib/gimli/version.rb
CHANGED
@@ -31,7 +31,7 @@ describe Gimli::Converter do
|
|
31
31
|
file = Gimli::MarkupFile.new 'fake'
|
32
32
|
output_filename = 'my_file'
|
33
33
|
|
34
|
-
converter = Gimli::Converter.new [file], false, false, output_filename
|
34
|
+
converter = Gimli::Converter.new [file], false, false, false, output_filename
|
35
35
|
mock(converter).output_dir { Dir.getwd }
|
36
36
|
|
37
37
|
converter.output_file.should == File.join(Dir.getwd, "#{output_filename}.pdf")
|
@@ -50,7 +50,7 @@ describe Gimli::Converter do
|
|
50
50
|
dir = '/tmp/out'
|
51
51
|
|
52
52
|
file = Gimli::MarkupFile.new 'fake'
|
53
|
-
converter = Gimli::Converter.new file, false, false, nil, dir
|
53
|
+
converter = Gimli::Converter.new file, false, false, false, nil, dir
|
54
54
|
|
55
55
|
mock(File).directory?(dir) { true }
|
56
56
|
|
@@ -68,7 +68,7 @@ describe Gimli::Converter do
|
|
68
68
|
file = Gimli::MarkupFile.new 'fake'
|
69
69
|
stylesheet = '/home/me/gimli/my-style.css'
|
70
70
|
|
71
|
-
converter = Gimli::Converter.new file, false, false, nil, nil, stylesheet
|
71
|
+
converter = Gimli::Converter.new file, false, false, false, nil, nil, stylesheet
|
72
72
|
|
73
73
|
converter.stylesheet.should == stylesheet
|
74
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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: 2011-
|
12
|
+
date: 2011-10-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: github-markup
|
16
|
-
requirement: &
|
16
|
+
requirement: &20702400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.5.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20702400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redcarpet
|
27
|
-
requirement: &
|
27
|
+
requirement: &20696880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.17.2
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20696880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: RedCloth
|
38
|
-
requirement: &
|
38
|
+
requirement: &20693760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 4.2.7
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *20693760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: org-ruby
|
49
|
-
requirement: &
|
49
|
+
requirement: &20692000 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.5.3
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *20692000
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: creole
|
60
|
-
requirement: &
|
60
|
+
requirement: &20689620 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.4.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *20689620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: wikicloth
|
71
|
-
requirement: &
|
71
|
+
requirement: &20682020 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.6.3
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *20682020
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: albino
|
82
|
-
requirement: &
|
82
|
+
requirement: &20680400 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 1.3.3
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *20680400
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: nokogiri
|
93
|
-
requirement: &
|
93
|
+
requirement: &20678620 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.4.4
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *20678620
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: wkhtmltopdf-binary
|
104
|
-
requirement: &
|
104
|
+
requirement: &20666520 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 0.9.5.3
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *20666520
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: pdfkit
|
115
|
-
requirement: &
|
115
|
+
requirement: &20663960 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 0.5.2
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *20663960
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: optiflag
|
126
|
-
requirement: &
|
126
|
+
requirement: &20650800 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0.7'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *20650800
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: rake
|
137
|
-
requirement: &
|
137
|
+
requirement: &20649780 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *20649780
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: rspec
|
148
|
-
requirement: &
|
148
|
+
requirement: &20648240 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *20648240
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: rr
|
159
|
-
requirement: &
|
159
|
+
requirement: &20646200 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *20646200
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: bundler
|
170
|
-
requirement: &
|
170
|
+
requirement: &20645360 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,7 +175,7 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *20645360
|
179
179
|
description: Utility for converting markup files to pdf files. Useful for reports
|
180
180
|
etc.
|
181
181
|
email: fredrik.wallgren@gmail.com
|
@@ -224,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
224
|
version: '0'
|
225
225
|
segments:
|
226
226
|
- 0
|
227
|
-
hash:
|
227
|
+
hash: 3487250391176844937
|
228
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
229
|
none: false
|
230
230
|
requirements:
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
version: '0'
|
234
234
|
segments:
|
235
235
|
- 0
|
236
|
-
hash:
|
236
|
+
hash: 3487250391176844937
|
237
237
|
requirements: []
|
238
238
|
rubyforge_project: gimli
|
239
239
|
rubygems_version: 1.8.6
|