|
|
c7dc52 |
#!/bin/bash
|
|
|
c7dc52 |
#
|
|
|
c7dc52 |
# docbook_expandSystemEntities.sh -- This function expands system
|
|
|
c7dc52 |
# entities required by DocBook projects stored under
|
|
|
c7dc52 |
# `trunk/Documentation/Manuals' directory.
|
|
|
c7dc52 |
#
|
|
|
c7dc52 |
# Copyright (C) 2009-2012 The CentOS Project
|
|
|
c7dc52 |
#
|
|
|
c7dc52 |
# This program is free software; you can redistribute it and/or modify
|
|
|
c7dc52 |
# it under the terms of the GNU General Public License as published by
|
|
|
c7dc52 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
c7dc52 |
# your option) any later version.
|
|
|
c7dc52 |
#
|
|
|
c7dc52 |
# This program is distributed in the hope that it will be useful, but
|
|
|
c7dc52 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c7dc52 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c7dc52 |
# General Public License for more details.
|
|
|
c7dc52 |
#
|
|
|
c7dc52 |
# You should have received a copy of the GNU General Public License
|
|
|
c7dc52 |
# along with this program; if not, write to the Free Software
|
|
|
c7dc52 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
c7dc52 |
#
|
|
|
c7dc52 |
# ----------------------------------------------------------------------
|
|
|
c7dc52 |
# $Id$
|
|
|
c7dc52 |
# ----------------------------------------------------------------------
|
|
|
c7dc52 |
|
|
|
c7dc52 |
|
|
|
c7dc52 |
function docbook_expandSystemEntities {
|
|
|
c7dc52 |
|
|
|
c7dc52 |
# Define absolute path to instance where all operations will take
|
|
|
c7dc52 |
# place in.
|
|
|
c7dc52 |
local INSTANCE=$1
|
|
|
c7dc52 |
|
|
|
c7dc52 |
# Define absolute path to both common and specific system
|
|
|
c7dc52 |
# entities.
|
|
|
c7dc52 |
local ENTITIES_PATHS="$(cli_getFilesList ${DOCBOOK_MODELS_DIR}/Book ${ACTIONVAL} \
|
|
|
c7dc52 |
--pattern=".ent$" --maxdepth=1 --mindepth=1 --type='f')"
|
|
|
c7dc52 |
|
|
|
c7dc52 |
# Build definition of both common and specific system entities.
|
|
|
c7dc52 |
local ENTITIES="$(\
|
|
|
c7dc52 |
for ENTITY_PATH in $ENTITIES_PATHS;do
|
|
|
c7dc52 |
local ENTITY_NAME=$(basename ${ENTITY_PATH})
|
|
|
c7dc52 |
echo '\n\t\n'
|
|
|
c7dc52 |
echo '\t%'${ENTITY_NAME}';'
|
|
|
c7dc52 |
done)"
|
|
|
c7dc52 |
|
|
|
c7dc52 |
# Define both xml and docbook public definition.
|
|
|
c7dc52 |
local PREAMBLE=""
|
|
|
c7dc52 |
PREAMBLE="${PREAMBLE}\n
|
|
|
c7dc52 |
PREAMBLE="${PREAMBLE}\n\t\"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd\" ["
|
|
|
c7dc52 |
PREAMBLE="${PREAMBLE}\n${ENTITIES}"
|
|
|
c7dc52 |
PREAMBLE="${PREAMBLE}\n\t]>"
|
|
|
c7dc52 |
|
|
|
c7dc52 |
# Remove both xml and docbook preamble from instance and insert
|
|
|
c7dc52 |
# it again with definitions of required common and specific system
|
|
|
c7dc52 |
# entities.
|
|
|
c7dc52 |
sed -r -i "1,2c$(echo $PREAMBLE)" ${INSTANCE}
|
|
|
c7dc52 |
|
|
|
c7dc52 |
}
|