|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# texinfo_copyEntryChapter.sh -- This function standardizes chapter
|
|
|
878a2b |
# duplication inside manuals written in texinfo format.
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function texinfo_copyEntryChapter {
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine documentation entry source's location.
|
|
|
878a2b |
MANUAL_ENTRY_SRC=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]}
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine documentation entry target's location.
|
|
|
878a2b |
MANUAL_ENTRY_DST=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
878a2b |
|
|
|
878a2b |
# Verify entry source and target locations.
|
|
|
878a2b |
texinfo_checkEntrySrcDst "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}"
|
|
|
878a2b |
|
|
|
878a2b |
# When we are copying chapters, document structure actualization
|
|
|
878a2b |
# needs to be performed against the target chapter not the source
|
|
|
878a2b |
# one used to create the duplication. To achieve this goal,
|
|
|
878a2b |
# define both chapter's directory and chapter's name at this
|
|
|
878a2b |
# point.
|
|
|
878a2b |
local MANUAL_CHAPTER_DIR=$MANUAL_ENTRY_DST
|
|
|
878a2b |
local MANUAL_CHAPTER_NAME=${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]}
|
|
|
878a2b |
|
|
|
878a2b |
# When we are copying chapters, the chapter itself cannot be
|
|
|
878a2b |
# copied as we regularly do with sections. Instead, the target
|
|
|
878a2b |
# chapter must be created as a new chapter and then sections from
|
|
|
878a2b |
# source chapter must be copied one by one to the recently created
|
|
|
878a2b |
# chapter. At this point then, is when menu, nodes and cross
|
|
|
878a2b |
# references for the new chapter are updated.
|
|
|
878a2b |
texinfo_createChapter
|
|
|
878a2b |
|
|
|
878a2b |
# Create list of sections from source chapter that need to be
|
|
|
878a2b |
# copied to target chapter. Don't include chapter's main
|
|
|
878a2b |
# definition files.
|
|
|
878a2b |
local MANUAL_ENTRIES=$(cli_getFilesList $MANUAL_ENTRY_SRC \
|
|
|
878a2b |
--pattern="${MANUAL_ENTRY_SRC}/.+\.${MANUAL_EXTENSION}" \
|
|
|
878a2b |
| egrep -v '/chapter')
|
|
|
878a2b |
|
|
|
878a2b |
# Copy sections from source chapter to target chapter.
|
|
|
878a2b |
for MANUAL_ENTRY in $MANUAL_ENTRIES;do
|
|
|
878a2b |
svn cp $MANUAL_ENTRY $MANUAL_ENTRY_DST --quiet
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
# Update section menu, nodes and cross reference definitions
|
|
|
878a2b |
# inside target chapter where all section entries were copied to.
|
|
|
878a2b |
texinfo_updateStructureSection "${MANUAL_ENTRY_DST}/.+\.${MANUAL_EXTENSION}"
|
|
|
878a2b |
|
|
|
878a2b |
# Update chapter menu and node definitions inside the manual
|
|
|
878a2b |
# structure.
|
|
|
878a2b |
texinfo_updateChapterMenu
|
|
|
878a2b |
texinfo_updateChapterNodes
|
|
|
878a2b |
|
|
|
878a2b |
}
|