slitaz-dev-tools rev 244
tazwikiss: filter & in sed exp for EDIT HISTORY and PAGE_TITLE_str
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Aug 20 21:26:04 2015 +0200 (2015-08-20) |
parents | cbddfd886247 |
children | 46bb16b07f1a |
files | tazwikiss/rootfs/var/www/wiki/index.sh |
line diff
1.1 --- a/tazwikiss/rootfs/var/www/wiki/index.sh Sun May 10 10:15:53 2015 +0300 1.2 +++ b/tazwikiss/rootfs/var/www/wiki/index.sh Thu Aug 20 21:26:04 2015 +0200 1.3 @@ -180,7 +180,7 @@ 1.4 case "$action" in 1.5 edit) 1.6 editable=false 1.7 - HISTORY="<a href=\"$urlbase?page=$(urlencode $PAGE_TITLE)\&action=history\" accesskey=\"6\" rel=\"nofollow\">$HISTORY_BUTTON</a><br />" 1.8 + HISTORY="<a href=\"$urlbase?page=$(urlencode $PAGE_TITLE)&action=history\" accesskey=\"6\" rel=\"nofollow\">$HISTORY_BUTTON</a><br />" 1.9 CONTENT="$(sed 's/%/\%/g' <<EOT 1.10 $CONTENT 1.11 EOT 1.12 @@ -201,9 +201,9 @@ 1.13 history) 1.14 complete_dir="$BACKUP_DIR$PAGE_TITLE/" 1.15 if [ -n "$gtime" ]; then 1.16 - HISTORY="<a href=\"$urlbase?page=$PAGE_TITLE\&action=history\" rel=\"nofollow\">$HISTORY_BUTTON</a>" 1.17 + HISTORY="<a href=\"$urlbase?page=$PAGE_TITLE&action=history\" rel=\"nofollow\">$HISTORY_BUTTON</a>" 1.18 if [ -r "$complete_dir$gtime" ]; then 1.19 - HISTORY="$HISTORY <a href=\"$urlbase?page=$PAGE_TITLE\&action=edit\&time=$gtime&restore=1\" rel=\"nofollow\">$RESTORE</a>" 1.20 + HISTORY="$HISTORY <a href=\"$urlbase?page=$PAGE_TITLE&action=edit&time=$gtime&restore=1\" rel=\"nofollow\">$RESTORE</a>" 1.21 CONTENT="$(cat $complete_dir$gtime | sed -e s/$(echo -ne '\r')//g -e 's|$|<br/>|g')" 1.22 else 1.23 HISTORY="$HISTORY -" 1.24 @@ -224,7 +224,7 @@ 1.25 fi ;; 1.26 diff) 1.27 if [ -n "$(GET f1)" ]; then 1.28 - HISTORY="<a href=\"$urlbase?page=$(urlencode "$PAGE_TITLE")\&action=history\">$HISTORY_BUTTON</a>" 1.29 + HISTORY="<a href=\"$urlbase?page=$(urlencode "$PAGE_TITLE")&action=history\">$HISTORY_BUTTON</a>" 1.30 CONTENT="$(htmldiff "$(GET f1)" "$(GET f2)" )" 1.31 else 1.32 # diff auto entre les 2 dernières versions 1.33 @@ -316,7 +316,15 @@ 1.34 -e 's/([yY])/\¥/g' -e 's/([tT][mM])/\™/g' \ 1.35 -e 's/([cC])/\©/g' -e 's/([rR])/\®/g' \ 1.36 -e 's/([dD])/\°/g' -e 's/(1\/2)/\½/g' \ 1.37 - -e 's/(1\/4)/\¼/g' -e 's/(3\/4)/\¾/g' \ 1.38 + -e 's/(1\/4)/\¼/g' -e 's/(3\/4)/\¾/g' \ 1.39 + -e 's/(phone)/\☎/' -e 's/(wphone)/\☏/' \ 1.40 + -e 's/(skull)/\☠/' -e 's/(radioactive)/\☢/' \ 1.41 + -e 's/(sad)/\☹/' -e 's/(smile)/\☺/' \ 1.42 + -e 's/(recycle)/\☎/' -e 's/(wheelchair)/\☛/' \ 1.43 + -e 's/(wflag)/\⚐/' -e 's/(bflag)/\⚑/' \ 1.44 + -e 's/(anchor)/\⚓/' -e 's/(flower)/\⚘/' \ 1.45 + -e 's/(gear)/\⚙/' -e 's/(volt)/\⚡/' \ 1.46 + -e 's/(warn)/\⚠/' -e 's/(star)/\★/' \ 1.47 -e 's/(<=)/\≤/g' -e 's/(>=)/\≥/g' \ 1.48 -e 's/(!=)/\≠/g' -e 's/(+-)/\±/g' <<EOT 1.49 $CONTENT 1.50 @@ -482,9 +490,9 @@ 1.51 1.52 header "Content-type: text/html" 1.53 sed -e "s#{ERROR}#$ERROR#" -e "s#{WIKI_TITLE}#$WIKI_TITLE#" \ 1.54 - -e "s#{\([^}]*\)HISTORY\([^}]*\)}#$HISTORY#" \ 1.55 - -e "s#{PAGE_TITLE}#$PAGE_TITLE_str#" \ 1.56 - -e "s#{\([^}]*\)EDIT\([^}]*\)}#\1$EDIT\2#" \ 1.57 + -e "s|{\([^}]*\)HISTORY\([^}]*\)}|${HISTORY//&/\&}|" \ 1.58 + -e "s|{PAGE_TITLE}|${PAGE_TITLE_str//&/\&}|" \ 1.59 + -e "s|{\([^}]*\)EDIT\([^}]*\)}|\1${EDIT//&/\&}\2|" \ 1.60 -e "s|{\([^}]*\)TOC\([^}]*\)}|$(awk '{ printf "%s\\n" $0 }' <<EOT | \ 1.61 sed -e 's/&/\\\&/g' -e 's/|/\\|/g' 1.62 $toc