Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.2
72 changes: 72 additions & 0 deletions docbook-xsl/fo.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,78 @@
<!-- Default fetches image from Internet (long timeouts) -->
<xsl:param name="draft.watermark.image" select="''"/>

<!-- Front cover -->
<xsl:template name="front.cover">
<xsl:call-template name="page.sequence">
<xsl:with-param name="master-reference">my-titlepage</xsl:with-param>
<xsl:with-param name="content">
<fo:block text-align="center">
<fo:external-graphic src="url(images/cover.jpg)" content-height="9in"/>
</fo:block>
</xsl:with-param>
</xsl:call-template>
</xsl:template>



<xsl:template name="select.user.pagemaster">
<xsl:param name="element"/>
<xsl:param name="pageclass"/>
<xsl:param name="default-pagemaster"/>

<!-- Return my customized title page master name if for titlepage,
otherwise return the default -->

<xsl:choose>
<xsl:when test="$default-pagemaster = 'titlepage-first'">
<xsl:value-of select="'my-titlepage'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default-pagemaster"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="user.pagemasters">

<!-- my title page -->
<fo:simple-page-master master-name="my-titlepage"
page-width="{$page.width}"
page-height="{$page.height}"
margin-top="0"
margin-bottom="0"
margin-left="0"
margin-right="0">
<xsl:if test="$axf.extensions != 0">
<xsl:call-template name="axf-page-master-properties">
<xsl:with-param name="page.master">my-titlepage</xsl:with-param>
</xsl:call-template>
</xsl:if>
<fo:region-body margin-bottom="{$body.margin.bottom}"
margin-top="0"
column-gap="{$column.gap.titlepage}"
column-count="{$column.count.titlepage}">
</fo:region-body>
</fo:simple-page-master>

</xsl:template>

<xsl:template name="header.footer.width">
<xsl:param name="location" select="'header'"/>
<xsl:param name="position" select="1"/>

<xsl:choose>
<xsl:when test="$position = 1">
<xsl:value-of select="1"/>
</xsl:when>
<xsl:when test="$position = 2">
<xsl:value-of select="5"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Line break -->
<xsl:template match="processing-instruction('asciidoc-br')">
<fo:block/>
Expand Down
9 changes: 7 additions & 2 deletions lib/git-scribe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ class GitScribe
attr_accessor :subcommand, :args, :options
attr_reader :info

#Allow overrides of the config files so we let the user have multiple versions of the book
#maybe multiple languages or different formats
OVERRIDE_NAME = ENV["GITSCRIBE_BOOK_FILE"] || ""
BOOK_FILE = 'book.asc'
OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site']
OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site', 'ebook']
SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

def initialize
@subcommand = nil
@args = []
@options = {}
@config = YAML::parse(File.open(local('.gitscribe'))).transform rescue {}
configfilename = ENV["GITSCRIBE_CONFIG_FILE"]
configfilename ||= '.gitscribe'
@config = YAML::parse(File.open(local(configfilename))).transform rescue {}
end

## COMMANDS ##
Expand Down
6 changes: 5 additions & 1 deletion lib/git-scribe/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def prepare_output_dir
end

def a2x(type)
"a2x -f #{type} -d book "
"a2x -f #{type} -d book --no-xmllint "
end

def a2x_wss(type)
Expand Down Expand Up @@ -331,6 +331,10 @@ def liquid_template(file)
def gather_and_process
files = Dir.glob("book/*")
FileUtils.cp_r files, 'output', :remove_destination => true

if OVERRIDE_NAME != ""
FileUtils.mv "output/#{OVERRIDE_NAME}", "output/book.asc"
end
end

def ex(command)
Expand Down