DocOps / liquidoc-gem

The canonical gem source for LiquiDoc, a ruby-based documentation parsing and rendering utility enabling advanced builds with Asciidoctor, Jekyll, Liquid, and semi-structured data files.
https://docs.docops.org/liquidoc-user-manual.html
MIT License
12 stars 5 forks source link

Add flattening of AsciiDoc indexes and dir structures #13

Open briandominick opened 7 years ago

briandominick commented 7 years ago

One frustrating limitation of Asciidoctor's ePub generator is that it requires all included source .adoc files to be in the same directory. This isn't convenient for large, complex documents (like, ahem, books). Let's help AsciiDoc authors by giving an option to flatten the structure during migration, so we can move an index file and all its dependencies (includes, images, etc) into a build/scratch directory, and we'll build the ePub (and other Asciidoctor) output from there.

This requires flattening the include:: macros as well as flatting the actual file structure during the move, dumping it all in the same target dir.

plaindocs commented 6 years ago

My approach (admittedly less elegant) was to generate epub from the single-page html...

briandominick commented 6 years ago

Hmmmm. I'm more than a little bothered that I did not think of that. Let me get to work getting out of your way.

briandominick commented 6 years ago

Yeah, honestly, if it's not lossy, I don't really see your solution as less elegant, even. HTML is a legitimate source format if there's a good HTML -> ePub converter.

plaindocs commented 6 years ago

Single line of pandoc works

pandoc codewriting-book-draft.html  -o test.epub

Although there is some slight oddness with the heading levels. Part Five: Evolving seems to be at a different level to everything else.

And then, to make it Kindle suitable

$ kindlegen test.epub

*************************************************************
 Amazon kindlegen(Linux) V2.9 build 1028-0897292 
 A command line e-book compiler 
 Copyright Amazon.com and its Affiliates 2014 
*************************************************************

Info(prcgen):I1047: Added metadata dc:Title        "Codewriting: Collaborative Documentation Ops for the Agile Age"
Info(prcgen):I1047: Added metadata dc:Date         "2018-08-02T08:46:17Z"
Info(prcgen):I1047: Added metadata dc:Creator      "Brian Dominick"
Info(prcgen):I1002: Parsing files  0000004
Info(prcgen):I1015: Building PRC file
Info(prcgen):I1006: Resolving hyperlinks
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/nav.xhtml
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch001.xhtml#contributing
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch001.xhtml#creative-commons
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/{github-repo-uri}/blob/prime/LICENSE.md
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/{github-repo-uri}/commits
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch001.xhtml#part-5-evolution
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch001.xhtml#engineering_docs
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch001.xhtml#chapter-coding
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch002.xhtml#engineering_docs
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch003.xhtml#creative-commons
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch003.xhtml#glossary-rest-api
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch003.xhtml#glossary-api
Warning(prcgen):W14001: Hyperlink not resolved:  /tmp/mobi-I8U8V3/EPUB/text/ch003.xhtml#managing-complexity
Warning(prcgen):W14002: Some hyperlinks could not be resolved.
Info(prcgen):I1008: Resolving start reading location
Warning(prcgen):W14016: Cover not specified
Info(pagemap):I8000: No Page map found in the book
Info(prcgen):I1045: Computing UNICODE ranges used in the book
Info(prcgen):I1046: Found UNICODE range: Basic Latin [20..7E]
Info(prcgen):I1046: Found UNICODE range: General Punctuation - Windows 1252 [2018..201A]
Info(prcgen):I1046: Found UNICODE range: Latin-1 Supplement [A0..FF]
Info(prcgen):I1017: Building PRC file, record count:   0000087
Info(prcgen):I1039: Final stats - text compressed to (in % of original size):  53.17%
Info(prcgen):I1040: The document identifier is: "Codewriting_-_the_Agile_Age"
Info(prcgen):I1041: The file format version is V6
Info(prcgen):I1031: Saving PRC file
Info(prcgen):I1033: PRC built with WARNINGS!
Info(prcgen):I1016: Building enhanced PRC file
Info(prcgen):I1007: Resolving mediaidlinks
Info(prcgen):I1011: Writing mediaidlinks
Info(prcgen):I1009: Resolving guide items
Warning(index build):W15010: This index is empty and has been skipped.
Info(prcgen):I1017: Building PRC file, record count:   0000103
Info(prcgen):I1039: Final stats - text compressed to (in % of original size):  52.04%
Info(prcgen):I1041: The file format version is V8
Info(prcgen):I15000:  Approximate Standard Mobi Deliverable file size :   0000826KB
Info(prcgen):I15001:  Approximate KF8 Deliverable file size :   0000862KB
Info(prcgen):I1037: Mobi file built with WARNINGS!

Has some wibbles. None of this is really production suitable, but it does get it onto my kindle so I can read it... :-D

briandominick commented 6 years ago

No. Way. That is so cool. I never even thought of it. You're giving me some ideas.....

Thanks for being patient. I hope the content is worth it! LMAO