asciidoctor / asciidoctor-fopub

A portable DocBook-to-PDF build command that wraps DocBook XSL and Apache FOP
MIT License
113 stars 37 forks source link

How to generate image numbering #31

Open rahmanusta opened 10 years ago

rahmanusta commented 10 years ago

Im using asciidoctor-fopub to generate pdf books. toc and table's numbering is generating with it. But, i couldnt generate image numbering with fopub, how can i do it?

mojavelinux commented 10 years ago

You have to hack the XSL (either fo-pdf.xsl or common.xsl in src/dist/docbook-xsl/). Here's the reference from sagehill.

http://www.sagehill.net/docbookxsl/FormalTitles.html

fopub offers a set of XSL refinements to make the output look a bit better and deal with some AsciiDoc-specific content, but doesn't offer a general framework for changing core functionality in the DocBook toolchain. Those are left up to the user as an exercise :)

rahmanusta commented 10 years ago

Thanks Dan, i know. However, i couldnt enable figure numbering, can you help me for this? :)

mojavelinux commented 10 years ago

Does the figure have a title? Is it a block-level image (two colons?). It might be helpful if you give me either the source AsciiDoc or the relative bits of the DocBook XML.

When I run fopub on the README.adoc for this repository, I'm seeing a figure number. Do you get the same result?

rahmanusta commented 10 years ago

I've found the reason. I'm using asciidoctor.js to generate docbook from asciidoctor. But, it renders image in formaldata element instead of figure.

For example, it was so

<formalpara>
<title>Sample PDF document rendered in viewer</title>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/image001.png"/>
</imageobject>
<textobject><phrase>Screenshot of sample PDF document</phrase></textobject>
</inlinemediaobject></para>
</formalpara>

When after changed formalpara elements to figure, it shows the figure numbering.

mojavelinux commented 10 years ago

Which version of Asciidoctor.js do you have that supports the DocBook backend? I didn't realize we compiled that into Asciidoctor.js anywhere. Do you use custom templates?

rahmanusta commented 10 years ago

No, i didnt use custom template. Yes, it is older version but there is no version comment on top of js file. it is older but converts asciidoc to docbook5.

mojavelinux commented 10 years ago

I wasn't aware that Asciidoctor.js could convert to DocBook. Strange.

rahmanusta commented 10 years ago

Yes, it can convert. Im using this conversation in AsciidocFX :)

rahmanusta commented 10 years ago

I want to clear something;

mojavelinux commented 10 years ago

Thanks @rahmanusta. The best way to proceed to resolve these issues is to provide small sample documents that we can use in a test case.

Even if you can't get the code to run, writing a cucumber test scenario in draft form is helpful. For examples, see https://github.com/asciidoctor/asciidoctor/blob/master/features/open_block.feature. I've setup multiple ways to represent the output. Just pick the form that works best for the use case.