|
|
f8fb31 |
#!/bin/bash
|
|
|
f8fb31 |
#
|
|
|
742c46 |
# manual_deleteCrossReferences.sh -- This function looks inside
|
|
|
e9dba2 |
# texinfo source files, from section level on, and removes all cross
|
|
|
e9dba2 |
# referece definitions related to a documentation entry. Use this
|
|
|
742c46 |
# function in coordination with manual_deleteEntry function, in order
|
|
|
e9dba2 |
# to keep cross reference information, inside the documentation
|
|
|
e9dba2 |
# manual, syncronized.
|
|
|
f8fb31 |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
f8fb31 |
#
|
|
|
f8fb31 |
# This program is free software; you can redistribute it and/or
|
|
|
f8fb31 |
# modify it under the terms of the GNU General Public License as
|
|
|
f8fb31 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
f8fb31 |
# License, or (at your option) any later version.
|
|
|
f8fb31 |
#
|
|
|
f8fb31 |
# This program is distributed in the hope that it will be useful, but
|
|
|
f8fb31 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
f8fb31 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
f8fb31 |
# General Public License for more details.
|
|
|
f8fb31 |
#
|
|
|
f8fb31 |
# You should have received a copy of the GNU General Public License
|
|
|
f8fb31 |
# along with this program; if not, write to the Free Software
|
|
|
f8fb31 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
f8fb31 |
# USA.
|
|
|
f8fb31 |
#
|
|
|
f8fb31 |
# ----------------------------------------------------------------------
|
|
|
f8fb31 |
# $Id$
|
|
|
f8fb31 |
# ----------------------------------------------------------------------
|
|
|
f8fb31 |
|
|
|
742c46 |
function manual_deleteCrossReferences {
|
|
|
f8fb31 |
|
|
|
f8fb31 |
local -a PATTERN
|
|
|
f8fb31 |
local -a REPLACE
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Build the node string using global entry (ENTRY) variable being
|
|
|
f8fb31 |
# processed currently.
|
|
|
f8fb31 |
local NODE=$(echo "$ENTRY" \
|
|
|
5285d6 |
| cut -d / -f8- \
|
|
|
f8fb31 |
| tr '/' ' ' \
|
|
|
5285d6 |
| sed -r "s/(chapter-intro\.texi|\.texi)$//")
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Define regular expression patterns for texinfo cross reference
|
|
|
f8fb31 |
# commands.
|
|
|
f8fb31 |
PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}"
|
|
|
f8fb31 |
PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$"
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Define replacement string for missing entries. It is convenient
|
|
|
f8fb31 |
# to keep missing entries in documentation for documentation team
|
|
|
f8fb31 |
# to know. Removing the missing cross reference may intorudce
|
|
|
f8fb31 |
# confussion. Imagine that! you are spending lots of hours in an
|
|
|
f8fb31 |
# article and suddenly one of your cross refereces disappears with
|
|
|
f8fb31 |
# no visible reason, with the next working copy update you
|
|
|
f8fb31 |
# perform. That's frustrating. Instead, when centos-art.sh script
|
|
|
f8fb31 |
# finds a missing cross reference it removes the link and remark
|
|
|
f8fb31 |
# the issue for you to act on it.
|
|
|
f8fb31 |
REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---'
|
|
|
f8fb31 |
REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---'
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Sanitate all missing cross references, related to entry, in
|
|
|
f8fb31 |
# section texinfo files. Missing cross references, related to
|
|
|
f8fb31 |
# entry, in chapter texinfo files are already handled by
|
|
|
f8fb31 |
# manual_updateMenu, and manual_updateNode functions. If we don't
|
|
|
f8fb31 |
# sanitate missing cross refereces before info file is created,
|
|
|
f8fb31 |
# errors are displayed since makeinfo don't produce info output
|
|
|
f8fb31 |
# with broken cross refereces.
|
|
|
5285d6 |
local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi')
|
|
|
5285d6 |
if [[ $ENTRIES != '' ]];then
|
|
|
5285d6 |
sed -r -i \
|
|
|
5285d6 |
-e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \
|
|
|
5285d6 |
-e "s!${PATTERN[1]}!${REPLACE[1]}!g" \
|
|
|
5285d6 |
$ENTRIES
|
|
|
5285d6 |
fi
|
|
|
f8fb31 |
|
|
|
f8fb31 |
}
|