fnando-kitabu 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/README.markdown +7 -0
  2. data/Rakefile +55 -35
  3. data/bin/kitabu +42 -13
  4. data/kitabu.gemspec +28 -55
  5. data/lib/kitabu/base.rb +38 -14
  6. data/lib/kitabu/blackcloth.rb +1 -10
  7. data/lib/kitabu/templates.rb +49 -0
  8. data/lib/kitabu.rb +9 -12
  9. data/{app_generators/kitabu/templates → templates}/Rakefile +0 -0
  10. data/{app_generators/kitabu/templates → templates}/config.yml +0 -0
  11. data/{app_generators/kitabu/templates → templates}/layouts/boom/layout.css +0 -0
  12. data/{app_generators/kitabu/templates → templates}/layouts/boom/layout.html +8 -8
  13. data/templates/syntax.css +1065 -0
  14. data/{app_generators/kitabu/templates/css → templates/themes}/active4d.css +0 -0
  15. data/{app_generators/kitabu/templates/css → templates/themes}/blackboard.css +0 -0
  16. data/{app_generators/kitabu/templates/css → templates/themes}/dawn.css +0 -0
  17. data/{app_generators/kitabu/templates/css → templates/themes}/eiffel.css +0 -0
  18. data/{app_generators/kitabu/templates/css → templates/themes}/idle.css +0 -0
  19. data/{app_generators/kitabu/templates/css → templates/themes}/iplastic.css +0 -0
  20. data/{app_generators/kitabu/templates/css → templates/themes}/lazy.css +0 -0
  21. data/{app_generators/kitabu/templates/css → templates/themes}/mac_classic.css +0 -0
  22. data/{app_generators/kitabu/templates/css → templates/themes}/slush_poppies.css +0 -0
  23. data/{app_generators/kitabu/templates/css → templates/themes}/sunburst.css +0 -0
  24. data/templates/user.css +1 -0
  25. metadata +26 -52
  26. data/History.txt +0 -67
  27. data/License.txt +0 -20
  28. data/TODO.txt +0 -2
  29. data/app_generators/kitabu/USAGE +0 -5
  30. data/app_generators/kitabu/kitabu_generator.rb +0 -68
  31. data/app_generators/kitabu/templates/user.css +0 -0
  32. data/themes/active4d.css +0 -114
  33. data/themes/all_hallows_eve.css +0 -72
  34. data/themes/amy.css +0 -147
  35. data/themes/blackboard.css +0 -88
  36. data/themes/brilliance_black.css +0 -605
  37. data/themes/brilliance_dull.css +0 -599
  38. data/themes/cobalt.css +0 -149
  39. data/themes/dawn.css +0 -121
  40. data/themes/eiffel.css +0 -121
  41. data/themes/espresso_libre.css +0 -109
  42. data/themes/idle.css +0 -62
  43. data/themes/iplastic.css +0 -80
  44. data/themes/lazy.css +0 -73
  45. data/themes/mac_classic.css +0 -123
  46. data/themes/magicwb_amiga.css +0 -104
  47. data/themes/pastels_on_dark.css +0 -188
  48. data/themes/slush_poppies.css +0 -85
  49. data/themes/spacecadet.css +0 -51
  50. data/themes/sunburst.css +0 -180
  51. data/themes/twilight.css +0 -137
  52. data/themes/zenburnesque.css +0 -91
data/README.markdown CHANGED
@@ -85,6 +85,13 @@ to use a sequential numbering as the name. Here's a sample:
85
85
  - 03\_Windows\_instructions.markdown
86
86
  - 04\_Ubuntu\_Linux\_instructions.markdown
87
87
 
88
+ If you prefer, you can add a chapter per file:
89
+
90
+ - text
91
+ - 01\_Introduction.markdown
92
+ - 02\_What\_is\_Ruby\_on\_Rails.markdown
93
+ - 03\_Installing\_Ruby\_on\_Rails.markdown
94
+
88
95
  Note that you can use Textile or Markdown at the same time. Just use the
89
96
  `.markdown` or `.textile` file extension.
90
97
 
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'rake'
2
2
 
3
- PKG_FILES = %w( Rakefile kitabu.gemspec History.txt License.txt README.markdown TODO.txt ) + Dir["{app_generators,bin,lib,themes}/**/*"]
3
+ PKG_FILES = %w(Rakefile kitabu.gemspec README.markdown) + Dir["{bin,lib,templates}/**/*"]
4
4
 
5
5
  spec = Gem::Specification.new do |s|
