Blame tcar-scripts-render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh

Alain Reguera Delgado 2c7b25
#!/bin/bash
Alain Reguera Delgado 2c7b25
######################################################################
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
#  manpage.sh -- This module produces docbook documents using manpage
Alain Reguera Delgado 2c7b25
#  document type.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
#   Written by:
Alain Reguera Delgado 2c7b25
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
# Copyright (C) 2009-2013 The CentOS Artwork SIG
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 2c7b25
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 2c7b25
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 2c7b25
# your option) any later version.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 2c7b25
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 2c7b25
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 2c7b25
# General Public License for more details.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 2c7b25
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 2c7b25
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
######################################################################
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
function manpage {
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
    local MANSECT=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "mansect")
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
    tcar_checkFiles -m '[1-9]' "${MANSECT}"
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
    # xml2po (gnome-doc-utils-0.8.0-2.fc6) bug? For some reason xml2po
Alain Reguera Delgado 2c7b25
    # is not adding the lang attribute to refentry tag when it
Alain Reguera Delgado 2c7b25
    # produces manpage document types.  This make intrinsic docbook
Alain Reguera Delgado 2c7b25
    # construction like Name and Synopsis to be rendered without
Alain Reguera Delgado 2c7b25
    # localization. This doesn't happens with article and book
Alain Reguera Delgado 2c7b25
    # document types.
Alain Reguera Delgado 2c7b25
    sed -i -r "s/<refentry>/<refentry lang=\"${TCAR_SCRIPT_LANG_LC}\">/" ${TARGET_INSTANCES[${COUNTER}]}
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
    for FORMAT in ${FORMATS};do
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
        tcar_checkFiles -m '(xhtml|manpage)' "${FORMAT}"
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
        case ${FORMAT} in 
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
            'xhtml' )
Alain Reguera Delgado 2c7b25
                local HTML_TARGET="$(dirname ${RENDER_TARGET})/htmlman${MANSECT}/$(basename ${RENDER_TARGET}).${MANSECT}.html"
Alain Reguera Delgado 2c7b25
                asciidoc_setXhtmlRendition "${HTML_TARGET}"
Alain Reguera Delgado 2c7b25
                ;;
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
            'manpage' )
Alain Reguera Delgado 2c7b25
                local MAN_TARGET="$(dirname ${RENDER_TARGET})/man${MANSECT}/$(basename ${RENDER_TARGET}).${MANSECT}"
Alain Reguera Delgado 2c7b25
                if [[ ! -d $(dirname ${MAN_TARGET}) ]];then
Alain Reguera Delgado 2c7b25
                    mkdir -p $(dirname ${MAN_TARGET})
Alain Reguera Delgado 2c7b25
                fi
Alain Reguera Delgado 2c7b25
                tcar_printMessage "${MAN_TARGET}" --as-creating-line
Alain Reguera Delgado 2c7b25
                /usr/bin/xsltproc -o ${MAN_TARGET} --nonet \
Alain Reguera Delgado 2c7b25
                    ${DOCBOOK_XSL}/docbook2manpage.xsl ${TARGET_INSTANCES[${COUNTER}]}
Alain Reguera Delgado 2c7b25
                ;;
Alain Reguera Delgado 2c7b25
        esac
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
    done
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 2c7b25
}