|
|
2fa604 |
#!/bin/bash
|
|
|
2fa604 |
#
|
|
|
2fa604 |
# docbook_convertToPdfFromSgml.sh -- This function transforms DocBook
|
|
|
2fa604 |
# files which have set the SGML DTD in them. To produce PDF from
|
|
|
2fa604 |
# DocBook SGML DTD, we take the DocBook XML DTD file and change its
|
|
|
2fa604 |
# DTD from XML to SGML. Since XML is SGML shoudn't be any problem.
|
|
|
2fa604 |
# Once the DTD has been changed from XML to SGML, we use the jw shell
|
|
|
2fa604 |
# script to convert the SGML-based DocBook file to PDF. Customization
|
|
|
2fa604 |
# can be achieved through DSL (docbook-style-dsssl-1.79-4.1) shipped
|
|
|
2fa604 |
# in this distribution.
|
|
|
2fa604 |
#
|
|
|
2fa604 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
2fa604 |
#
|
|
|
2fa604 |
# This program is free software; you can redistribute it and/or modify
|
|
|
2fa604 |
# it under the terms of the GNU General Public License as published by
|
|
|
2fa604 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
2fa604 |
# your option) any later version.
|
|
|
2fa604 |
#
|
|
|
2fa604 |
# This program is distributed in the hope that it will be useful, but
|
|
|
2fa604 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2fa604 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2fa604 |
# General Public License for more details.
|
|
|
2fa604 |
#
|
|
|
2fa604 |
# You should have received a copy of the GNU General Public License
|
|
|
2fa604 |
# along with this program; if not, write to the Free Software
|
|
|
2fa604 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
2fa604 |
#
|
|
|
2fa604 |
# ----------------------------------------------------------------------
|
|
|
2fa604 |
# $Id$
|
|
|
2fa604 |
# ----------------------------------------------------------------------
|
|
|
2fa604 |
|
|
|
2fa604 |
function docbook_convertToPdfFromSgml {
|
|
|
2fa604 |
|
|
|
2fa604 |
# Print action message.
|
|
|
2fa604 |
cli_printMessage "${FILE}-sgml.pdf" --as-updating-line
|
|
|
2fa604 |
|
|
|
2fa604 |
local -a STYLE_TEMPLATE
|
|
|
2fa604 |
local -a STYLE_INSTANCE
|
|
|
2fa604 |
local STYLE_INSTANCE_FINAL=''
|
|
|
2fa604 |
|
|
|
2fa604 |
# Define file name of SGML-based file. This is a mere copy of
|
|
|
2fa604 |
# XML-based file, but using the `-sgml.docbook' prefix.
|
|
|
2fa604 |
SRC=$(echo $TEMPLATE | sed -r 's!\.docbook$!-sgml.docbook!')
|
|
|
2fa604 |
|
|
|
2fa604 |
# Create SGML-based file as copy of main XML-based DocBook file.
|
|
|
2fa604 |
cp $TEMPLATE $SRC
|
|
|
2fa604 |
|
|
|
2fa604 |
# Replace document definition from XML to SGML.
|
|
|
2fa604 |
sed -i -r \
|
|
|
2fa604 |
-e 's!"-//OASIS//DTD DocBook XML!"-//OASIS//DTD DocBook!' \
|
|
|
2fa604 |
-e 's!"http://www\.oasis-open\.org/docbook/xml/([[:digit:]])\.([[:digit:]])/docbookx\.dtd"!"docbook/sgml-dtd-\1.\2-1.0-30.1/docbook.dtd"!' \
|
|
|
2fa604 |
$SRC
|
|
|
2fa604 |
|
|
|
2fa604 |
# Prepare style final instance used in transformations.
|
|
|
2fa604 |
${RENDER_BACKEND}_prepareStyles "${DOCBOOK_STYLES_DIR}/docbook2pdf.dsl"
|
|
|
2fa604 |
|
|
|
2fa604 |
# Create PDF format.
|
|
|
2fa604 |
docbook2pdf --dsl ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null
|
|
|
2fa604 |
|
|
|
2fa604 |
# Remove temporal directory and temporal style instances created.
|
|
|
2fa604 |
rm $SRC
|
|
|
2fa604 |
rm ${STYLE_INSTANCE[*]}
|
|
|
2fa604 |
|
|
|
2fa604 |
}
|