6
6
  s.name = "kitabu"
7
- s.version = "0.2.1"
7
+ s.version = "0.3.0"
8
8
  s.summary = "A framework for creating e-books from Markdown/Textile text markup using Ruby."
9
9
  s.authors = ["Nando Vieira"]
10
10
  s.email = ["fnando.vieira@gmail.com"]
@@ -16,10 +16,11 @@ spec = Gem::Specification.new do |s|
16
16
  s.executables = "kitabu"
17
17
 
18
18
  # Dependencies
19
- s.add_dependency "rubigen"
20
19
  s.add_dependency "discount"
21
20
  s.add_dependency "hpricot"
22
21
  s.add_dependency "unicode"
22
+ s.add_dependency "main"
23
+
23
24
  # Requirements
24
25
  s.requirements << "Install the Oniguruma RE library and ultraviolet gem to get Syntax Highlighting (only for TextMate users)"
25
26
  end
@@ -27,42 +28,61 @@ end
27
28
  namespace :gem do
28
29
  # Thanks to the Merb project for this code.
29
30
  desc "Update Github Gemspec"
30
- task :update_gemspec do
31
- skip_fields = %w(new_platform original_platform specification_version loaded required_ruby_version rubygems_version platform )
31
+ task :update_gemspec do
32
+ skip_fields = %w(new_platform original_platform specification_version loaded required_ruby_version rubygems_version platform )
33
+
34
+ result = "# WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!\n"
35
+ result << "# RUN : 'rake gem:update_gemspec'\n\n"
36
+ result << "Gem::Specification.new do |s|\n"
37
+
38
+ spec.instance_variables.each do |ivar|
39
+ value = spec.instance_variable_get(ivar)
40
+ name = ivar.split("@").last
41
+ next if name == "date"
32
42
 
33
- result = "# WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!\n"
34
- result << "# RUN : 'rake gem:update_gemspec'\n\n"
35
- result << "Gem::Specification.new do |s|\n"
43
+ if name == 'version'
44
+ base_file = File.join(File.dirname(__FILE__), 'lib/kitabu/base.rb')
45
+ contents = File.read(base_file)
46
+ contents.gsub!(/VERSION = "[\d\.]+"/sim, %(VERSION = "#{value}"))
47
+ File.open(base_file, 'w+') do |f|
48
+ f << contents
49
+ end
50
+ end
36
51
 
37
- spec.instance_variables.each do |ivar|
38
- value = spec.instance_variable_get(ivar)
39
- name = ivar.split("@").last
40
- value = Time.now if name == "date"
41
-
42
- next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
43
- if name == "dependencies"
44
- value.each do |d|
45
- dep, *ver = d.to_s.split(" ")
46
- result << " s.add_dependency #{dep.inspect}, #{ver.join(" ").inspect.gsub(/[()]/, "").gsub(", runtime", "")}\n"
47
- end
52
+ next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
53
+ if name == "dependencies"
54
+ value.each do |d|
55
+ dep, *ver = d.to_s.split(" ")
56
+ result << " s.add_dependency #{dep.inspect}, #{ver.join(" ").inspect.gsub(/[()]/, "").gsub(", runtime", "")}\n"
57
+ end
58
+ else
59
+ case value
60
+ when Array
61
+ value = name != "files" ? value.inspect : value.inspect.split(",").join(",\n")
62
+ when FalseClass
63
+ when TrueClass
64
+ when Fixnum
65
+ when String
66
+ value = value.inspect
48
67
  else
49
- case value
50
- when Array
51
- value = name != "files" ? value.inspect : value.inspect.split(",").join(",\n")
52
- when FalseClass
53
- when TrueClass
54
- when Fixnum
55
- when String
56
- value = value.inspect
57
- else
58
- value = value.to_s.inspect
59
- end
60
- result << " s.#{name} = #{value}\n"
68
+ value = value.to_s.inspect
61
69
  end
70
+ result << " s.#{name} = #{value}\n"
62
71
  end
63
-
64
- result << "end"
65
- File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
66
72
  end
67
-
73
+
74
+ result << "end"
75
+ File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
76
+ end
77
+
78
+ desc "Build gem"
79
+ task :build => :update_gemspec do
80
+ system "rm *.gem"
81
+ system "gem build #{spec.instance_variable_get('@name')}.gemspec"
82
+ end
83
+
84
+ desc "Install gem"
85
+ task :install => :build do
86
+ system "sudo gem install #{spec.instance_variable_get('@name')}"
87
+ end
68
88
  end
