fnando-bookmaker 0.0.7

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.
Files changed (41) hide show
  1. data/History.txt +41 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +38 -0
  4. data/PostInstall.txt +0 -0
  5. data/README.markdown +168 -0
  6. data/Rakefile +4 -0
  7. data/TODO.txt +2 -0
  8. data/app_generators/bookmaker/bookmaker_generator.rb +68 -0
  9. data/app_generators/bookmaker/templates/Rakefile +3 -0
  10. data/app_generators/bookmaker/templates/config.yml +8 -0
  11. data/app_generators/bookmaker/templates/css/active4d.css +114 -0
  12. data/app_generators/bookmaker/templates/css/blackboard.css +88 -0
  13. data/app_generators/bookmaker/templates/css/dawn.css +121 -0
  14. data/app_generators/bookmaker/templates/css/eiffel.css +121 -0
  15. data/app_generators/bookmaker/templates/css/idle.css +62 -0
  16. data/app_generators/bookmaker/templates/css/iplastic.css +80 -0
  17. data/app_generators/bookmaker/templates/css/lazy.css +73 -0
  18. data/app_generators/bookmaker/templates/css/mac_classic.css +123 -0
  19. data/app_generators/bookmaker/templates/css/slush_poppies.css +85 -0
  20. data/app_generators/bookmaker/templates/css/sunburst.css +180 -0
  21. data/app_generators/bookmaker/templates/layouts/boom/layout.css +471 -0
  22. data/app_generators/bookmaker/templates/layouts/boom/layout.html +37 -0
  23. data/app_generators/bookmaker/templates/user.css +0 -0
  24. data/bin/bookmaker +17 -0
  25. data/config/hoe.rb +76 -0
  26. data/config/requirements.rb +15 -0
  27. data/lib/bookmaker.rb +18 -0
  28. data/lib/bookmaker/base.rb +319 -0
  29. data/lib/bookmaker/blackcloth.rb +165 -0
  30. data/lib/bookmaker/tasks.rb +112 -0
  31. data/lib/bookmaker/version.rb +9 -0
  32. data/script/console +10 -0
  33. data/script/destroy +14 -0
  34. data/script/generate +14 -0
  35. data/script/txt2html +82 -0
  36. data/setup.rb +1585 -0
  37. data/test/test_bookmaker.rb +11 -0
  38. data/test/test_bookmaker_generator.rb +43 -0
  39. data/test/test_generator_helper.rb +29 -0
  40. data/test/test_helper.rb +2 -0
  41. metadata +101 -0
