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

Feature request: :front-cover-image: for asciidoctor-fopub #69

Open getreu opened 8 years ago

getreu commented 8 years ago

This post was updated on Oct 27, 2016; 10:12am. I just discovered the new attribute :front-cover-image: for asciidoctor-pdf. I will try to implement something similar for asciidoctor-fopub. Help or ideas are very much appreciated.

   :notitle:
   :front-cover-image: path/to/my/titlepage-image.svg

It will render the svg-image instead of a titlepage.

getreu commented 8 years ago

A piece of code to start with:

  <xsl:template name="book.titlepage.before.recto">
        <fo:block>&#8203;
  <fo:external-graphic src="url(titlepage-image.svg)" margin="0"/></fo:block>
  </xsl:template>
mojavelinux commented 8 years ago

The attribute for Asciidoctor PDF is documented here: https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#theme-related-document-attributes

getreu commented 8 years ago

Thank you. I did not know about this document. Impressing how easy asciidoctor-pdf can be customized.

jagdeepjain commented 8 years ago

In asciidoctor-fopub I have customized this by using below configuration: And passing this on the command line while generating a book.

<xsl:template name="front.cover">
    <xsl:call-template name="page.sequence">
      <xsl:with-param name="master-reference">titlepage-cover-image</xsl:with-param>
      <xsl:with-param name="content">
        <fo:block text-align="center">
       <fo:external-graphic src="url(book/cover-images/front-cover/in-digital-front-cover.png)" content-height="9in" content-width="7in"/>
        </fo:block>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

Here is the detailed description http://stackoverflow.com/questions/34932347/how-to-generate-a-cover-image-picture-with-asciidoctor-fopub

getreu commented 8 years ago

Thank you!

Concerning the asciidoctor xml output, this is what docbook expects: See cover

<book xmlns='http://docbook.org/ns/docbook'>
<info>
  <title>DocBook</title>
  <subtitle>The Definitive Guide</subtitle>
  <!-- THIS IS FRONT COVER -->
  <cover>
    <mediaobject>
      <imageobject>
    <imagedata fileref="graphics/duck-cover.png">
    </imagedata>
      </imageobject>
    </mediaobject>
  </cover>
  <!-- THIS IS BACK COVER -->
  <cover>
    <mediaobject>
      <imageobject>
    <imagedata fileref="graphics/duck-backcover.png"/>
      </imageobject>
    </mediaobject>
  </cover>
</info>

<preface>
<title>Preface</title>

<para>DocBook provides a system …</para>
</preface>

<!-- … -->

</book>

TODO

mojavelinux commented 8 years ago

Make asciidoctor translate :front-cover-image: to <cover> when -b docbook

I'd be glad to implement this. We can support both front and back. Great idea. Can you file in issue in asciidoctor core?