author 1.1.6.alpha → 1.2.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjhjZGIwNmM5YWNhMzY0YmYwMjk3NjQ5MmM1NzZmZWQzNjVmNmIxZA==
4
+ ZTE5N2M2ZGMxNzRmMzE1ZDA5NDk5ODM5M2JhZmFhMmE4N2MwODk1Zg==
5
5
  data.tar.gz: !binary |-
6
- NjgzYmIxNTYwYWFjODFjOGQxZWI4OThiOGNhYTE5MGE2YmZlMGIxNg==
6
+ YzNmYzQwZjhiZmJjNDg4ZGMzNjI5NGZiMWIyNjdmMTNiYTI2NmE4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTdhNGYzYjcyMDlhM2QwNDBlOGFmNTFhZWM4YjRjNzViN2U1MTMwNzRkNjZi
10
- YjIxN2QwOGRlNTNmYjhmNzk4ZmQ2MTM0MDExMWEwMmViNGYxMjQ5ODVlMGI0
11
- NTQ2MzE3ZWIzMTc1NzEzZmVkMTEzNjc0MWRmNzQwMjIyZTg4YTM=
9
+ YWRhNTZiNmUxZTZiMmE2NGQ0MzIzMmM5NTdhOWFkYzVlMzFmYWQyMzI5ZTFm
10
+ YzljMGQyNTMyMjQzMmI1ZDgyNTYzMGQzODc3MDQ3ZDA1YThiNTM3YzcyMWE0
11
+ NzMwZGY5OWExOWFhYjIyZjczZWQwOGFiNDM2NmU2YmE2ODZiMzA=
12
12
  data.tar.gz: !binary |-