data/History.txt ADDED
@@ -0,0 +1,41 @@
1
+ == 0.0.1 2008-06-06
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
5
+
6
+ == 0.0.2 2008-06-09
7
+ * 1 major enhancement
8
+ * Added textile support
9
+ * Bug fix
10
+ * Wrong require was throwing an error
11
+
12
+ == 0.0.3 2008-06-09
13
+ * Cleaning up the house
14
+ * README converted to Markdown
15
+ * 1 major enhancement
16
+ * Added syntax callback for Textile and Markdown
17
+
18
+ == 0.0.4 2008-06-12
19
+ * 1 major enhancement
20
+ * Added some textile helpers
21
+ * 1 bug fix
22
+ * Textile was escaping code inside <pre> blocks
23
+
24
+ == 0.0.5 2008-06-17
25
+ * 1 small changes
26
+ * Removed frontcover and backcover jpgs
27
+ * 1 bug fix
28
+ * Line stub (__) now ignores spaces and tabs
29
+
30
+ == 0.0.6 2008-06-20
31
+ * 1 major change
32
+ * All rake tasks moved to namespace 'book'
33
+ * 1 major enhancement
34
+ * Added task book:watch
35
+
36
+ == 0.0.7 2008-06-21
37
+ * 1 major enhancement
38
+ * Added Table of Contents based on h2-h6 tags
39
+ * Added `book:titles` rake task
40
+ * 1 small enhancement
41
+ * Added new Textile link tag (similar to Markdown)
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Nando Vieira
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,38 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.markdown
6
+ TODO.txt
7
+ Rakefile
8
+ app_generators/bookmaker/bookmaker_generator.rb
9
+ app_generators/bookmaker/templates/config.yml
10
+ app_generators/bookmaker/templates/Rakefile
11
+ app_generators/bookmaker/templates/user.css
12
+ app_generators/bookmaker/templates/layouts/boom/layout.html
13
+ app_generators/bookmaker/templates/layouts/boom/layout.css
14
+ app_generators/bookmaker/templates/css/active4d.css
15
+ app_generators/bookmaker/templates/css/blackboard.css
16
+ app_generators/bookmaker/templates/css/dawn.css
17
+ app_generators/bookmaker/templates/css/eiffel.css
18
+ app_generators/bookmaker/templates/css/idle.css
19
+ app_generators/bookmaker/templates/css/iplastic.css
20
+ app_generators/bookmaker/templates/css/lazy.css
21
+ app_generators/bookmaker/templates/css/mac_classic.css
22
+ app_generators/bookmaker/templates/css/slush_poppies.css
23
+ app_generators/bookmaker/templates/css/sunburst.css
24
+ bin/bookmaker
25
+ config/hoe.rb
26
+ config/requirements.rb
27
+ lib/bookmaker.rb
28
+ lib/bookmaker/version.rb
29
+ lib/bookmaker/base.rb
30
+ lib/bookmaker/tasks.rb
31
+ lib/bookmaker/blackcloth.rb
32
+ script/console
33
+ script/destroy
34
+ script/generate
35
+ script/txt2html
36
+ setup.rb
37
+ test/test_bookmaker.rb
38
+ test/test_helper.rb
data/PostInstall.txt ADDED
File without changes
data/README.markdown ADDED
@@ -0,0 +1,168 @@
1
+ Bookmaker
2
+ =========
3
+
4
+ * <http://github.com/fnando/bookmaker>
5
+
6
+ DESCRIPTION:
7
+ ------------
8
+
9
+ A framework for creating e-books from Markdown/Textile text markup using Ruby.
10
+ Using the Prince PDF generator, you'll be able to get high quality PDFs.
11
+ Mac users that have [Textmate](http://macromates.com) installed can have source
12
+ code highlighted with his/her favorite theme.
13
+
14
+ While Prince is too expensive (495USD for a single user license), the
15
+ free version available at <http://www.princexml.com/download/> generates
16
+ a PDF with a small logo on the first page, which is removed when sent
17
+ to a printer.
18
+
19
+ FEATURES:
20
+ ---------
21
+
22
+ * Write PDF using Markdown or Textile text markup
23
+ * Book layout support
24
+ * Syntax highlight theme based on Textmate
25
+ * Generate a PDF with a single rake task
26
+ * Table of Contents automatically generated from chapter titles
27
+
28
+ SYNOPSIS:
29
+ ---------
30
+
31
+ Create a new book with `bookmaker mybook`. Bookmaker has support for book
32
+ layout and syntax highlight theme. You can specify other settings:
33
+
34
+ bookmaker mybook --theme=mac_classic
35
+ bookmaker mybook --layout=boom
36
+
37
+ You can check available layouts and themes with `bookmaker --help`
38
+
39
+ The `bookmaker` command creates a directory "mybook" with the
40
+ following structure:
41
+
42
+ - book
43
+ - config.yml
44
+ - images
45
+ - output
46
+ - Rakefile
47
+ - templates
48
+ - layout.css
49
+ - layout.html
50
+ - syntax.css
51
+ - user.css
52
+ - text
53
+
54
+ The `config.yml` file holds some information about your book; so you'll always
55
+ change it. This is the default generated file:
56
+
57
+ title: [Your Book Title]
58
+ copyright: Copyright (c) 2008 [Your Name], All Rights Reserved
59
+ authors:
60
+ - [Your Name]
61
+ - [Other Name]
62
+ subject: [Write down what your book is about]
63
+ keywords: [The keywords related to your book]
64
+ theme: eiffel
65
+
66
+ If you're writing on a different language, the `user.css` file can override all
67
+ the messages added by the `layout.css`. Examples on doing this coming soon.
68
+
69
+ Now it's time to write your book. All your book content will be placed on the
70
+ text directory. Bookmaker requires you to separate your book into chapters.
71
+ A chapter is nothing but a directory that holds lots of Markdown/Textile files.
72
+ The book will be generated using every folder/file alphabetically. So be sure
73
+ to use a sequential numbering as the name. Here's a sample:
74
+
75
+ - text
76
+ - 01_Introduction
77
+ - 01\_introduction.markdown
78
+ - 02\_What\_is\_Ruby\_on\_Rails
79
+ - 01\_MVC.markdown
80
+ - 02\_DRY.markdown
81
+ - 03\_Convention\_Over\_Configuration.markdown
82
+ - 03\_Installing\_Ruby\_on\_Rails
83
+ - 01\_Installing.textile
84
+ - 02\_Mac\_OS\_X\_instructions.textile
85
+ - 03\_Windows\_instructions.markdown
86
+ - 04\_Ubuntu\_Linux\_instructions.markdown
87
+
88
+ Note that you can use Textile or Markdown at the same time. Just use the
89
+ `.markdown` or `.textile` file extension.
90
+
91
+ You'll want to see your progress eventually; it's time for you to generate
92
+ the book PDF. Just run the command `rake book:pdf` and your book will be
93
+ created on the output directory.
94
+
95
+ There are other rake tasks you can use:
96
+
97
+ * `book:html` - generate a html from your content
98
+ * `book:syntaxes` - list all available syntaxes
99
+ * `book:themes` - list all available themes
100
+ * `book:titles` - list all titles and its permalinks
101
+ * `book:watch` - watch `text` for any change and automatically generate html
102
+
103
+ Bookmaker can generate a Table of Contents (TOC) based on your h2-h6 tags. The
104
+ h1 tag is discarded because it's meant to be the book title.
105
+
106
+ If you need to link to a specific chapter, you can use the `book:titles` rake
107
+ task to know what's the permalink that you need. For example, a title
108
+ `Installing Mac OS X` will have a permalink `installing-mac-os-x` and you can
109
+ link to this chapter by writing
110
+ `"See more on Installing Mac OS X":#installing-mac-os-x` when using
111
+ Textile.
112
+
113
+ To generate the TOC, you need to print a variable called `toc`, using the eRb
114
+ tag `<%= toc %>`.
115
+
116
+ INSTALL:
117
+ --------
118
+
119
+ You need to install some gems before you go any further.
120
+
121
+ sudo gem install rubigen
122
+ sudo gem install discount
123
+ sudo gem install RedCloth
124
+
125
+ If you're a Mac user and have Textmate installed, you can
126
+ generate HTML from your source code with syntax highlight,
127
+ the same way you see in Textmate. First, you need to install
128
+ Oniguruma regular expression library that can be found at
129
+ <http://www.geocities.jp/kosako3/oniguruma/>
130
+
131
+ Then, you need to install the Ultraviolet gem.
132
+
133
+ sudo gem install ultraviolet
134
+
135
+ REFERENCES:
136
+ -----------
137
+
138
+ - Textile: <http://hobix.com/textile/>
139
+ - Markdown: <http://daringfireball.net/projects/markdown/syntax>
140
+
141
+ MAINTAINER
142
+ ----------
143
+
144
+ * Nando Vieira (<http://simplesideias.com.br>)
145
+
146
+ LICENSE:
147
+ --------
148
+
149
+ (The MIT License)
150
+
151
+ Permission is hereby granted, free of charge, to any person obtaining
152
+ a copy of this software and associated documentation files (the
153
+ 'Software'), to deal in the Software without restriction, including
154
+ without limitation the rights to use, copy, modify, merge, publish,
155
+ distribute, sublicense, and/or sell copies of the Software, and to
156
+ permit persons to whom the Software is furnished to do so, subject to
157
+ the following conditions:
158
+
159
+ The above copyright notice and this permission notice shall be
160
+ included in all copies or substantial portions of the Software.
161
+
162
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
163
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
164
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
165
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
166
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
167
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
168
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/TODO.txt ADDED
@@ -0,0 +1,2 @@
1
+ - Create additional layouts
2
+ - Support Linux and Windows (Linux is probably already supported, but need testing to be sure)
@@ -0,0 +1,68 @@
1
+ require 'bookmaker'
2
+
3
+ class BookmakerGenerator < RubiGen::Base
4
+
5
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6
+ Config::CONFIG['ruby_install_name'])
7
+
8
+ default_options :theme => Bookmaker::Base.default_theme,
9
+ :layout => Bookmaker::Base.default_layout
10
+ attr_reader :theme, :layout
11
+
12
+ def initialize(runtime_args, runtime_options = {})
13
+ super
14
+ usage if args.empty?
15
+ @destination_root = File.expand_path(args.shift)
16
+ @name = base_name
17
+ extract_options
18
+ end
19
+
20
+ def manifest
21
+ record do |m|
22
+ m.directory ''
23
+ BASEDIRS.each { |path| m.directory path }
24
+
25
+ m.template "Rakefile", "Rakefile"
26
+ m.template "user.css", "templates/user.css"
27
+ m.template "layouts/#{@layout}/layout.css", "templates/layout.css"
28
+ m.template "layouts/#{@layout}/layout.html", "templates/layout.html"
29
+ m.template "css/#{@theme}.css", "templates/syntax.css"
30
+ m.template "config.yml", "config.yml", :assigns => {:theme => @theme}
31
+ end
32
+ end
33
+
34
+ protected
35
+ def banner
36
+ <<-EOS
37
+ The 'bookmaker' command creates a new book with a default
38
+ directory structure at the path you specify.
39
+
40
+ USAGE: #{spec.name} /path/to/your/book [options]
41
+ EOS
42
+ end
43
+
44
+ def add_options!(opts)
45
+ opts.separator ''
46
+ opts.separator 'Options:'
47
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
48
+ opts.on("--layout=LAYOUT_NAME", String,
49
+ "Define the book layout (#{Bookmaker::Base.layouts.join('|')})",
50
+ "Default: #{Bookmaker::Base.default_layout}") { |x| options[:layout] = x }
51
+ opts.on("--theme=THEME_NAME", String,
52
+ "Define the syntax highlight theme (#{Bookmaker::Base.themes.join('|')})",
53
+ "Default: #{Bookmaker::Base.default_theme}") { |x| options[:theme] = x } if RUBY_PLATFORM =~ /darwin/
54
+ end
55
+
56
+ def extract_options
57
+ @theme = options[:theme]
58
+ @layout = options[:layout]
59
+ end
60
+
61
+ BASEDIRS = %w(
62
+ templates
63
+ text
64
+ output
65
+ images
66
+ code
67
+ )
68
+ end
@@ -0,0 +1,3 @@
1
+ BOOKMAKER_ROOT = File.dirname(__FILE__)
2
+ ENV['BOOKMAKER_NAME'] ||= File.basename(BOOKMAKER_ROOT)
3
+ require "bookmaker/tasks"
@@ -0,0 +1,8 @@
1
+ title: [Your Book Title]
2
+ copyright: Copyright (c) <%= Time.now.year %> [Your Name], All Rights Reserved
3
+ authors:
4
+ - [Your Name]
5
+ - [Other Name]
6
+ subject: [Write down what your book is about]
7
+ keywords: [The keywords related to your book]
8
+ theme: <%= theme %>
@@ -0,0 +1,114 @@
1
+ pre.active4d .DiffHeader {
2
+ background-color: #656565;
3
+ color: #FFFFFF;
4
+ }
5
+ pre.active4d .Operator {
6
+ }
7
+ pre.active4d .InheritedClass {
8
+ }
9
+ pre.active4d .TypeName {
10
+ color: #21439C;
11
+ }
12
+ pre.active4d .Number {
13
+ color: #A8017E;
14
+ }
15
+ pre.active4d .EmbeddedSource {
16
+ background-color: #ECF1FF;
17
+ }
18
+ pre.active4d {
19
+ background-color: #FFFFFF;
20
+ color: #000000;
21
+ }
22
+ pre.active4d .DiffInsertedLine {
23
+ background-color: #98FF9A;
24
+ color: #000000;
25
+ }
26
+ pre.active4d .LibraryVariable {
27
+ color: #A535AE;
28
+ }
29
+ pre.active4d .Storage {
30
+ color: #FF5600;
31
+ }
32
+ pre.active4d .InterpolatedEntity {
33
+ font-weight: bold;
34
+ color: #66CCFF;
35
+ }
36
+ pre.active4d .line-numbers {
37
+ background-color: #BAD6FD;
38
+ color: #000000;
39
+ }
40
+ pre.active4d .LocalVariable {
41
+ font-weight: bold;
42
+ color: #6392FF;
43
+ }
44
+ pre.active4d .DiffLineRange {
45
+ background-color: #1B63FF;
46
+ color: #FFFFFF;
47
+ }
48
+ pre.active4d .BlockComment {
49
+ color: #D33435;
50
+ }
51
+ pre.active4d .TagName {
52
+ color: #016CFF;
53
+ }
54
+ pre.active4d .FunctionArgument {
55
+ }
56
+ pre.active4d .BuiltInConstant {
57
+ color: #A535AE;
58
+ }
59
+ pre.active4d .LineComment {
60
+ color: #D33535;
61
+ }
62
+ pre.active4d .DiffDeletedLine {
63
+ background-color: #FF7880;
64
+ color: #000000;
65
+ }
66
+ pre.active4d .NamedConstant {
67
+ color: #B7734C;
68
+ }
69
+ pre.active4d .CommandMethod {
70
+ font-weight: bold;
71
+ color: #45AE34;
72
+ }
73
+ pre.active4d .TableField {
74
+ color: #0BB600;
75
+ }
76
+ pre.active4d .PlainXmlText {
77
+ color: #000000;
78
+ }
79
+ pre.active4d .Invalid {
80
+ background-color: #990000;
81
+ color: #FFFFFF;
82
+ }
83
+ pre.active4d .LibraryClassType {
84
+ color: #A535AE;
85
+ }
86
+ pre.active4d .TagAttribute {
87
+ color: #963DFF;
88
+ }
89
+ pre.active4d .Keyword {
90
+ font-weight: bold;
91
+ color: #006699;
92
+ }
93
+ pre.active4d .UserDefinedConstant {
94
+ }
95
+ pre.active4d .String {
96
+ color: #666666;
97
+ }
98
+ pre.active4d .DiffUnchangedLine {
99
+ color: #5E5E5E;
100
+ }
101
+ pre.active4d .TagContainer {
102
+ color: #7A7A7A;
103
+ }
104
+ pre.active4d .FunctionName {
105
+ color: #21439C;
106
+ }
107
+ pre.active4d .Variable {
108
+ font-weight: bold;
109
+ color: #0053FF;
110
+ }
111
+ pre.active4d .DateTimeLiteral {
112
+ font-weight: bold;
113
+ color: #66CCFF;
114
+ }