Login  Register

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

*Project web site:* http://eve.example.org

== COPYING

Copyright \(C) 2008 {author}.
Free use of this software is granted under the terms of the MIT License.
|===

More text.

-Dan

On Wed, Aug 24, 2016 at 10:58 AM, sgruttendio [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Well, I imagine this question is going to look trivial. I didn't ask it before since I thought the problem didn't exist.

Once embedded the manpage in my book as you suggested. It looks ok, but... it has no formatting (i.e. bold characters for NAME, SYNOPSIS, no underlined words, like "file" etc.). I thought, for example, adding stars around the words would suffice (*file*), but no,  it is rendered verbatim. What's the key to the solution?

Sorry to bother you again

Thanks

Sgruttendio


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-man-pages-in-a-book-tp4906p4909.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux