Blame Scripts/Bash/Functions/Render/Docbook/docbook.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# docbook.sh -- This function performs base-rendition actions for
878a2b
# DocBook files.
878a2b
#
8fe45f
# Copyright (C) 2009-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
8fe45f
    # Expand translation markers inside instance.
8fe45f
    cli_expandTMarkers ${INSTANCE}
8fe45f
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
8fe45f
    # warn you about it, so you can correct them.
8fe45f
    xmllint --valid --noent --noout ${INSTANCE}
8fe45f
    if [[ $? -ne 0 ]];then
8fe45f
        cli_printMessage "`gettext "Validation failed."`" --as-error-line
8fe45f
    fi
878a2b
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
}