Blame Scripts/Modules/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 25be94
#   tcar - The CentOS Artwork Repository automation tool.
Alain Reguera Delgado 25be94
#   Copyright © 2014 The CentOS Artwork SIG
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 25be94
#   This program is free software; you can redistribute it and/or
Alain Reguera Delgado 25be94
#   modify it under the terms of the GNU General Public License as
Alain Reguera Delgado 25be94
#   published by the Free Software Foundation; either version 2 of the
Alain Reguera Delgado 25be94
#   License, or (at your option) any later version.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 25be94
#   This program is distributed in the hope that it will be useful,
Alain Reguera Delgado 25be94
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 25be94
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 25be94
#   General Public License for more details.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 25be94
#   You should have received a copy of the GNU General Public License
Alain Reguera Delgado 25be94
#   along with this program; if not, write to the Free Software
Alain Reguera Delgado 25be94
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 25be94
#   Alain Reguera Delgado <al@centos.org.cu>
Alain Reguera Delgado 25be94
#   39 Street No. 4426 Cienfuegos, Cuba.
Alain Reguera Delgado 2c7b25
#
Alain Reguera Delgado 2c7b25
######################################################################
Alain Reguera Delgado 2c7b25
Alain Reguera Delgado 25be94
# Produce docbook documents using manpage document type.
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
}