|
|
edaa9d |
#!/bin/bash
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# texinfo_copyEntryChapter.sh -- This function standardizes chapter
|
|
|
edaa9d |
# duplication inside manuals written in texinfo format.
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# This program is free software; you can redistribute it and/or modify
|
|
|
edaa9d |
# it under the terms of the GNU General Public License as published by
|
|
|
edaa9d |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
edaa9d |
# your option) any later version.
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# This program is distributed in the hope that it will be useful, but
|
|
|
edaa9d |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
edaa9d |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
edaa9d |
# General Public License for more details.
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# You should have received a copy of the GNU General Public License
|
|
|
edaa9d |
# along with this program; if not, write to the Free Software
|
|
|
edaa9d |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# ----------------------------------------------------------------------
|
|
|
edaa9d |
# $Id$
|
|
|
edaa9d |
# ----------------------------------------------------------------------
|
|
|
edaa9d |
|
|
|
edaa9d |
function texinfo_copyEntryChapter {
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define documentation entry source's location.
|
|
|
5e989a |
local MANUAL_ENTRY_SRC=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Redefine chapter name using chapter name passed to
|
|
|
edaa9d |
# `centos-art.sh' script as second non-option argument.
|
|
|
edaa9d |
local MANUAL_CHAPTER_NAME=${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define documentation entry target's location.
|
|
|
5e989a |
local MANUAL_ENTRY_DST=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# When we are copying chapters, the source location and the target
|
|
|
edaa9d |
# location must be different in value. They cannot point to the
|
|
|
edaa9d |
# same chapter directory.
|
|
|
edaa9d |
if [[ $MANUAL_ENTRY_SRC == $MANUAL_ENTRY_DST ]];then
|
|
|
edaa9d |
cli_printMessage "`gettext "The chapter cannot be copied into itself."`" --as-error-line
|
|
|
edaa9d |
fi
|
|
|
edaa9d |
|
|
|
edaa9d |
# When we are copying chapters, document structure actualization
|
|
|
edaa9d |
# needs to be performed against the target chapter not the source
|
|
|
edaa9d |
# one used to create the duplication. To achieve this goal,
|
|
|
edaa9d |
# redefine both chapter's directory and chapter's name at this
|
|
|
edaa9d |
# point.
|
|
|
edaa9d |
local MANUAL_CHAPTER_DIR=$MANUAL_ENTRY_DST
|
|
|
edaa9d |
local MANUAL_CHAPTER_NAME=${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# When we are copying chapters, the chapter itself cannot be
|
|
|
edaa9d |
# copied as we regularly do with sections. Instead, the target
|
|
|
edaa9d |
# chapter must be created as a new chapter and then sections from
|
|
|
edaa9d |
# source chapter must be copied one by one to the recently created
|
|
|
edaa9d |
# chapter. At this point then, is when menu, nodes and cross
|
|
|
edaa9d |
# references for the new chapter are updated.
|
|
|
edaa9d |
${FLAG_BACKEND}_createChapter
|
|
|
edaa9d |
|
|
|
edaa9d |
# Create list of sections from source chapter that need to be
|
|
|
edaa9d |
# copied to target chapter. Don't include chapter main definition
|
|
|
edaa9d |
# files.
|
|
|
edaa9d |
local MANUAL_ENTRIES=$(cli_getFilesList $MANUAL_ENTRY_SRC \
|
|
|
edaa9d |
--pattern="${MANUAL_ENTRY_SRC}.*\.${MANUAL_EXTENSION}" \
|
|
|
edaa9d |
| egrep -v '/chapter')
|
|
|
edaa9d |
|
|
|
edaa9d |
# Copy sections from source chapter to target chapter.
|
|
|
edaa9d |
for MANUAL_ENTRY in $MANUAL_ENTRIES;do
|
|
|
edaa9d |
svn cp $MANUAL_ENTRY $MANUAL_ENTRY_DST --quiet
|
|
|
edaa9d |
done
|
|
|
edaa9d |
|
|
|
edaa9d |
# At this point, all copying actions had took place and it is time
|
|
|
edaa9d |
# to update the document structure. Start updating chapter
|
|
|
edaa9d |
# menu and nodes inside manual structure,
|
|
|
c5c74e |
${FLAG_BACKEND}_updateChapterMenu
|
|
|
d92dde |
${FLAG_BACKEND}_updateChapterNodes
|
|
|
edaa9d |
|
|
|
edaa9d |
# and section menu, nodes and cross references later.
|
|
|
edaa9d |
${FLAG_BACKEND}_updateStructureSection ".+\.${MANUAL_EXTENSION}"
|
|
|
edaa9d |
|
|
|
edaa9d |
}
|