slitaz-dev-tools rev 247

tazwikiss: large page support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Sep 02 21:21:36 2015 +0200 (2015-09-02)
parents 9b17c1b64360
children b59cc28d47e2
files tazwikiss/rootfs/var/www/wiki/index.sh
line diff
     1.1 --- a/tazwikiss/rootfs/var/www/wiki/index.sh	Wed Sep 02 10:19:08 2015 +0200
     1.2 +++ b/tazwikiss/rootfs/var/www/wiki/index.sh	Wed Sep 02 21:21:36 2015 +0200
     1.3 @@ -277,7 +277,8 @@
     1.4  		mkdir $tmpdir
     1.5  		unesc="$(echo "$CONTENT" | sed 's/\^\(.\)/\n^\1\n/g' | grep '\^' |\
     1.6  		  sort | uniq | grep -v "['[!]" | hexdump -e '"" 3/1 "%d " "\n"' |\
     1.7 -		  awk '{ printf "-e '\''s/\\^%c/\\&#%d;/g'\'' ",$2,$2}') \
     1.8 +		  awk '{ printf "-e '\''s/\\^%c/\\&#%d;/g'\'' ",$2,$2}' | \
     1.9 +		  sed 's/\^\([*.[{]\)/^\\\1/') \
    1.10  		  -e 's/\\^'\\''/\\&#39;/g' -e 's/\^\!/\&#33;/g' \
    1.11  		  -e 's/\^\[/\&#91;/g'"
    1.12  		CONTENT="$(eval sed $unesc <<EOT | \
    1.13 @@ -494,8 +495,7 @@
    1.14  	AUTH_POST="\n<input type=\"hidden\" name=\"auth\" value=\"$AUTH\" />"
    1.15  fi
    1.16  
    1.17 -header "Content-type: text/html"
    1.18 -sed	-e "s/{ERROR}/$(sedesc "$ERROR")/" \
    1.19 +html2="$(sed	-e "s/{ERROR}/$(sedesc "$ERROR")/" \
    1.20  	-e "s/{WIKI_TITLE}/$(sedesc "$WIKI_TITLE")/" \
    1.21  	-e "s/{\([^}]*\)HISTORY\([^}]*\)}/$(sedesc "$HISTORY")/" \
    1.22  	-e "s/{PAGE_TITLE}/$(sedesc "$PAGE_TITLE_str")/" \
    1.23 @@ -503,7 +503,6 @@
    1.24  	-e "s/{\([^}]*\)TOC\([^}]*\)}/$(sedesc "$TOC")/" \
    1.25  	-e "s/{PAGE_TITLE_BRUT}/$(sedesc "$(htmlentities "$PAGE_TITLE")")/" \
    1.26  	-e "s/{LAST_CHANGE}/$(sedesc "$LAST_CHANGES") :/" \
    1.27 -	-e "s/{CONTENT}/$(sedesc "$CONTENT")/" \
    1.28  	-e "s/{LANG}/$(sedesc "$LANG")/" \
    1.29  	-e "s/href=\"?/href=\"$(sedesc "$urlbase?$AUTH_GET")/g" \
    1.30  	-e "s/action=\"$(sedesc "$urlbase")\">/&$(sedesc "$AUTH_POST")/g" \
    1.31 @@ -512,3 +511,14 @@
    1.32  	-e "s/{IP}/$REMOTE_ADDR/" -e "s/{COOKIE}//" -e "s/{RSS}//" <<EOT
    1.33  $html
    1.34  EOT
    1.35 +)"
    1.36 +header "Content-type: text/html"
    1.37 +sed '/{CONTENT}/{s/{CONTENT}.*//;q}' <<EOT
    1.38 +$html2
    1.39 +EOT
    1.40 +cat <<EOT
    1.41 +$CONTENT
    1.42 +EOT
    1.43 +sed ':a;N;/{CONTENT}/!ba;s/.*{CONTENT}//;:b;N;$!bb' <<EOT
    1.44 +$html2
    1.45 +EOT