booky 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
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
- p. Help
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.name}.textile not found. Sorry" if !File.exists?("#{Booky.name}.textile")
5
+ raise "File #{Booky.source} not found. Sorry" if !File.exists?("#{Booky.source}")
6
6
 
7
- textile = File.open("#{Booky.name}.textile", 'rb') { |f| f.read }
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
@@ -1,3 +1,3 @@
1
1
  module Booky
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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,13 @@
1
+ title. Super Social Everybody
2
+
3
+ subtitle. How to Survive in the Social Web
4
+
5
+ author. Thomas Fankhauser
6
+
7
+ copyright. 2010, Norman Walsh, All rights reserved.
8
+
9
+
10
+ h0. Foreword
11
+
12
+ This is the place for the foreword
13
+
@@ -0,0 +1,10 @@
1
+ h1. Footnotes
2
+
3
+ h2. Basic
4
+
5
+ fn1. Sentence is a collection of words
6
+
7
+ fn2. A note at the food of the page
8
+
9
+ This sentence[1] needs a footnote[2].
10
+
@@ -0,0 +1,12 @@
1
+ h1. Hello
2
+
3
+ h2. Basic
4
+
5
+ They're so cool!
6
+
7
+
8
+ This is some text that
9
+ continues in the second line.
10
+
11
+ This is some text that
12
+ continues in the second line.
@@ -0,0 +1,7 @@
1
+ h1. Images
2
+
3
+ h2. Basic
4
+
5
+ !../images/image.png(A great image)!
6
+
7
+ !{width: 90%;}../images/image.png(A great image)!
@@ -0,0 +1,11 @@
1
+ h1. Lists
2
+
3
+ h2. Basic
4
+
5
+ * A bullet list 1
6
+ * A bullet list 2
7
+ * A bullet list 3
8
+
9
+ # A numbered list 1
10
+ # A numbered list 2
11
+ # A numbered list 3
@@ -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!
@@ -0,0 +1,17 @@
1
+ h1. Source Code
2
+
3
+ h2. Basic
4
+
5
+ some text
6
+
7
+ bc{name: Ruby Car Class;}.. class Car
8
+
9
+ def start_engine
10
+ end
11
+
12
+ def stop_engine
13
+ end
14
+
15
+ end
16
+
17
+ p. Another paragraph
@@ -0,0 +1,9 @@
1
+ h1. Tables
2
+
3
+ h2. Basic
4
+
5
+ table{name:Attendees; cols:3; align: left;}.
6
+ |_. Name |_. Age |_. Sex |
7
+ | Joan | 24 | F |
8
+ | Archie | 29 | M |
9
+ | Bello | 45 | F |
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
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-10-17 00:00:00 +02:00
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