|
|
f8fb31 |
#!/bin/bash
|
|
|
f8fb31 |
#
|
|
|
f8fb31 |
# manual_restoreCrossReferences.sh -- This function restores old
|
|
|
f8fb31 |
# missing cross references back into their link form. This function
|
|
|
f8fb31 |
# applies in those cases where new documentation entries are added to
|
|
|
f8fb31 |
# documentation structure. It is a verification looking for matching
|
|
|
f8fb31 |
# documentation entries previously defined as missing. This function
|
|
|
f8fb31 |
# relays in the missing message output produced by functions like
|
|
|
f8fb31 |
# manual_removeCrossReferences, in order to return them back into the
|
|
|
f8fb31 |
# link format.
|
|
|
f8fb31 |
#
|
|
|
f8fb31 |
# Copyright (C) 2009, 2010 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 |
|
|
|
f8fb31 |
function manual_restoreCrossReferences {
|
|
|
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" \
|
|
|
f8fb31 |
| cut -d / -f10- \
|
|
|
f8fb31 |
| tr '/' ' ' \
|
|
|
f8fb31 |
| sed -r "s/(${MANUALS_FILE[7]}|\.texi)$//")
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Define regular expression patterns from
|
|
|
f8fb31 |
# message_removeCrossReferences function output.
|
|
|
f8fb31 |
PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---"
|
|
|
f8fb31 |
PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$"
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Define replacement string for message_removeCrossReferences
|
|
|
f8fb31 |
# function output. Here is where we turn Removed messages back
|
|
|
f8fb31 |
# into links.
|
|
|
f8fb31 |
REPLACE[0]='@\1{\2}'
|
|
|
f8fb31 |
REPLACE[1]='\1'
|
|
|
f8fb31 |
|
|
|
f8fb31 |
# Sanitate messages built from broken cross reference messages
|
|
|
f8fb31 |
# produced by manual_removeCrossReferences function for section
|
|
|
f8fb31 |
# texinfo files. We don't toch chapter texinfo files because they
|
|
|
f8fb31 |
# are handled by manual_updateMenu, and manual_updateNode
|
|
|
f8fb31 |
# functions. If we don't sanitate messages built from broken
|
|
|
f8fb31 |
# cross reference messages, they may become obsoletes since the
|
|
|
f8fb31 |
# documentation entry, they represent, can be recreated in the
|
|
|
f8fb31 |
# future and at that time the link wouldn't be broken any more, so
|
|
|
f8fb31 |
# we need to be aware of this.
|
|
|
f8fb31 |
sed -r -i \
|
|
|
f8fb31 |
-e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \
|
|
|
f8fb31 |
-e "s!${PATTERN[1]}!${REPLACE[1]}!g" \
|
|
|
f8fb31 |
$(find ${MANUALS_DIR[2]} -mindepth 3 -name '*.texi')
|
|
|
f8fb31 |
|
|
|
f8fb31 |
}
|