Permalink
Browse files

docbook gen

  • Loading branch information...
1 parent a151df0 commit 4881bfe52e4420f6ba4c8fee728e5e6faa5c7a5c @schacon schacon committed Feb 23, 2011
Showing with 23 additions and 9 deletions.
  1. +2 −4 TODO.txt
  2. +1 −1 lib/git-scribe.rb
  3. +10 −3 lib/git-scribe/generate.rb
  4. +10 −1 test/gen_test.rb
View
@@ -1,18 +1,16 @@
To-Do List
=============
+* generate hashes for generated assets and do not regenerate them unneccesarily
* custom site layouts
* custom/alternate themes (stylesheets)
* cover page for site (author, about, etc)
* book cover (w/template)
-* github pages publishing
-* checking for proper tools
+
* book search
* math formula
* generate different languages from branches/tags (site, epub, mobi)
-* use options library
-
* workflow
- review / copy editing
- translation
View
@@ -19,7 +19,7 @@ class GitScribe
attr_reader :info
BOOK_FILE = 'book.asc'
- OUTPUT_TYPES = ['pdf', 'epub', 'mobi', 'html', 'site']
+ OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site']
SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
def initialize
View
@@ -45,10 +45,19 @@ def a2x_wss(type)
a2x(type) + " --stylesheet=stylesheets/handbookish.css"
end
+ def do_docbook
+ return true if @done['docbook']
+ info "GENERATING DOCBOOK"
+ if ex("asciidoc -b docbook #{BOOK_FILE}")
+ @done['docbook'] = true
+ 'book.xml'
+ end
+ end
+
def do_pdf
info "GENERATING PDF"
+ do_docbook
# TODO: syntax highlighting (fop?)
- ex("asciidoc -b docbook #{BOOK_FILE}")
strparams = {'callout.graphics' => 0,
'navig.graphics' => 0,
'admon.textlabel' => 1,
@@ -58,7 +67,6 @@ def do_pdf
ex(cmd)
cmd = "fop -fo #{local('book.fo')} -pdf #{local('book.pdf')}"
ex(cmd)
- #puts `#{a2x('pdf')} -v --fop #{BOOK_FILE}`
if $?.exitstatus == 0
'book.pdf'
end
@@ -90,7 +98,6 @@ def do_html
return true if @done['html']
info "GENERATING HTML"
# TODO: look for custom stylesheets
- #puts `#{a2x_wss('xhtml')} -v #{BOOK_FILE}`
styledir = local('stylesheets')
cmd = "asciidoc -a stylesdir=#{styledir} -a theme=handbookish #{BOOK_FILE}"
if ex(cmd)
View
@@ -76,7 +76,16 @@
end
end
- xtest "scribe can generate docbook" do
+ test "scribe can generate docbook" do
+ in_temp_dir do
+ @scribe.init('t')
+ Dir.chdir('t') do
+ data = @scribe.gen('docbook')
+ assert_equal data, 'book.xml'
+ out = Dir.glob('output/**/*')
+ assert out.include? 'output/book.xml'
+ end
+ end
end
xtest "scribe can generate all" do

0 comments on commit 4881bfe

Please sign in to comment.