compatibility and portability changes from test

svn path=/trunk/; revision=34953
This commit is contained in:
paul 2017-01-18 19:29:15 +00:00
parent 0bf374f9f2
commit 19853ef064
4 changed files with 18 additions and 15 deletions

View File

@ -21,6 +21,8 @@ forcelog(){
[ "$(logname "$name")" = "/dev/null" ] \
&& forcedlog="$forcedlog\n${name}=$(tempfile -p w3bld -s $$)"
}
[ -z "$USER" ] && USER="$(whoami)"
trap "trap - 0 2 3 6 9 15; find \"${TMPDIR:-/tmp}/\" -maxdepth 1 -user \"$USER\" -name \"w3bld*$$\" -delete" 0 2 3 6 9 15
logstatus(){

View File

@ -17,9 +17,9 @@ mio(){
# by replacing in and out pathes with make variables.
for each in "$@"; do
case "$each" in
"$input"/*) echo "\${INPUTDIR}/${each#$input/}" ;;
"$output"/*) echo "\${OUTPUTDIR}/${each#$output/}" ;;
*) echo "$each" ;;
"$input"/*) printf '${INPUTDIR}/%s\n' "${each#${input}/}" ;;
"$output"/*) printf '${OUTPUTDIR}/%s\n' "${each#${output}/}" ;;
*) printf %s\\n "$each" ;;
esac
done
}
@ -28,7 +28,8 @@ mes(){
# make escape... escape a filename for make syntax
# possibly not complete
mio "$@" \
| sed -zr 's;[ #];\\&;g; s;\n; ;g'
| sed -r ':X; $bY; N; bX; :Y;
s;[ #];\\&;g; s;\n; ;g'
}
xhtml_maker(){

View File

@ -16,17 +16,17 @@ process_file(){
build_xmlstream "$shortname" "$lang" "$olang" \
| xsltproc "$processor" - \
| sed -r ':X; N; $!bX;
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="https?://'"$domain"'/([^"]*)";<\1\2 href="/\3";g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''https?://'"$domain"'/([^'\'']*)'\'';<\1\2 href='\''/\3'\'';g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="(https?:)?//'"$domain"'/([^"]*)";<\1\2 href="/\4";gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''(https?:)?//'"$domain"'/([^'\'']*)'\'';<\1\2 href='\''/\4'\'';gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="(https?://[^"]*)";<\1\2 href="#== norewrite ==\3";g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="([^#"])([^"]*/)?([^\./"]*\.)(html|rss|ics)(#[^"]*)?";<\1\2 href="\3\4\5'"$lang"'.\6\7";g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="([^#"]*/)(#[^"]*)?";<\1\2 href="\3index.'"$lang"'.html\4";g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="#== norewrite ==(https?://[^"]*)";<\1\2 href="\3";g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="((https?:)?//[^"]*)";<\1\2 href="#== norewrite ==\3";gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="([^#"])([^"]*/)?([^\./"]*\.)(html|rss|ics)(#[^"]*)?";<\1\2 href="\3\4\5'"$lang"'.\6\7";gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="([^#"]*/)(#[^"]*)?";<\1\2 href="\3index.'"$lang"'.html\4";gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="#== norewrite ==((https?:)?//[^"]*)";<\1\2 href="\3";gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''(https?://[^'\'']*)'\'';<\1\2 href='\''#== norewrite ==\3'\'';g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''([^#'\''])([^'\'']*/)?([^\./'\'']*\.)(html|rss|ics)(#[^'\'']*)?'\'';<\1\2 href='\''\3\4\5'"$lang"'.\6\7'\'';g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''([^#'\'']*/)(#[^'\'']*)?'\'';<\1\2 href='\''\3index.'"$lang"'.html\4'\'';g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''#== norewrite ==(https?://[^'\'']*)'\'';<\1\2 href='\''\3'\'';g
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''((https?:)?//[^'\'']*)'\'';<\1\2 href='\''#== norewrite ==\3'\'';gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''([^#'\''])([^'\'']*/)?([^\./'\'']*\.)(html|rss|ics)(#[^'\'']*)?'\'';<\1\2 href='\''\3\4\5'"$lang"'.\6\7'\'';gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''([^#'\'']*/)(#[^'\'']*)?'\'';<\1\2 href='\''\3index.'"$lang"'.html\4'\'';gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''#== norewrite ==((https?:)?//[^'\'']*)'\'';<\1\2 href='\''\3'\'';gI
'
}

View File

@ -35,7 +35,7 @@ build_manifest(){
sed -nr 's;\\ ; ;g;
s;\\#;#;g;
s;\$\{OUTPUTDIR\}/([^:]+) :.*;\1;p'
s;\$\{OUTPUTDIR\}/([^:]+):.*;\1;p'
}
remove_orphans(){