data/bin/kitabu CHANGED
@@ -1,17 +1,46 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require 'rubigen'
4
+ require 'kitabu'
5
+ require 'kitabu/templates'
6
+ require 'main'
5
7
 
6
- if %w(-v --version).include? ARGV.first
7
- require 'kitabu/version'
8
- puts "#{File.basename($0)} #{Kitabu::VERSION::STRING}"
9
- exit(0)
10
- end
11
-
12
- require 'rubigen/scripts/generate'
13
- source = RubiGen::PathSource.new(:application,
14
- File.join(File.dirname(__FILE__), "../app_generators"))
15
- RubiGen::Base.reset_sources
16
- RubiGen::Base.append_sources source
17
- RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'kitabu')
8
+ Main {
9
+ description <<-TXT
10
+ The 'kitabu' command creates a new book with a default
11
+ directory structure at the path you specify.
12
+
13
+ VERSION: #{Kitabu::VERSION}
14
+
15
+ USAGE: kitabu path [parameters]
16
+ TXT
17
+
18
+ argument(:path) {
19
+ description "The output path."
20
+ required
21
+ validate {|path| !File.exists?(path) }
22
+ attr
23
+ }
24
+
25
+ option(:l, :layout){
26
+ description "Specify which layout to use. Available: #{Kitabu::Base.layouts.join(', ')}"
27
+ cast :string
28
+ defaults "boom"
29
+ argument :optional
30
+ validate {|layout| Kitabu::Base.layout?(layout) }
31
+ attr
32
+ }
33
+
34
+ option(:t, :theme){
35
+ description "Specify which syntax highlight theme to use. Available: #{Kitabu::Base.themes.join(', ')}"
36
+ cast :string
37
+ defaults "eiffel"
38
+ argument :optional
39
+ validate {|theme| Kitabu::Base.theme?(theme) }
40
+ attr
41
+ }
42
+
43
+ def run
44
+ Kitabu::Templates.process!(:layout => layout, :theme => theme, :path => path)
45
+ end
46
+ }
data/kitabu.gemspec CHANGED
@@ -2,78 +2,51 @@
2
2
  # RUN : 'rake gem:update_gemspec'
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.date = "Sun Aug 24 17:34:59 -0300 2008"
6
- s.executables = ["kitabu"]
7
5
  s.authors = ["Nando Vieira"]
6
+ s.require_paths = ["lib"]
8
7
  s.required_rubygems_version = ">= 0"
9
- s.version = "0.2.1"
8
+ s.has_rdoc = false
10
9
  s.files = ["Rakefile",
11
10
  "kitabu.gemspec",
12
- "History.txt",
13
- "License.txt",
14
11
  "README.markdown",
15
- "TODO.txt",
16
- "app_generators/kitabu",
17
- "app_generators/kitabu/kitabu_generator.rb",
18
- "app_generators/kitabu/templates",
19
- "app_generators/kitabu/templates/config.yml",
20
- "app_generators/kitabu/templates/css",
21
- "app_generators/kitabu/templates/css/active4d.css",
22
- "app_generators/kitabu/templates/css/blackboard.css",
23
- "app_generators/kitabu/templates/css/dawn.css",
24
- "app_generators/kitabu/templates/css/eiffel.css",
25
- "app_generators/kitabu/templates/css/idle.css",
26
- "app_generators/kitabu/templates/css/iplastic.css",
27
- "app_generators/kitabu/templates/css/lazy.css",
28
- "app_generators/kitabu/templates/css/mac_classic.css",
29
- "app_generators/kitabu/templates/css/slush_poppies.css",
30
- "app_generators/kitabu/templates/css/sunburst.css",
31
- "app_generators/kitabu/templates/layouts",
32
- "app_generators/kitabu/templates/layouts/boom",
33
- "app_generators/kitabu/templates/layouts/boom/layout.css",
34
- "app_generators/kitabu/templates/layouts/boom/layout.html",
35
- "app_generators/kitabu/templates/Rakefile",
36
- "app_generators/kitabu/templates/user.css",
37
- "app_generators/kitabu/USAGE",
38
12
  "bin/kitabu",
39
13
  "lib/kitabu",
40
14
  "lib/kitabu/base.rb",
41
15
  "lib/kitabu/blackcloth.rb",
42
16
  "lib/kitabu/redcloth.rb",
43
17
  "lib/kitabu/tasks.rb",
18
+ "lib/kitabu/templates.rb",
44
19
  "lib/kitabu.rb",
45
- "themes/active4d.css",
46
- "themes/all_hallows_eve.css",
47
- "themes/amy.css",
48
- "themes/blackboard.css",
49
- "themes/brilliance_black.css",
50
- "themes/brilliance_dull.css",
51
- "themes/cobalt.css",
52
- "themes/dawn.css",
53
- "themes/eiffel.css",
54
- "themes/espresso_libre.css",
55
- "themes/idle.css",
56
- "themes/iplastic.css",
57
- "themes/lazy.css",
58
- "themes/mac_classic.css",
59
- "themes/magicwb_amiga.css",
60
- "themes/pastels_on_dark.css",
61
- "themes/slush_poppies.css",
62
- "themes/spacecadet.css",
63
- "themes/sunburst.css",
64
- "themes/twilight.css",
65
- "themes/zenburnesque.css"]
66
- s.has_rdoc = false
67
- s.requirements = ["Install the Oniguruma RE library and ultraviolet gem to get Syntax Highlighting (only for TextMate users)"]
20
+ "templates/config.yml",
21
+ "templates/layouts",
22
+ "templates/layouts/boom",
23
+ "templates/layouts/boom/layout.css",
24
+ "templates/layouts/boom/layout.html",
25
+ "templates/Rakefile",
26
+ "templates/syntax.css",
27
+ "templates/themes",
28
+ "templates/themes/active4d.css",
29
+ "templates/themes/blackboard.css",
30
+ "templates/themes/dawn.css",
31
+ "templates/themes/eiffel.css",
32
+ "templates/themes/idle.css",
33
+ "templates/themes/iplastic.css",
34
+ "templates/themes/lazy.css",
35
+ "templates/themes/mac_classic.css",
36
+ "templates/themes/slush_poppies.css",
37
+ "templates/themes/sunburst.css",
38
+ "templates/user.css"]
68
39
  s.email = ["fnando.vieira@gmail.com"]
