booky 0.0.1 → 0.0.2
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.
- data/README.textile +6 -2
- data/lib/booky/docbook.rb +2 -2
- data/lib/booky/version.rb +1 -1
- data/lib/booky.rb +38 -1
- data/lib/examples/bibliography.textile +23 -0
- data/lib/examples/chapters.textile +25 -0
- data/lib/examples/cover.textile +13 -0
- data/lib/examples/footnotes.textile +10 -0
- data/lib/examples/formatting.textile +12 -0
- data/lib/examples/images.textile +7 -0
- data/lib/examples/lists.textile +11 -0
- data/lib/examples/phrases.textile +19 -0
- data/lib/examples/source.textile +17 -0
- data/lib/examples/tables.textile +9 -0
- metadata +14 -4
data/README.textile
CHANGED
@@ -13,6 +13,10 @@ run it through booky like this:
|
|
13
13
|
|
14
14
|
bc.. booky create sample
|
15
15
|
|
16
|
-
|
16
|
+
h2. Help
|
17
17
|
|
18
|
-
Simply run @booky help@ to get further information.
|
18
|
+
Simply run @booky help@ to get further information.
|
19
|
+
|
20
|
+
h2. Examples
|
21
|
+
|
22
|
+
Simply run @booky examples@ to see formatting examples of images, tables, lists, bibliography, etc.
|
data/lib/booky/docbook.rb
CHANGED
@@ -2,9 +2,9 @@ module Booky::Docbook
|
|
2
2
|
|
3
3
|
def self.create
|
4
4
|
puts "\n-> Creating Docbook XML"
|
5
|
-
raise "File #{Booky.
|
5
|
+
raise "File #{Booky.source} not found. Sorry" if !File.exists?("#{Booky.source}")
|
6
6
|
|
7
|
-
textile = File.open("#{Booky.
|
7
|
+
textile = File.open("#{Booky.source}", 'rb') { |f| f.read }
|
8
8
|
File.open("#{Booky.name}.xml", 'w') {|f| f.write(RedCloth.new(textile).to_docbook) }
|
9
9
|
|
10
10
|
puts "Done.\n"
|
data/lib/booky/version.rb
CHANGED
data/lib/booky.rb
CHANGED
@@ -9,6 +9,7 @@ module Booky
|
|
9
9
|
require 'booky/fo'
|
10
10
|
require 'booky/pdf'
|
11
11
|
|
12
|
+
@@source = nil
|
12
13
|
@@name = nil
|
13
14
|
|
14
15
|
# initial dispatch
|
@@ -59,7 +60,19 @@ module Booky
|
|
59
60
|
Custom Fonts Add them to the #{Booky.root}/lib/fonts folder
|
60
61
|
Layout Tweaking Modify #{Booky.root}/lib/stylesheets/fo/param.xsl
|
61
62
|
|
62
|
-
|
63
|
+
Examples:
|
64
|
+
booky examples Shows a list of all commands that can be used inside textile documents
|
65
|
+
booky examples formatting Formatting Examples
|
66
|
+
booky examples cover Cover Page Examples
|
67
|
+
booky examples chapters Chapter Examples
|
68
|
+
booky examples footnotes Footnote Examples
|
69
|
+
booky examples images Images Examples
|
70
|
+
booky examples tables Table Examples
|
71
|
+
booky examples phrases Phrase Examples
|
72
|
+
booky examples lists Lists Examples
|
73
|
+
booky examples source Source Examples
|
74
|
+
booky examples bibliography Bibliography Examples
|
75
|
+
|
63
76
|
)
|
64
77
|
end
|
65
78
|
|
@@ -68,6 +81,22 @@ module Booky
|
|
68
81
|
puts "Booky #{Booky::VERSION}"
|
69
82
|
end
|
70
83
|
|
84
|
+
# examples
|
85
|
+
def self.examples
|
86
|
+
examples = ['formatting', 'cover', 'chapters', 'footnotes', 'images', 'tables', 'phrases', 'lists', 'source', 'bibliography']
|
87
|
+
|
88
|
+
if Booky.name.nil?
|
89
|
+
puts "\n\nBooky Examples: Please select one of the following categories:\n\n"
|
90
|
+
examples.each { |example| puts " -> #{example}" }
|
91
|
+
puts "\n\n"
|
92
|
+
return
|
93
|
+
end
|
94
|
+
|
95
|
+
puts "\n\nBooky Example for #{Booky.name.capitalize}\n\n\n"
|
96
|
+
puts File.open("lib/examples/#{Booky.name}.textile", 'rb') { |f| f.read }
|
97
|
+
puts "\n\n"
|
98
|
+
end
|
99
|
+
|
71
100
|
# clear byproducts
|
72
101
|
def self.clear
|
73
102
|
if @@name.nil?
|
@@ -84,6 +113,11 @@ module Booky
|
|
84
113
|
@@name
|
85
114
|
end
|
86
115
|
|
116
|
+
# book source
|
117
|
+
def self.source
|
118
|
+
@@source
|
119
|
+
end
|
120
|
+
|
87
121
|
def self.root
|
88
122
|
"#{__FILE__}".gsub("/lib/booky.rb", "")
|
89
123
|
end
|
@@ -91,8 +125,11 @@ module Booky
|
|
91
125
|
private
|
92
126
|
def self.setup name
|
93
127
|
return if name.nil?
|
128
|
+
@@source = name
|
94
129
|
@@name = name
|
95
130
|
@@name = @@name.gsub(".textile", "")
|
131
|
+
@@name = @@name.gsub(".txt", "")
|
132
|
+
@@name = @@name.gsub(".text", "")
|
96
133
|
@@name = @@name.gsub(".xml", "")
|
97
134
|
@@name = @@name.gsub(".fo", "")
|
98
135
|
@@name = @@name.gsub(".pdf", "")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
h1. Bibliography
|
2
|
+
|
3
|
+
h2. Referencing
|
4
|
+
|
5
|
+
Look at ??BernersLee?? for more information.
|
6
|
+
|
7
|
+
Look at ??Coleman?? for more information.
|
8
|
+
|
9
|
+
h2. Bibliography
|
10
|
+
|
11
|
+
h3{id:BernersLee}. Tim Berners Lee: The Web Reinvented
|
12
|
+
|
13
|
+
Addison Wesley 2003
|
14
|
+
|
15
|
+
Page 20-40
|
16
|
+
|
17
|
+
h3{id:Coleman}. Jones Coleman: Cummulated Chaos
|
18
|
+
|
19
|
+
Wembley 2003
|
20
|
+
|
21
|
+
Page 20-40
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
h1. Chapter 1
|
2
|
+
|
3
|
+
Some chapter text
|
4
|
+
|
5
|
+
h2. Sub Heading 1
|
6
|
+
|
7
|
+
Some sub text
|
8
|
+
|
9
|
+
h3. SubSub Heading 1
|
10
|
+
|
11
|
+
Some text
|
12
|
+
|
13
|
+
h4. SubSubSub Heading 1
|
14
|
+
|
15
|
+
Some more text
|
16
|
+
|
17
|
+
h2. Sub Heading 2
|
18
|
+
|
19
|
+
Some more sub text sub text
|
20
|
+
|
21
|
+
Even Some more sub text sub text
|
22
|
+
|
23
|
+
h1. Chapter 2
|
24
|
+
|
25
|
+
A little text
|
@@ -0,0 +1,19 @@
|
|
1
|
+
h1. Phrases
|
2
|
+
|
3
|
+
h2. Basic
|
4
|
+
|
5
|
+
I _believe_ every word.
|
6
|
+
|
7
|
+
I __believe__ every word.
|
8
|
+
|
9
|
+
This is a *bold* sentence.
|
10
|
+
|
11
|
+
This is a **bold** sentence.
|
12
|
+
|
13
|
+
??LKing?? was said by Martin Luther King.
|
14
|
+
|
15
|
+
Simply run @rake db:migrate@ to install everything.
|
16
|
+
|
17
|
+
Simply got to "Google":http://www.google.com and search.
|
18
|
+
|
19
|
+
bq{by: Martin Luther King}. I have a dream. The dream is great. It will come true!
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thomas Fankhauser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-24 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -73,6 +73,16 @@ files:
|
|
73
73
|
- lib/booky/pdf.rb
|
74
74
|
- lib/booky/version.rb
|
75
75
|
- lib/custom_fonts.xml
|
76
|
+
- lib/examples/bibliography.textile
|
77
|
+
- lib/examples/chapters.textile
|
78
|
+
- lib/examples/cover.textile
|
79
|
+
- lib/examples/footnotes.textile
|
80
|
+
- lib/examples/formatting.textile
|
81
|
+
- lib/examples/images.textile
|
82
|
+
- lib/examples/lists.textile
|
83
|
+
- lib/examples/phrases.textile
|
84
|
+
- lib/examples/source.textile
|
85
|
+
- lib/examples/tables.textile
|
76
86
|
- lib/fonts/Ubuntu-B.ttf
|
77
87
|
- lib/fonts/Ubuntu-BI.ttf
|
78
88
|
- lib/fonts/Ubuntu-L.ttf
|