13
- MWY3Y2YxMGU0YmM0MDgwMjc2YjQ1YTZmNzE0ZmJkN2FlMTc0OTQ3ZjY0MzFh
14
- M2Q2MTMwODIyM2I3NDBlZDlkNjAwYTUwZGMxM2ZiNTViNTNhMDlkMWIzYzg5
15
- NmEzNDczMGMxNGNkZWM3MWU2YzZmMWZhY2RmODA2NzdlNjAxNmQ=
13
+ YzdhMjhjNDU3ZThhODhlZTEzZDdmM2EyNTNhOTM2N2EwNGUwZDFlMGY1MzRl
14
+ MmExY2I5YmYzNzI4MDZiOTFiYWUwYTAxNTdlY2QyNWQxMGY2Njg4ZmQwMmQ4
15
+ OTU2NmFhNjc3ZGE4ZGRmZDkyMTE1ZmE4N2U5NzJiZDhmNjYxZjA=
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Author [![GitHub version](https://badge.fury.io/gh/tschmidt%2Fauthor.svg)](http://badge.fury.io/gh/tschmidt%2Fauthor)
1
+ # Author [![Gem Version](https://badge.fury.io/rb/author.svg)](http://badge.fury.io/rb/author)
2
2
 
3
3
  [![Build Status](https://travis-ci.org/tschmidt/author.svg?branch=master)](https://travis-ci.org/tschmidt/author) [![Dependency Status](https://gemnasium.com/tschmidt/author.svg)](https://gemnasium.com/tschmidt/author)
4
4
 
5
- **ATTN:** This is still **very** alpha. Not everything is working. Use at your own risk.
5
+ **ATTN:** Everything should be working, however, I am keeping the gem in alpha for a little while longer. The first official release should be coming soon.
6
6
 
7
7
  *[imho]: In my humble opinion
8
8
 
@@ -55,6 +55,8 @@ That's it!
55
55
 
56
56
  ## Extras
57
57
 
58
+ ### Table of Contents
59
+
58
60
  One of the nice things about using Kramdown is that it provides a way to generate a table
59
61
  of contents [TOC]. If you would like to add a TOC to your book, simply add a file to the
60
62
  `chapters/` folder - might I suggest `toc.md` - and include the following:
@@ -70,11 +72,26 @@ of contents [TOC]. If you would like to add a TOC to your book, simply add a fil
70
72
  Then, in the `outline.txt` file, just make sure the file with that information is
71
73
  the first one listed.
72
74
 
75
+ ### Codeblocks
76
+
73
77
  For anyone wanting to write books that involve a lot of code, I have built a plugin
74
78
  called `awesome_codeblock`. You can specify quite a few options that will make your
75
79
  codeblocks, well, more awesome. Check out `lib/author/plugins/awesome_codeblock.rb`
76
80
  for all the details.
77
81
 
82
+ ### Sidebars
83
+
84
+ If you have a need for a sidebar, there is a Liquid plugin I created called `sidebar`. It takes an optional argument called `type` which can be anything you want and will be a class added to the resulting code.
85
+
86
+ There are 3 types which come with predefined styles though. They are `info`, `warning`, and `tip`. `info` is the default and will be used if the `type` is not set. Here is an example:
87
+
88
+ ```
89
+ {% sidebar type:tip %}
90
+ #### I am a sidebar!
91
+
92
+ You can put any code supported by Kramdown in this block. Yippee!
93
+ {% endsidebar %}
94
+
78
95
  ## Dependencies
79
96
 
80
97
  There are a couple of executables that Author requires to do its job.
data/TODO.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # TODO
2
2
 
3
- - Add the ability to include a cover image.
4
- - Add the ability to include images in the finished book formats.
3
+ - [ ] Add the ability to include a cover image.
4
+ - [ ] Add the ability to include images in the finished book formats.
5
+ - [ ] Add additional themes
6
+ - [ ] Find fonts to include with book
7
+ - [ ] Update book.css to fix spacing between back-to-back codeblocks
8
+ - [ ] Add a plugin that will allow for Leanpub style aside boxes
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "minitest"
24
24
  spec.add_development_dependency "minitest-spec-expect"
25
25
 
26
- spec.add_dependency "thor"
27
- spec.add_dependency "liquid"
28
- spec.add_dependency "coderay"
29
- spec.add_dependency "kramdown"
30
- spec.add_dependency "safe_yaml"
31
- spec.add_dependency "eeepub"
32
- spec.add_dependency "rubyzip"
33
- spec.add_dependency "zip-zip"
26
+ spec.add_dependency "thor", "~> 0.19"
27
+ spec.add_dependency "liquid", "~> 2.6"
28
+ spec.add_dependency "coderay", "~> 1.1"
29
+ spec.add_dependency "kramdown", "~> 1.3"
30
+ spec.add_dependency "safe_yaml","~> 1.0"
31
+ spec.add_dependency "eeepub", "~> 0.8"
32
+ spec.add_dependency "rubyzip", "~> 1.1"
33
+ spec.add_dependency "zip-zip", "~> 0.3"
34
34
  end
@@ -1,6 +1,7 @@
1
1
  require 'liquid'
2
2
  require 'kramdown'
3
3
  require 'author/plugins/awesome_codeblock'
4
+ require 'author/plugins/sidebar'
4
5
 
5
6
  module Author
6
7
  module Exporters
@@ -1,6 +1,6 @@
1
1
  # = AwesomeCodeblock
2
2
  #
3
- # This is a CodeRay plugin that allows you to output more awesome codeblocks.
3
+ # This is a Liquid plugin that allows you to output more awesome codeblocks.
4
4
  # It was inspired by the code_ray_block plugin by git@codebykat.
5
5
  #
6
6
  # == Usage
@@ -0,0 +1,71 @@
1
+ # = Sidebar
2
+ #
3
+ # This is a Liquid plugin that allows you to include sidebars into your text.
4
+ #
5
+ # == Options
6
+ #
7
+ # There are several sidebar types you can use:
8
+ #
9
+ # - :info # this is the default
10
+ # - :warning
11
+ # - :tip
12
+ #
13
+ # == Usage
14
+ #
15
+ # All of the types use the same format. All you need to do is supply the `type` you want the
16
+ # sidebar to be. This will control the styling of the sidbar box.
17
+ #
18
+ # {% sidebar %}
19
+ # This is the text that will appear in the sidebar
20
+ # {% endsidebar %}
21
+ #
22
+ # Here is an example where you specify the type.
23
+ #
24
+ # {% sidebar type:warning %}
25
+ # This is now a warning sidebar
26
+ # {% endsidebar %}
27
+ #
28
+ # Author: Terry Schmidt
29
+ # Date: 27 May 2014
30
+ # License: [WTFPL](http://www.wtfpl.net/about/)
31
+ #
32
+ require 'liquid'
33
+ require 'kramdown'
34
+
35
+ module Author
36
+ module Plugins
37
+ class Sidebar < Liquid::Block
38
+
39
+ attr_accessor :markup
40
+
41
+ def initialize(tag_name, markup, tokens)
42
+ @markup = markup
43
+ super
44
+ end
45
+
46
+ def render(context)
47
+ sidebar_content = super
48
+ output = ''
49
+ output += header
50
+ output += Kramdown::Document.new(sidebar_content, auto_ids: false).to_html
51
+ output += footer
52
+ output
53
+ end
54
+
55
+ def header
56
+ %Q[<table class="sidebar sidebar-#{sidebar_type}"><tbody><tr><td class="sidebar-icon"></td><td>]
57
+ end
58
+
59
+ def footer
60
+ %q[</td></tr></tbody></table>]
61
+ end
62
+
63
+ def sidebar_type
64
+ markup =~ /\s*type:"?([^"\s]+)"?/i ? $1 : 'info'
65
+ end
66
+
67
+ end
68
+ end
69
+ end
70
+
71
+ Liquid::Template.register_tag('sidebar', Author::Plugins::Sidebar)
@@ -529,8 +529,9 @@ th {
529
529
  .CodeRay .head .head { color: #f4f; }
530
530
 
531
531
  figure.code {
532
+ background: #fff;
532
533
  border: 1px solid #d5d5d5;
533
- margin: 0 20px;
534
+ margin: 30px 20px;
534
535
  border-radius: 2px;
535
536
  }
536
537
 
@@ -580,6 +581,40 @@ figure.code figcaption {
580
581
  }
581
582
 
582
583
 
584
+ /*****************************************
585
+ Sidebar Styles
586
+ *****************************************/
587
+
588
+ .sidebar {
589
+ background: #e5ffe5;
590
+ border: 1px solid #44d544;
591
+ border-left: 8px solid #44d544;
592
+ margin: 30px 0;
593
+ width: 100%;
594
+ }
595
+
596
+ .sidebar td {
597
+ padding: 20px;
598
+ }
599
+
600
+ .sidebar .sidebar-icon {
601
+ padding: 0;
602
+ text-align: center;
603
+ width: 5px;
604
+ }
605
+
606
+ .sidebar-warning {
607
+ background: #ffe5e5;
608
+ border-color: #d54444;
609
+ }
610
+
611
+ .sidebar-tip {
612
+ background: #d5efff;
613
+ border-color: #0099d5;
614
+ }
615
+
616
+
617
+
583
618
  /*****************************************
584
619
  Book Styles
585
620
  *****************************************/
@@ -1,3 +1,3 @@
1
1
  module Author
2
- VERSION = "1.1.6.alpha"
2
+ VERSION = "1.2.0.alpha"
3
3
  end
@@ -0,0 +1,3 @@
1
+ {% sidebar type:info %}
2
+ I am an info sidebar
3
+ {% endsidebar %}
@@ -0,0 +1,3 @@
1
+ {% sidebar %}
2
+ I am an info sidebar
3
+ {% endsidebar %}
@@ -0,0 +1,3 @@
1
+ {% sidebar type:tip %}
2
+ I am a tip sidebar
3
+ {% endsidebar %}
@@ -0,0 +1,3 @@
1
+ {% sidebar type:warning %}
2
+ I am a warning sidebar
3
+ {% endsidebar %}
@@ -0,0 +1,30 @@
1
+ require_relative '../helper'
2
+ require 'liquid'
3
+ require 'author/plugins/sidebar'
4
+
5
+ describe Author::Plugins::Sidebar do
6
+
7
+ let(:liquid) { Liquid::Template }
8
+
9
+ context "no type specified" do
10
+ it "should process the block into an info sidebar" do
11
+ using_liquid_templates do
12
+ output = liquid.parse(IO.read('sidebar-no-type.txt')).render
13
+ expect(output).to_include %q[<table class="sidebar sidebar-info">]
14
+ end
15
+ end
16
+ end
17
+
18
+ context "type is specified" do
19
+ %w[info warning tip].each do |type|
20
+ it "should process the block into the correct sidebar" do
21
+ using_liquid_templates do
22
+ output = liquid.parse(IO.read("sidebar-#{type}.txt")).render
23
+ expect(output).to_include %Q[<table class="sidebar sidebar-#{type}">]
24
+ expect(output).to_match %r[I am an? #{type} sidebar]
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ end
@@ -8,7 +8,7 @@
8
8
  <div id="contents">
9
9
  <h2 id="this-is-chapter-one">This is chapter one</h2>
10
10
 
11
- <p>Liquid test {{ foo }}</p>
11
+ <p>Liquid test </p>
12
12
 
13
13
  <h2 id="this-is-chapter-two">This is chapter two</h2>
14
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: author
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6.alpha
4
+ version: 1.2.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terry Schmidt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,114 +70,114 @@ dependencies:
70
70
  name: thor
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.19'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.19'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: liquid
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '2.6'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '2.6'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: coderay
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '1.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '1.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: kramdown
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '1.3'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '1.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: safe_yaml
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '1.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '1.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: eeepub
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '0.8'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ! '>='
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '0.8'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubyzip
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ! '>='
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '1.1'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ! '>='
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '1.1'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: zip-zip
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ! '>='
171
+ - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: '0.3'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ! '>='
178
+ - - ~>
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: '0.3'
181
181
  description: Quickly create ebooks using Markdown
182
182
  email:
183
183
  - terry.m.schmidt@gmail.com
@@ -208,6 +208,7 @@ files:
208
208
  - lib/author/exporters/pdf.rb
209
209
  - lib/author/exporters/xhtml.rb
210
210
  - lib/author/plugins/awesome_codeblock.rb
211
+ - lib/author/plugins/sidebar.rb
211
212
  - lib/author/templates/Gemfile
212
213
  - lib/author/templates/book.css
213
214
  - lib/author/templates/config.yml
@@ -229,11 +230,16 @@ files:
229
230
  - test/liquids/language_set.md
230
231
  - test/liquids/no_options.md
231
232
  - test/liquids/show_line_numbers.md
233
+ - test/liquids/sidebar-info.txt
234
+ - test/liquids/sidebar-no-type.txt
235
+ - test/liquids/sidebar-tip.txt
236
+ - test/liquids/sidebar-warning.txt
232
237
  - test/liquids/starting_line_number.md
233
238
  - test/liquids/title_as_filename.md
234
239
  - test/liquids/title_as_filepath.md
235
240
  - test/liquids/title_as_string.md
236
241
  - test/plugins/awesome_codeblock_test.rb
242
+ - test/plugins/sidebar_test.rb
237
243
  - test/sample_book/Gemfile
238
244
  - test/sample_book/chapters/one.md
239
245
  - test/sample_book/chapters/three.md
@@ -283,11 +289,16 @@ test_files:
283
289
  - test/liquids/language_set.md
284
290
  - test/liquids/no_options.md
285
291
  - test/liquids/show_line_numbers.md
292
+ - test/liquids/sidebar-info.txt
293
+ - test/liquids/sidebar-no-type.txt
294
+ - test/liquids/sidebar-tip.txt
295
+ - test/liquids/sidebar-warning.txt
286
296
  - test/liquids/starting_line_number.md
287
297
  - test/liquids/title_as_filename.md
288
298
  - test/liquids/title_as_filepath.md
289
299
  - test/liquids/title_as_string.md
290
300
  - test/plugins/awesome_codeblock_test.rb
301
+ - test/plugins/sidebar_test.rb
291
302
  - test/sample_book/Gemfile
292
303
  - test/sample_book/chapters/one.md
293
304
  - test/sample_book/chapters/three.md