asciidoctor-kindle 0.1.0 → 0.2.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 +2 -1
- data/bin/asciidoctor-kindle +23 -23
- data/lib/asciidoctor-kindle.rb +2 -3
- data/lib/asciidoctor-kindle/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abef29d1d8fdacfe51639e6b8eec14e66dd2db4f
|
4
|
+
data.tar.gz: 49b1a9158e7ef27b90aaad006350452ec549f72c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 320b7bcaaba19e373adb9661955ebb6db13a48067c7f4c2dbea576223a826501be9b10744888c2e6c8a7a66fe0b2d1ba9534bfea47090156b54beaccd7bc080b
|
7
|
+
data.tar.gz: 6f993cc9ae6155bd516a301b016083783783bc5db53916f68300adcc77909402c7a72b4cf162022bec4586d40cd969a8813053a2437b6e067821c2becad18a86
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# asciidoctor-kindle
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/midnightSuyama/asciidoctor-kindle.svg?branch=master)](https://travis-ci.org/midnightSuyama/asciidoctor-kindle)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/asciidoctor-kindle.svg)](http://badge.fury.io/rb/asciidoctor-kindle)
|
4
5
|
|
5
6
|
Asciidoctor extension for converting html to mobi
|
6
7
|
|
@@ -24,7 +25,7 @@ or
|
|
24
25
|
## Document Attributes
|
25
26
|
|
26
27
|
* `kindle-uid` - unique-identifier in OPF
|
27
|
-
* `kindle-
|
28
|
+
* `kindle-publisher` - dc:publisher in OPF
|
28
29
|
* `kindle-cover` - cover-image in OPF
|
29
30
|
|
30
31
|
## Development
|
data/bin/asciidoctor-kindle
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'asciidoctor'
|
4
|
-
require 'asciidoctor/cli'
|
5
|
-
require 'kindlegen'
|
6
|
-
|
7
|
-
options = Asciidoctor::Cli::Options.new
|
8
|
-
options[:requires] = ['asciidoctor-kindle']
|
9
|
-
options[:output_file] = 'kindle-content.html'
|
10
|
-
options.parse! ARGV
|
11
|
-
|
12
|
-
invoker = Asciidoctor::Cli::Invoker.new options
|
13
|
-
GC.start
|
14
|
-
invoker.invoke!
|
15
|
-
|
16
|
-
if invoker.code == 0
|
17
|
-
stdout, stderr, status = Kindlegen.run(
|
18
|
-
if status == 0
|
19
|
-
puts stdout
|
20
|
-
else
|
21
|
-
$stderr.puts stderr
|
22
|
-
end
|
23
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'asciidoctor/cli'
|
5
|
+
require 'kindlegen'
|
6
|
+
|
7
|
+
options = Asciidoctor::Cli::Options.new
|
8
|
+
options[:requires] = ['asciidoctor-kindle']
|
9
|
+
options[:output_file] = 'kindle-content.html'
|
10
|
+
options.parse! ARGV
|
11
|
+
|
12
|
+
invoker = Asciidoctor::Cli::Invoker.new options
|
13
|
+
GC.start
|
14
|
+
invoker.invoke!
|
15
|
+
|
16
|
+
if invoker.code == 0
|
17
|
+
stdout, stderr, status = Kindlegen.run('kindle-package.opf', '-o', 'kindle-published.mobi')
|
18
|
+
if status == 0
|
19
|
+
puts stdout
|
20
|
+
else
|
21
|
+
$stderr.puts stderr
|
22
|
+
end
|
23
|
+
end
|
data/lib/asciidoctor-kindle.rb
CHANGED
@@ -36,7 +36,6 @@ class KindlePostprocessor < Extensions::Postprocessor
|
|
36
36
|
uid = doc.attr('kindle-uid', 'asciidoctor-kindle')
|
37
37
|
title = doc.attr('doctitle')
|
38
38
|
creator = doc.attr('author')
|
39
|
-
description = doc.attr('kindle-description')
|
40
39
|
publisher = doc.attr('kindle-publisher', doc.attr('author'))
|
41
40
|
date = doc.attr('docdate')
|
42
41
|
language = doc.attr('lang', 'en')
|
@@ -45,14 +44,14 @@ class KindlePostprocessor < Extensions::Postprocessor
|
|
45
44
|
cover_path = doc.attr('kindle-cover')
|
46
45
|
|
47
46
|
str = %(<?xml version="1.0" encoding="utf-8"?>
|
48
|
-
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="
|
47
|
+
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="BookId">
|
49
48
|
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
|
50
49
|
<dc:title>#{title}</dc:title>
|
51
50
|
<dc:creator>#{creator}</dc:creator>
|
52
|
-
<dc:description>#{description}</dc:description>
|
53
51
|
<dc:publisher>#{publisher}</dc:publisher>
|
54
52
|
<dc:date>#{date}</dc:date>
|
55
53
|
<dc:language>#{language}</dc:language>
|
54
|
+
<dc:identifier id="BookId">#{uid}</dc:identifier>
|
56
55
|
</metadata>
|
57
56
|
<manifest>
|
58
57
|
<item id="content" media-type="text/html" href="#{content_path}" />
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-kindle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- midnightSuyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|