|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# docbook.sh -- This function performs base-rendition actions for
|
|
|
878a2b |
# DocBook files.
|
|
|
878a2b |
#
|
|
|
94a5cb |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function docbook {
|
|
|
878a2b |
|
|
|
954aa5 |
# Define absolute path to XSL files used for transforming Docbook
|
|
|
954aa5 |
# into other formats.
|
|
|
954aa5 |
local DOCBOOK_XSL="${TCAR_WORKDIR}/trunk/Identity/Webenv/Themes/Default/Docbook/1.69.1/Xsl"
|
|
|
954aa5 |
|
|
|
954aa5 |
# Define absolute path to Docbook models.
|
|
|
954aa5 |
local DOCBOOK_MODELS="${TCAR_WORKDIR}/trunk/Documentation/Models/Docbook"
|
|
|
954aa5 |
|
|
|
8fe45f |
# Exapand common contents inside instance.
|
|
|
8fe45f |
docbook_expandLicenses ${INSTANCE}
|
|
|
8fe45f |
|
|
|
8fe45f |
# When translated instances are rendered, system entities (e.g.,
|
|
|
8fe45f |
# `%entity-name;') don't appear in the translated instance (it
|
|
|
8fe45f |
# seems that xml2po removes them) and this provokes Docbook
|
|
|
8fe45f |
# validation to fail. So in order to pass the validation
|
|
|
8fe45f |
# successfully and automate the whole creation of system entities,
|
|
|
8fe45f |
# don't let this duty ion users'. Instead, make centos-art.sh
|
|
|
8fe45f |
# script responsible of it.
|
|
|
8fe45f |
docbook_expandSystemEntities ${INSTANCE}
|
|
|
8fe45f |
|
|
|
8fe45f |
# Validate translated instance before processing it. This step is
|
|
|
8fe45f |
# very important in order to detect document's malformations and
|
|
|
5936b9 |
# warn you about it, so you can correct them. It is also necessary
|
|
|
5936b9 |
# to save them in a new file in order to make translation markers
|
|
|
5936b9 |
# expansion possible before transforming the Docbook instance into
|
|
|
5936b9 |
# other formats.
|
|
|
5936b9 |
xmllint --valid --noent ${INSTANCE} > ${INSTANCE}.tmp
|
|
|
8fe45f |
if [[ $? -ne 0 ]];then
|
|
|
8fe45f |
cli_printMessage "`gettext "Validation failed."`" --as-error-line
|
|
|
8fe45f |
fi
|
|
|
878a2b |
|
|
|
5936b9 |
# Expand translation markers on temporal instance.
|
|
|
5936b9 |
cli_expandTMarkers ${INSTANCE}.tmp
|
|
|
5936b9 |
|
|
|
5936b9 |
# Update instance to add translation markers expansion.
|
|
|
5936b9 |
mv ${INSTANCE}.tmp ${INSTANCE}
|
|
|
5936b9 |
|
|
|
2865b7 |
# Convert DocBook source files to other formats.
|
|
|
966df7 |
docbook_convertToXhtmlChunk
|
|
|
966df7 |
docbook_convertToXhtml
|
|
|
966df7 |
docbook_convertToText
|
|
|
2865b7 |
docbook_convertToPdfFromXml
|
|
|
878a2b |
|
|
|
2865b7 |
# NOTE: From version 5.0 on, DocBook specification is no longer a
|
|
|
2865b7 |
# SGML specification but an XML specification only. Thus,
|
|
|
2865b7 |
# transformations related to DocBook SGML specification won't be
|
|
|
2865b7 |
# supported in `centos-art.sh' script.
|
|
|
878a2b |
|
|
|
24ece8 |
# Perform format post-rendition.
|
|
|
878a2b |
docbook_doPostActions
|
|
|
878a2b |
|
|
|
24ece8 |
# Perform format last-rendition.
|
|
|
878a2b |
docbook_doLastActions
|
|
|
878a2b |
|
|
|
878a2b |
}
|