schacon / git-scribe

basically the best way to write an ebook
MIT License
1.35k stars 121 forks source link

add support for asciidoctor command in place of asciidoc #56

Open mojavelinux opened 10 years ago

mojavelinux commented 10 years ago

Asciidoctor is used by default. Add the following config option to use AsciiDoc:

asciidoc: asciidoc
matthewmccullough commented 10 years ago

@mojavelinux I ran a build on this PR branch with bundle exec rake and got the following errors (same ones on master without asciidoctor–just wanted to make note of it):

Loaded suite /opt/boxen/rbenv/versions/2.0.0-github6/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/rake_test_loader
Started
.F
===============================================================================
Failure:
test_scribe_should_correctly_check_fop_availability(scribe_check_tests)
/Users/mccm06/Documents/Code/git-scribe_git/test/check_test.rb:19:in `block (2 levels) in <top (required)>'
<false> expected but was
<true>

diff:
? false
? tru  
===============================================================================
F
===============================================================================
Failure:
test_scribe_can_generate_a_epub(scribe_gen_tests)
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:101:in `block (4 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:99:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:99:in `block (3 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:97:in `block (2 levels) in <top (required)>'
<"book.epub"> expected but was
<nil>

diff:
? "book.epub"
? nil        
===============================================================================
F
===============================================================================
Failure:
test_scribe_can_generate_a_mobi(scribe_gen_tests)
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:113:in `block (4 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:111:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:111:in `block (3 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:109:in `block (2 levels) in <top (required)>'
<nil> expected but was
<"book.mobi">

diff:
? n        il
? "book.mob "
===============================================================================
F
===============================================================================
Failure:
test_scribe_can_generate_a_pdf(scribe_gen_tests)
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:77:in `block (4 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:75:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:75:in `block (3 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:73:in `block (2 levels) in <top (required)>'
<nil> expected but was
<"book.pdf">

diff:
? nil       
? "book.pdf"
===============================================================================
....F
===============================================================================
Failure: <nil> is not true.
test_scribe_can_generate_site_with_syntax_highlighting(scribe_gen_tests)
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:66:in `block (4 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:63:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:63:in `block (3 levels) in <top (required)>'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
/Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:61:in `block (2 levels) in <top (required)>'
===============================================================================
.....

Finished in 46.979345 seconds.

15 tests, 28 assertions, 5 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
66.6667% passed

0.32 tests/s, 0.60 assertions/s

I also ran the tests on master and got the following, so I'm not going to worry about tests that were already broken.

The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Loaded suite /opt/boxen/rbenv/versions/2.0.0-github6/lib/ruby/gems/2.0.0/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
.FFFF....F.....

1) Failure:
test_scribe_should_correctly_check_fop_availability(scribe_check_tests) [/Users/mccm06/Documents/Code/git-scribe_git/test/check_test.rb:19]:
<false> expected but was
<true>.

2) Failure:
test_scribe_can_generate_a_epub(scribe_gen_tests)
    [/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:101:in `block (4 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:99:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:99:in `block (3 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:97:in `block (2 levels) in <top (required)>']:
<"book.epub"> expected but was
<nil>.

3) Failure:
test_scribe_can_generate_a_mobi(scribe_gen_tests)
    [/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:113:in `block (4 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:111:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:111:in `block (3 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:109:in `block (2 levels) in <top (required)>']:
<nil> expected but was
<"book.mobi">.

4) Failure:
test_scribe_can_generate_a_pdf(scribe_gen_tests)
    [/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:77:in `block (4 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:75:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:75:in `block (3 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:73:in `block (2 levels) in <top (required)>']:
<nil> expected but was
<"book.pdf">.

5) Failure:
test_scribe_can_generate_site_with_syntax_highlighting(scribe_gen_tests)
    [/Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:66:in `block (4 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:63:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:63:in `block (3 levels) in <top (required)>'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:40:in `block in in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `chdir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/test_helper.rb:39:in `in_temp_dir'
     /Users/mccm06/Documents/Code/git-scribe_git/test/gen_test.rb:61:in `block (2 levels) in <top (required)>']:
<nil> is not true.

Finished in 45.942231 seconds.

15 tests, 28 assertions, 5 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
66.6667% passed

0.33 tests/s, 0.61 assertions/s
matthewmccullough commented 10 years ago

Next, I'm running this on a legacy book to see how it works.

mojavelinux commented 10 years ago

It looks like some updates are required. I ran this a while back, but I can't remember if it was all working as of the last update to master. I'll run it from my end later tonight.

Side note: legacy fenced code block syntax for source listings is not supported in Asciidoctor. You can either use GitHub-flavored fenced code or AsciiDoc listing, literal or open blocks w/ the [source, lang] block attribute declaration.

matthewmccullough commented 10 years ago

@mojavelinux Looks good for HTML output from a quick run on our vintage Gradle Book. Happy to merge this PR as-is if you like. Let me know.

screen shot 2014-01-01 at 7 47 04 pm

mattkanwisher commented 9 years ago

+1 as regular asciidoc is missing a lot of features like cover images

mojavelinux commented 9 years ago

I updated the PR so it can be merged and I also fixed the tests.

Note that git-scribe does not currently use Asciidoctor EPUB3, so support for the cover images will be the same even after this fix. However, the DocBook toolchain does support a cover image to my knowledge...you just need to sort out where to put it and how to enable it. I didn't test it.