author 1.1.5.alpha → 1.1.6.alpha
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 +8 -8
- data/README.md +26 -15
- data/TODO.md +4 -0
- data/lib/author/commands/builder.rb +12 -0
- data/lib/author/plugins/awesome_codeblock.rb +11 -4
- data/lib/author/version.rb +1 -1
- data/test/commands/builder_test.rb +4 -0
- data/test/plugins/awesome_codeblock_test.rb +1 -1
- data/test/sample_book/export/book.xhtml +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjhjZGIwNmM5YWNhMzY0YmYwMjk3NjQ5MmM1NzZmZWQzNjVmNmIxZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjgzYmIxNTYwYWFjODFjOGQxZWI4OThiOGNhYTE5MGE2YmZlMGIxNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTdhNGYzYjcyMDlhM2QwNDBlOGFmNTFhZWM4YjRjNzViN2U1MTMwNzRkNjZi
|
10
|
+
YjIxN2QwOGRlNTNmYjhmNzk4ZmQ2MTM0MDExMWEwMmViNGYxMjQ5ODVlMGI0
|
11
|
+
NTQ2MzE3ZWIzMTc1NzEzZmVkMTEzNjc0MWRmNzQwMjIyZTg4YTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWY3Y2YxMGU0YmM0MDgwMjc2YjQ1YTZmNzE0ZmJkN2FlMTc0OTQ3ZjY0MzFh
|
14
|
+
M2Q2MTMwODIyM2I3NDBlZDlkNjAwYTUwZGMxM2ZiNTViNTNhMDlkMWIzYzg5
|
15
|
+
NmEzNDczMGMxNGNkZWM3MWU2YzZmMWZhY2RmODA2NzdlNjAxNmQ=
|
data/README.md
CHANGED
@@ -24,33 +24,26 @@ Thus, Author was born.
|
|
24
24
|
|
25
25
|
## Installation
|
26
26
|
|
27
|
-
Add this line to your application's Gemfile:
|
28
|
-
|
29
|
-
gem 'author'
|
30
|
-
|
31
|
-
And then execute:
|
32
|
-
|
33
|
-
$ bundle
|
34
|
-
|
35
|
-
Or install it yourself with:
|
36
|
-
|
37
27
|
$ gem install author
|
38
28
|
|
39
|
-
##
|
29
|
+
## Usage
|
40
30
|
|
41
31
|
$ author new mybook
|
42
32
|
$ cd mybook
|
43
33
|
|
44
34
|
Add your chapters to the `chapters/` folder. Name them whatever you want. Then, in the
|
45
35
|
`outline.txt` file, simply list the chapters in the order you want them to appear in the
|
46
|
-
finished book:
|
36
|
+
finished book. Here's an example of what `outline.txt` should look like:
|
47
37
|
|
48
38
|
preface.md
|
49
39
|
about-the-author.md
|
50
40
|
who-is-this-for.md
|
51
41
|
chapter-1.md
|
52
42
|
|
53
|
-
|
43
|
+
In order to create ePubs, you will need to specify a few things. Open up `config.yml` and
|
44
|
+
modify the settings that are listed.
|
45
|
+
|
46
|
+
When you're ready to build your ebook, just run one of the following commands:
|
54
47
|
|
55
48
|
author build xhtml
|
56
49
|
author build pdf
|
@@ -60,9 +53,27 @@ Once you've done that, just run one of the following commands:
|
|
60
53
|
|
61
54
|
That's it!
|
62
55
|
|
63
|
-
##
|
56
|
+
## Extras
|
57
|
+
|
58
|
+
One of the nice things about using Kramdown is that it provides a way to generate a table
|
59
|
+
of contents [TOC]. If you would like to add a TOC to your book, simply add a file to the
|
60
|
+
`chapters/` folder - might I suggest `toc.md` - and include the following:
|
61
|
+
|
62
|
+
```
|
63
|
+
## Table of Contents
|
64
|
+
{:.no_toc}
|
65
|
+
|
66
|
+
* this will be replaced
|
67
|
+
{:toc}
|
68
|
+
```
|
69
|
+
|
70
|
+
Then, in the `outline.txt` file, just make sure the file with that information is
|
71
|
+
the first one listed.
|
64
72
|
|
65
|
-
|
73
|
+
For anyone wanting to write books that involve a lot of code, I have built a plugin
|
74
|
+
called `awesome_codeblock`. You can specify quite a few options that will make your
|
75
|
+
codeblocks, well, more awesome. Check out `lib/author/plugins/awesome_codeblock.rb`
|
76
|
+
for all the details.
|
66
77
|
|
67
78
|
## Dependencies
|
68
79
|
|
data/TODO.md
ADDED
@@ -34,6 +34,18 @@ module Author
|
|
34
34
|
Author::Exporters::Epub.export
|
35
35
|
end
|
36
36
|
|
37
|
+
desc "all", "Build everything"
|
38
|
+
def all
|
39
|
+
say "Building the XHTMl site"
|
40
|
+
Author::Exporters::XHTML.export
|
41
|
+
say "Building PDF"
|
42
|
+
Author::Exporters::PDF.export
|
43
|
+
say "Building the .mobi file"
|
44
|
+
Author::Exporters::Mobi.export
|
45
|
+
say "Building the epub file"
|
46
|
+
Author::Exporters::Epub.export
|
47
|
+
end
|
48
|
+
|
37
49
|
end
|
38
50
|
end
|
39
51
|
end
|
@@ -22,21 +22,28 @@
|
|
22
22
|
# You can set the language of the code block. The default is `:text` but you can specify
|
23
23
|
# any of the code formats that CodeRay supports.
|
24
24
|
#
|
25
|
-
# {% awesome_codeblock lang:
|
25
|
+
# {% awesome_codeblock lang:ruby %}
|
26
26
|
# code goes here
|
27
27
|
# {% endawesome_codeblock %}
|
28
28
|
#
|
29
29
|
# You can choose to add line numbers as well. Refer to the documentation for
|
30
30
|
# CodeRay::Encoder::HTML for values that can be passed in.
|
31
31
|
#
|
32
|
-
# {% awesome_codeblock
|
32
|
+
# {% awesome_codeblock show_line_numbers:true %}
|
33
33
|
# code goes here
|
34
34
|
# {% endawesome_codeblock %}
|
35
35
|
#
|
36
36
|
# You can choose to highlight specific lines within your code block as well. Just supply
|
37
37
|
# a comma separated list of line numbers.
|
38
38
|
#
|
39
|
-
# {% awesome_codeblock
|
39
|
+
# {% awesome_codeblock highlight:"2,3,4,7" %}
|
40
|
+
# code goes here
|
41
|
+
# ...
|
42
|
+
# {% endawesome_codeblock %}
|
43
|
+
#
|
44
|
+
# If you want your line numbers to start at a specific number, you can do that too!
|
45
|
+
#
|
46
|
+
# {% awesome_codeblock start_at:25 %}
|
40
47
|
# code goes here
|
41
48
|
# ...
|
42
49
|
# {% endawesome_codeblock %}
|
@@ -92,7 +99,7 @@ module Author
|
|
92
99
|
wrapped_code = ''
|
93
100
|
code.strip.split("\n").each_with_index do |line, index|
|
94
101
|
index += starting_line_number
|
95
|
-
line = " 
|
102
|
+
line = line.empty? ? " " : CodeRay.scan(line, language.to_sym).html
|
96
103
|
lines += %Q[<div class="line-number#{' highlight' if lines_to_highlight && lines_to_highlight.include?(index)}">#{index}</div>]
|
97
104
|
wrapped_code += %Q[<div class="code-part#{' highlight' if lines_to_highlight && lines_to_highlight.include?(index)}">#{line}</div>]
|
98
105
|
end
|
data/lib/author/version.rb
CHANGED
@@ -10,7 +10,7 @@ describe Author::Plugins::AwesomeCodeblock do
|
|
10
10
|
it "should process the block into pretty code" do
|
11
11
|
using_liquid_templates do
|
12
12
|
rendered = liquid.parse(IO.read('no_options.md')).render
|
13
|
-
expect(rendered).to_include %q[puts
|
13
|
+
expect(rendered).to_include %q[puts "I'm awesome!"]
|
14
14
|
expect(rendered).to_include %Q[<figure class="code text"><div class="CodeRay"><table class="code">]
|
15
15
|
expect(rendered).to_not_include %q[<figcaption class='code-header'><span>]
|
16
16
|
expect(rendered).to_not_include %q[<div class="line-number">]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: author
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terry Schmidt
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- LICENSE.txt
|
193
193
|
- README.md
|
194
194
|
- Rakefile
|
195
|
+
- TODO.md
|
195
196
|
- author.gemspec
|
196
197
|
- bin/author
|
197
198
|
- lib/author.rb
|