Re: Embed man pages in a book
Posted by
mojavelinux on
Aug 25, 2016; 9:58am
URL: https://discuss.asciidoctor.org/Embed-man-pages-in-a-book-tp4906p4910.html
There's one way to get around the limitation of a single doctype per document. The trick is to use an AsciiDoc table cell. AsciiDoc table cells support an embedded document and allow the doctype to be modified. You can use this approach to embed a man page written in AsciiDoc inside of another document. You can find an example below.
However, there are some limitations with this approach. For instance, attributes defined in the man page document that are already defined in the main document get ignored. If I were doing this for a real book, I would definitely write a block extension that executed Asciidoctor separately on the nested man document, then insert the HTML back into the document (as a pass block). That way I would know that the document trees were properly isolated.
= My Book
Author Name
:doctype: book
Introductory text.
|===
a|
:doctype: manpage
:showtitle:
= eva(1)
Andrew Stanton
v1.0.0
:manmanual: EVE
:mansource: EVE
== NAME
eve - analyzes an image to determine if it's a picture of a life form
== SYNOPSIS
*eve* ['OPTION']... 'FILE'...
== OPTIONS
*-o, --out-file*=_OUT_FILE_::
Write result to file _OUT_FILE_.
*-c, --capture*::
Capture specimen if it's a picture of a life form.
== EXIT STATUS
*0*::
Success.
Image is a picture of a life form.
*1*::
Failure.
Image is not a picture of a life form.
== RESOURCES
== COPYING
Copyright \(C) 2008 {author}.
Free use of this software is granted under the terms of the MIT License.
|===
More text.
-Dan