69
- s.name = "kitabu"
70
- s.bindir = "bin"
40
+ s.version = "0.3.0"
71
41
  s.homepage = "http://github.com/fnando/kitabu"
42
+ s.requirements = ["Install the Oniguruma RE library and ultraviolet gem to get Syntax Highlighting (only for TextMate users)"]
43
+ s.name = "kitabu"
72
44
  s.summary = "A framework for creating e-books from Markdown/Textile text markup using Ruby."
45
+ s.executables = ["kitabu"]
73
46
  s.description = "A framework for creating e-books from Markdown/Textile text markup using Ruby. Using the Prince PDF generator, you'll be able to get high quality PDFs. Mac users that have Textmate installed can have source code highlighted with his favorite theme."
74
- s.add_dependency "rubigen", ">= 0"
75
47
  s.add_dependency "discount", ">= 0"
76
48
  s.add_dependency "hpricot", ">= 0"
77
49
  s.add_dependency "unicode", ">= 0"
78
- s.require_paths = ["lib"]
50
+ s.add_dependency "main", ">= 0"
51
+ s.bindir = "bin"
79
52
  end
data/lib/kitabu/base.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  module Kitabu
2
+ VERSION = "0.3.0"
3
+
2
4
  module Markup
3
5
  def self.content_for(options)
4
6
  source_file = File.join(KITABU_ROOT, 'code', options[:source_file].to_s)
@@ -52,7 +54,11 @@ module Kitabu
52
54
  # get syntax
53
55
  syntax = Kitabu::Base.default_syntax unless Kitabu::Base.syntax?(syntax)
54
56
 
55
- Uv.parse(code, "xhtml", syntax, false, theme)
57
+ code = Uv.parse(code, "xhtml", syntax, false, theme)
58
+ code.gsub!(/<pre class="(.*?)"/sim, %(<pre class="\\1 #{syntax}"))
59
+ code.gsub!(/<pre>/sim, %(<pre class="#{syntax} #{theme}"))
60
+
61
+ code
56
62
  end
57
63
  end
58
64
 
@@ -129,28 +135,39 @@ module Kitabu
129
135
  end
130
136
 
131
137
  def self.generate_html
132
- # all parsed markdown file holder
138
+ # parsed file holder
133
139
  contents = ""
134
140
 
141
+ entries = Dir.entries(text_dir).sort.reject do |entry|
142
+ %w(. .. .svn .git).include?(entry) || (File.file?(entry) && entry !~ /\.(markdown|textile)$/)
143
+ end
144
+
145
+ raise "No markup files found! Stopping PDF generation" if entries.empty?
146
+
135
147
  # first, get all chapters; then, get all parsed markdown
