Skip to content

Commit

Permalink
docbook gen
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Feb 23, 2011
1 parent a151df0 commit 4881bfe
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
6 changes: 2 additions & 4 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/git-scribe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions lib/git-scribe/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 10 additions & 1 deletion test/gen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4881bfe

Please sign in to comment.