riven 0.2.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/bin/riven +2 -2
- data/lib/riven/html_generator.rb +7 -1
- data/lib/riven/opt_parser.rb +1 -1
- data/lib/riven/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9026432e44de597f708d32e6a6f9078c74979887
|
4
|
+
data.tar.gz: ca3317794a93a2b38cf230b019038cb8dbb29973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfd8f5f09553ec152557d7b75bffbee260cd97690ec10c3be63d739c04c362a094dec5bec57cace7b4d19c3bedfccfb7548cd95c53ccd8ad0cfefe89775f3b0a
|
7
|
+
data.tar.gz: 74e4d622e11d3fc0455cf921763522b80ac1755dd7642adc14652d960f816a3a63cc4ea1dfd88d8ed65c909e9b490b9b41ad4bd1231832bb2ee76f29bdd929a4
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Converts GitHub Flavored Markdown files to PDFs! Feature highlights:
|
|
8
8
|
- Smart directory based file merging
|
9
9
|
- Smart output file naming
|
10
10
|
- Page numbers (see *Prerequisites* section)
|
11
|
-
-
|
11
|
+
- Custom CSS
|
12
12
|
- Covers (see *Prerequisites* section)
|
13
13
|
- Table of Contents (see *Prerequisites* section)
|
14
14
|
|
@@ -97,6 +97,8 @@ You may give riven an additional CSS file with the `-s` param:
|
|
97
97
|
$ riven -s doc.css documentation/
|
98
98
|
```
|
99
99
|
|
100
|
+
unfortunately this CSS doesn't affect the table of contents currently, sorry for that.
|
101
|
+
|
100
102
|
|
101
103
|
### Cover
|
102
104
|
|
data/bin/riven
CHANGED
@@ -28,12 +28,12 @@ end
|
|
28
28
|
unless options[:cover_file] === ''
|
29
29
|
cover_markup = Riven::MarkupFile.read_cover(options[:cover_file])
|
30
30
|
end
|
31
|
-
cover_generator = Riven::HTMLGenerator.new('_riven_cover_tmp_file.html', cover_markup || '')
|
31
|
+
cover_generator = Riven::HTMLGenerator.new('_riven_cover_tmp_file.html', cover_markup || '', options)
|
32
32
|
|
33
33
|
|
34
34
|
## Step 5: Generate HTML for main document
|
35
35
|
markup = Riven::MarkupFile.read_all(files, options[:cover_file])
|
36
|
-
generator = Riven::HTMLGenerator.new('_riven_tmp_file.html', markup)
|
36
|
+
generator = Riven::HTMLGenerator.new('_riven_tmp_file.html', markup, options)
|
37
37
|
|
38
38
|
|
39
39
|
## Step 6: Determine PDF file name
|
data/lib/riven/html_generator.rb
CHANGED
@@ -7,10 +7,11 @@ module Riven
|
|
7
7
|
class HTMLGenerator
|
8
8
|
attr_accessor :html, :html_file
|
9
9
|
|
10
|
-
public def initialize(tmp_file, markup)
|
10
|
+
public def initialize(tmp_file, markup, options)
|
11
11
|
@html_file = Riven::HTMLFile.new(tmp_file)
|
12
12
|
|
13
13
|
@markup = markup
|
14
|
+
@options = options
|
14
15
|
|
15
16
|
@html = generate_html
|
16
17
|
@html_file.write(@html)
|
@@ -19,6 +20,11 @@ module Riven
|
|
19
20
|
public def generate_html
|
20
21
|
css = File.read(File.expand_path(File.dirname(__FILE__)) + '/../../css/style.css')
|
21
22
|
|
23
|
+
unless @options[:css_file].empty?
|
24
|
+
css << "\n\n"
|
25
|
+
css << File.read(@options[:css_file])
|
26
|
+
end
|
27
|
+
|
22
28
|
html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
|
23
29
|
html << '<style type="text/css">' + css + '</style></head><body>'
|
24
30
|
html << markup_to_html(@markup)
|
data/lib/riven/opt_parser.rb
CHANGED
@@ -52,7 +52,7 @@ module Riven
|
|
52
52
|
end
|
53
53
|
|
54
54
|
opts.on("-s FILE", "--css=FILE", "Path to the custom CSS file") do |css_file|
|
55
|
-
options[:css_file] = css_file
|
55
|
+
options[:css_file] = File.expand_path(css_file)
|
56
56
|
end
|
57
57
|
|
58
58
|
opts.on("-c FILE", "--cover=FILE", "Path to the cover MD file") do |cover_file|
|
data/lib/riven/version.rb
CHANGED