|
|
edaa9d |
#!/bin/bash
|
|
|
edaa9d |
#
|
|
|
edaa9d |
# texinfo_copyEntryChapter.sh -- This function standardizes chapter
|
|
|
edaa9d |
# duplication inside manuals written in texinfo format.
|
|
|
edaa9d |
#
|
|
|
2fe9b7 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
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 |
|
|
|
e7414c |
# Redefine documentation entry source's location.
|
|
|
e7414c |
MANUAL_ENTRY_SRC=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]}
|
|
|
edaa9d |
|
|
|
e7414c |
# Redefine documentation entry target's location.
|
|
|
e7414c |
MANUAL_ENTRY_DST=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
edaa9d |
|
|
|
4f8368 |
# Verify entry source and target locations.
|
|
|
4f8368 |
${FLAG_BACKEND}_checkEntrySrcDst "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}"
|
|
|
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,
|
|
|
e7414c |
# define 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
|
|
|
4f8368 |
# copied to target chapter. Don't include chapter's main
|
|
|
4f8368 |
# definition files.
|
|
|
edaa9d |
local MANUAL_ENTRIES=$(cli_getFilesList $MANUAL_ENTRY_SRC \
|
|
|
e7414c |
--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 |
|
|
|
e7414c |
# Update section menu, nodes and cross reference definitions
|
|
|
e7414c |
# inside target chapter where all section entries were copied to.
|
|
|
e7414c |
${FLAG_BACKEND}_updateStructureSection "${MANUAL_ENTRY_DST}/.+\.${MANUAL_EXTENSION}"
|
|
|
e7414c |
|
|
|
e7414c |
# Update chapter menu and node definitions inside the manual
|
|
|
e7414c |
# structure.
|
|
|
c5c74e |
${FLAG_BACKEND}_updateChapterMenu
|
|
|
d92dde |
${FLAG_BACKEND}_updateChapterNodes
|
|
|
edaa9d |
|
|
|
edaa9d |
}
|