136
148
  # files from this chapter and group them into a <div class="chapter"> tag
137
- Dir.entries(text_dir).sort.each do |dirname|
138
- # ignore files and some directories
139
- next if %w(. .. .svn .git).include?(dirname) || File.file?(text_dir + "/#{dirname}")
140
-
149
+ entries.each do |entry|
141
150
  # gets all parsed markdown files to wrap in a
142
151
  # chapter element
143
152
  chapter = ""
144
153
 
145
- # merge all markdown and textile files into a single list
146
- markup_files = Dir["#{text_dir}/#{dirname}/**/*.markdown"] + Dir["#{text_dir}/#{dirname}/**/*.textile"]
154
+ # entry can be a file outside chapter folder
155
+ file = "#{text_dir}/#{entry}"
156
+
157
+ if File.file?(file)
158
+ markup_files = [file]
159
+ else
160
+ # merge all markdown and textile files into a single list
161
+ markup_files = Dir["#{text_dir}/#{entry}/**/*.markdown"] +
162
+ Dir["#{text_dir}/#{entry}/**/*.textile"]
163
+ end
147
164
 
148
165
  # no files, so skip it!
149
166
  next if markup_files.empty?
150
167
 
151
168
  markup_files.sort.each do |markup_file|
152
169
  # get the file contents
153
- markup_contents = File.new(markup_file).read
170
+ markup_contents = File.read(markup_file)
154
171
 
155
172
  # instantiate a markup object
156
173
  begin
@@ -205,9 +222,9 @@ module Kitabu
205
222
  :block_name => block_name,
206
223
  :source_file => source_file
207
224
  })
208
-
209
- Kitabu::Markup.syntax(code, syntax)
210
225
  end
226
+
227
+ Kitabu::Markup.syntax(code, syntax)
211
228
  end
212
229
  end
213
230
  end
@@ -217,7 +234,10 @@ module Kitabu
217
234
 
218
235
  contents << '<div class="chapter">%s</div>' % chapter
219
236
  end
220
-
237
+
238
+ # create output directory if is missing
239
+ FileUtils.mkdir(File.dirname(html_path)) unless File.exists?(File.dirname(html_path))
240
+
221
241
  # save html file
222
242
  File.open(html_path, 'w+') do |f|
223
243
  f << Kitabu::Base.parse_layout(contents)
@@ -236,6 +256,10 @@ module Kitabu
236
256
  syntaxes.include?(syntax_name)
237
257
  end
238
258
 
259
+ def self.layout?(layout_name)
260
+ layouts.include?(layout_name)
261
+ end
262
+
239
263
  def self.default_theme
240
264
  DEFAULT_THEME
241
265
  end
@@ -254,14 +278,14 @@ module Kitabu
254
278
 
255
279
  def self.layouts
256
280
  @layouts ||= begin
257
- dir = File.join(GEM_ROOT, "app_generators/kitabu/templates/layouts/")
281
+ dir = File.join(GEM_ROOT, "templates/layouts")
258
282
  Dir.entries(dir).reject{|p| p =~ /^\.+$/ }.sort
259
283
  end
260
284
  end
261
285
 
262
286
  def self.themes
263
287
  @themes ||= begin
264
- filter = File.join(GEM_ROOT, "app_generators/kitabu/templates/css/*.css")
288
+ filter = File.join(GEM_ROOT, "templates/themes/*.css")
265
289
  Dir[filter].collect{|path| File.basename(path).gsub(/\.css$/, '') }.sort
266
290
  end
267
291
  end
@@ -6,7 +6,7 @@ class BlackCloth < RedCloth
6
6
  %\{ # opening
7
7
  (.*?) # footnote
8
8
  \}# # closing
9
- /x
9
+ /xms
10
10
 
11
11
  # Usage: Writing some text with a footnote %{this is a footnote}
12
12
  def inline_textile_fn(text)
@@ -57,15 +57,6 @@ class BlackCloth < RedCloth
57
57
  # get line interval
58
58
  m, from_line, to_line = *attrs.match(/class=".*? ([0-9]+),([0-9]+)"/)
59
59
 
