1#!/usr/local/bin/bash 2# 3# This script uses the report produced by `make check-manuals` 4# to fix inconsistencies in GAPDoc cross-references within 5# the GAP Reference Manual. 6# 7# The output of `make check-manuals` produces the output of the form 8# 9# ./reesmat.xml:379 : Ref to IsReesZeroMatrixSemigroup uses Attr instead of Prop 10# ./fixconsistency.sh IsReesZeroMatrixSemigroup Attr Prop ./reesmat.xml 379 11# 12# where the 2nd line is the instruction for calling this script from 13# the `doc/ref` directory. 14# 15# To use it, do the following (provided you do not have older log files) 16# 17# rm dev/log/check_manuals_* 18# make check-manuals 19# grep fixconsistency dev/log/check_manuals_* > doc/ref/fix.sh 20# cd doc/ref 21# bash fix.sh 22# 23# Arguments: 24# $1 name of the function, operation, attribute, etc. 25# $2 old type used in the Ref element 26# $3 new type to be used in the Ref element 27# $4 filename 28# $5 line number 29echo '*** Processing ' $1 $2 $3 $4 $5 30sedarg="$5s|$2=\\\"$1\\\"|$3=\\\"$1\\\"|g" 31echo $sedarg 32echo 'Using sed...' 33# Note that the -i option for sed used below is not portable. This will 34# work on macOS (and presumably on other BSD variants), but not with GNU 35# sed, nor with other POSIX sed variants. As Max Horn suggests, it will 36# be safer to use `perl -pie`. 37sed -i '' $sedarg $4 38