2015-05-21 16:31:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
inc_processor=true
|
2015-05-31 21:09:48 +00:00
|
|
|
[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
|
|
|
|
[ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
|
2015-05-21 16:31:43 +00:00
|
|
|
|
|
|
|
process_file(){
|
|
|
|
infile="$1"
|
|
|
|
processor="$2"
|
|
|
|
olang="$3"
|
|
|
|
|
|
|
|
shortname=$(get_shortname "$infile")
|
|
|
|
lang=$(get_language "$infile")
|
|
|
|
[ -z "$processor" ] && processor="$(get_processor "$shortname")"
|
|
|
|
|
|
|
|
build_xmlstream "$shortname" "$lang" "$olang" \
|
|
|
|
| xsltproc "$processor" - \
|
2016-05-09 20:45:56 +00:00
|
|
|
| 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
|
2015-05-21 16:31:43 +00:00
|
|
|
|
2016-05-09 20:45:56 +00:00
|
|
|
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
|
2015-05-21 16:31:43 +00:00
|
|
|
|
2016-05-09 20:45:56 +00:00
|
|
|
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
|
2015-05-21 16:31:43 +00:00
|
|
|
'
|
|
|
|
}
|