cheepub 0.8.0 → 0.9.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 +4 -4
- data/README.md +13 -2
- data/lib/cheepub/converter/cheelatex.rb +10 -5
- data/lib/cheepub/generator/epub.rb +1 -1
- data/lib/cheepub/generator/latex.rb +1 -1
- data/lib/cheepub/generator.rb +0 -1
- data/lib/cheepub/markdown.rb +2 -2
- data/lib/cheepub/nav.rb +1 -1
- data/lib/cheepub/version.rb +1 -1
- data/lib/cheepub.rb +5 -0
- data/lib/kramdown/parser/cheemarkdown.rb +6 -1
- data/{lib/cheepub/templates → templates}/bodymatter.html.erb +0 -0
- data/{lib/cheepub/templates → templates}/bodymatter.tex.erb +0 -0
- data/{lib/cheepub/templates → templates}/nav.xhtml.erb +0 -0
- data/{lib/cheepub/templates → templates}/style.css.erb +0 -0
- data/{lib/cheepub/templates → templates}/titlepage.xhtml.erb +0 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc94d079a5e14e768ec79d72d23648c2718ae7de64c8783d099bcb80290dee85
|
4
|
+
data.tar.gz: 34a9f53cdf27f298daf2369e973ccbb9eabea61e6e727340081404b6a1eaa1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992e95e9ec3a5343c3094fdfea29abb2bef71bf82121fe0668940847b3d356958dcc9e3e82830ec03289091156f52e2b6e8edbb2b724cbaae30dc1fc21eeddfd
|
7
|
+
data.tar.gz: 8152e4bf67f26e086064a6c3d764294b791f7530011070f5083dd0a8faed7420e74c7109e14dea41ebee698b6646ba4a68384741b7465f67cc364b0a92bf9cb9
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://badge.fury.io/rb/cheepub) [](https://travis-ci.org/takahashim/cheepub) [](https://codeclimate.com/github/takahashim/cheepub/maintainability) [](https://gemnasium.com/github.com/takahashim/cheepub)
|
4
4
|
|
5
5
|
|
6
|
-
Cheepub is EPUB generator from Markdown. When you have markdown file, you can generate EPUB3 file with just one command: `cheepub sample.md`.
|
6
|
+
Cheepub is EPUB/PDF generator from Markdown. When you have markdown file, you can generate EPUB3 file with just one command: `cheepub sample.md`.
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -25,6 +25,12 @@ You can add options `--title` and `--author`.
|
|
25
25
|
$ cheepub --title foo --author bar source.md
|
26
26
|
```
|
27
27
|
|
28
|
+
With `--latex` option, you can generate PDF with LaTeX.
|
29
|
+
|
30
|
+
```sh
|
31
|
+
$ cheepub --title foo --author bar --latex source.md
|
32
|
+
```
|
33
|
+
|
28
34
|
If you use front-matter section like Jekyll, you can execute without any options:
|
29
35
|
|
30
36
|
```sh
|
@@ -37,7 +43,7 @@ $ cheepub source.md
|
|
37
43
|
* `--author AUTOR` set author of the book
|
38
44
|
* `--title TITLE` set title of the book
|
39
45
|
* `--config CONFIG` set configuration file
|
40
|
-
* `--latex`
|
46
|
+
* `--latex` generate PDF (with LaTeX) file
|
41
47
|
* `--debug` set debug mode
|
42
48
|
* `-o, --out OUTFILE` set output filename
|
43
49
|
* `--[no-]titlepage` add titlepage or not
|
@@ -90,6 +96,11 @@ In a little district west of Washington Square the streets have run crazy and br
|
|
90
96
|
|
91
97
|
## History
|
92
98
|
|
99
|
+
### 0.9.0
|
100
|
+
|
101
|
+
- support Markdown (pipe) table
|
102
|
+
- cannot omit leading and trailing pipes (different with original kramdown)
|
103
|
+
|
93
104
|
### 0.8.0
|
94
105
|
|
95
106
|
- support option `--json`
|
@@ -37,16 +37,21 @@ module Cheepub
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def convert_html_element(el, opts)
|
40
|
-
|
40
|
+
case el.value
|
41
|
+
when :ruby
|
41
42
|
str = inner(el, opts)
|
42
43
|
"\\ruby[g]{#{str}}"
|
43
|
-
|
44
|
+
when :rt
|
44
45
|
str = inner(el, opts)
|
45
46
|
"}{#{str}"
|
46
|
-
|
47
|
+
when :span
|
47
48
|
"\\rensuji{#{inner(el, opts)}}"
|
48
|
-
|
49
|
-
"
|
49
|
+
when "p"
|
50
|
+
if el.children.size == 1 && el.children.first.value == "br"
|
51
|
+
"\\rblatexEmptyLine\n"
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
50
55
|
else
|
51
56
|
super
|
52
57
|
end
|
@@ -47,7 +47,7 @@ module Cheepub
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def apply_template(template_file)
|
50
|
-
template = File.read(File.join(Cheepub::
|
50
|
+
template = File.read(File.join(Cheepub::TEMPLATES_DIR, template_file))
|
51
51
|
return ERB.new(template).result(binding)
|
52
52
|
end
|
53
53
|
|
@@ -47,7 +47,7 @@ module Cheepub
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def apply_template(template_file)
|
50
|
-
template = File.read(File.join(Cheepub::
|
50
|
+
template = File.read(File.join(Cheepub::TEMPLATES_DIR, template_file))
|
51
51
|
return ERB.new(template).result(binding)
|
52
52
|
end
|
53
53
|
end
|
data/lib/cheepub/generator.rb
CHANGED
data/lib/cheepub/markdown.rb
CHANGED
@@ -11,7 +11,7 @@ module Cheepub
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize(text, **params)
|
14
|
-
default_params = {template: File.join(
|
14
|
+
default_params = {template: File.join(Cheepub::TEMPLATES_DIR, "bodymatter.html.erb"),
|
15
15
|
lang: "ja",
|
16
16
|
title: "content",
|
17
17
|
cssfile: "style.css",
|
@@ -31,7 +31,7 @@ module Cheepub
|
|
31
31
|
|
32
32
|
def to_latex
|
33
33
|
params = @params.dup
|
34
|
-
params[:template] = File.join(
|
34
|
+
params[:template] = File.join(Cheepub::TEMPLATES_DIR, "bodymatter.tex.erb")
|
35
35
|
params[:latex_headers] = %w{chapter* section* subsection* subsubsection* paragraph* subparagraph*}
|
36
36
|
Kramdown::Document.new(@text, params).to_latex
|
37
37
|
end
|
data/lib/cheepub/nav.rb
CHANGED
@@ -12,7 +12,7 @@ module Cheepub
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_html
|
15
|
-
template = File.read(File.join(
|
15
|
+
template = File.read(File.join(Cheepub::TEMPLATES_DIR, "nav.xhtml.erb"))
|
16
16
|
@body = @root.to_html_ol
|
17
17
|
erb = ERB.new(template)
|
18
18
|
return erb.result(binding)
|
data/lib/cheepub/version.rb
CHANGED
data/lib/cheepub.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
## suppress warning in 3rd party libraries
|
1
2
|
tmp = $VERBOSE
|
2
3
|
$VERBOSE = false
|
3
4
|
require "clamp"
|
@@ -19,3 +20,7 @@ require "cheepub/heading_parser"
|
|
19
20
|
require "cheepub/heading_item"
|
20
21
|
require "cheepub/nav"
|
21
22
|
require "cheepub/converter/cheelatex"
|
23
|
+
|
24
|
+
module Cheepub
|
25
|
+
TEMPLATES_DIR = File.join(File.dirname(__FILE__), "../templates")
|
26
|
+
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
require 'kramdown/parser/gfm'
|
2
2
|
|
3
|
+
## redefine TABLE_ROW_LINE
|
4
|
+
class Kramdown::Parser::Kramdown
|
5
|
+
remove_const("TABLE_ROW_LINE".to_sym)
|
6
|
+
TABLE_ROW_LINE = /^(?:\s*)(\|.*?\|)[ \t]*\n/
|
7
|
+
end
|
8
|
+
|
3
9
|
module Kramdown
|
4
10
|
module Parser
|
5
11
|
class Cheemarkdown < Kramdown::Parser::GFM
|
@@ -8,7 +14,6 @@ module Kramdown
|
|
8
14
|
super
|
9
15
|
@span_parsers.unshift(:ruby)
|
10
16
|
@span_parsers.unshift(:tcy)
|
11
|
-
@block_parsers.delete(:table)
|
12
17
|
end
|
13
18
|
|
14
19
|
RUBY_START = /(?:\{) ## begin
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheepub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takahashim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gepub
|
@@ -225,11 +225,6 @@ files:
|
|
225
225
|
- lib/cheepub/heading_parser/handler.rb
|
226
226
|
- lib/cheepub/markdown.rb
|
227
227
|
- lib/cheepub/nav.rb
|
228
|
-
- lib/cheepub/templates/bodymatter.html.erb
|
229
|
-
- lib/cheepub/templates/bodymatter.tex.erb
|
230
|
-
- lib/cheepub/templates/nav.xhtml.erb
|
231
|
-
- lib/cheepub/templates/style.css.erb
|
232
|
-
- lib/cheepub/templates/titlepage.xhtml.erb
|
233
228
|
- lib/cheepub/version.rb
|
234
229
|
- lib/kramdown/parser/cheemarkdown.rb
|
235
230
|
- misc/conv_entity.rb
|
@@ -241,6 +236,11 @@ files:
|
|
241
236
|
- samples/thelastleaf_ja_luatex.md
|
242
237
|
- samples/yume_juya.md
|
243
238
|
- samples/yume_juya_luatex.md
|
239
|
+
- templates/bodymatter.html.erb
|
240
|
+
- templates/bodymatter.tex.erb
|
241
|
+
- templates/nav.xhtml.erb
|
242
|
+
- templates/style.css.erb
|
243
|
+
- templates/titlepage.xhtml.erb
|
244
244
|
homepage: https://github.com/takahashim/cheepub
|
245
245
|
licenses: []
|
246
246
|
metadata: {}
|