60
- # code = Kitabu::Markup.syntax({
61
- # :code => content,
62
- # :syntax => syntax,
63
- # :source_file => source_file,
64
- # :block_name => block_name,
65
- # :from_line => from_line,
66
- # :to_line => to_line
67
- # })
68
-
69
60
  content = Kitabu::Markup.content_for({
70
61
  :code => content,
71
62
  :syntax => syntax,
@@ -0,0 +1,49 @@
1
+ module Kitabu
2
+ module Templates
3
+ TEMPLATES_ROOT = File.join(Kitabu::Base::GEM_ROOT, 'templates')
4
+ DIRECTORIES = %w(text templates output)
5
+
6
+ def self.process!(options)
7
+ directories!(options)
8
+ bundle_css!(options)
9
+ files!(options)
10
+ config!(options)
11
+ end
12
+
13
+ def self.directories!(options)
14
+ FileUtils.mkdir(options[:path])
15
+
16
+ DIRECTORIES.each do |d|
17
+ FileUtils.mkdir File.join(options[:path], d)
18
+ end
19
+ end
20
+
21
+ def self.files!(options)
22
+ copy_file "Rakefile", "#{options[:path]}/Rakefile"
23
+ copy_file "layouts/#{options[:layout]}/layout.css", "#{options[:path]}/templates/layout.css"
24
+ copy_file "layouts/#{options[:layout]}/layout.html", "#{options[:path]}/templates/layout.html"
25
+ copy_file "user.css", "#{options[:path]}/templates/user.css"
26
+ end
27
+
28
+ def self.config!(options)
29
+ template = File.new(File.join(TEMPLATES_ROOT, 'config.yml')).read
30
+ env = OpenStruct.new(options)
31
+ contents = ERB.new(template).result env.instance_eval{binding}
32
+
33
+ File.open(File.join(options[:path], 'config.yml'), 'w+') << contents
34
+ end
35
+
36
+ def self.bundle_css!(options)
37
+ contents = Dir["#{TEMPLATES_ROOT}/themes/*.css"].collect do |file|
38
+ File.read(file)
39
+ end
40
+
41
+ File.open("#{options[:path]}/templates/syntax.css", "w+") << contents.join("\n\n")
42
+ end
43
+
44
+ private
45
+ def self.copy_file(from, to)
46
+ FileUtils.cp File.join(TEMPLATES_ROOT, from), to
47
+ end
48
+ end
49
+ end
data/lib/kitabu.rb CHANGED
@@ -1,18 +1,15 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ require 'rubygems'
2
+ require 'yaml'
3
+ require 'erb'
4
+ require 'ostruct'
5
+ require 'rexml/streamlistener'
6
+ require 'rexml/document'
7
+ require 'hpricot'
3
8
 
4
- require "rubygems"
5
- require "yaml"
6
- require "erb"
7
- require "ostruct"
8
- require "rexml/streamlistener"
9
- require "rexml/document"
10
- require "hpricot"
11
-
12
- require "kitabu/base"
9
+ require 'kitabu/base'
13
10
 
14
11
  begin
15
- require "ruby-debug"
12
+ require 'ruby-debug'
16
13
  rescue LoadError => e
17
14
  nil
18
15
  end
@@ -7,27 +7,27 @@
7
7
  <link rel="stylesheet" type="text/css" href="../templates/syntax.css"/>
8
8
  <link rel="stylesheet" type="text/css" href="../templates/user.css"/>
9
9
 
10
- <meta name="author" content="<%%= authors.join(', ') %>" />
11
- <meta name="subject" content="<%%= subject %>" />
12
- <meta name="keywords" content="<%%= keywords %>" />
10
+ <meta name="author" content="<%= authors.join(', ') %>" />
11
+ <meta name="subject" content="<%= subject %>" />
12
+ <meta name="keywords" content="<%= keywords %>" />
13
13
  </head>
14
14
  <body>
15
15
  <div class="frontcover"></div>
16
16
  <div class="halftitlepage">
17
- <h1 class="no-toc"><%%= title %></h1>
17
+ <h1 class="no-toc"><%= title %></h1>
18
18
  </div>
19
19
 
20
20
  <div class="titlepage">
21
- <h1 class="no-toc"><%%= title %></h1>
22
- <p class="no-toc"><%%= authors.join('<br/>') %></p>
21
+ <h1 class="no-toc"><%= title %></h1>
22
+ <p class="no-toc"><%= authors.join('<br/>') %></p>
23
23
  </div>
24
24
 
25
25
  <div class="imprint">
26
- <p><%%= copyright %></p>
26
+ <p><%= copyright %></p>
27
27
  </div>
28
28
 
29
29
  <div class="chapters">
30
- <%%= contents %>
30
+ <%= contents %>
31
31
  </div>
32
32
 
33
33
  <div class="white_page"></div>