# HG changeset patch # User Pascal Bellard # Date 1441181651 -7200 # Node ID 46bb16b07f1ab7dcfd9de47692236ba1d405619f # Parent ea02fe275b3f838be628086c98bfb389dd437df9 tazwikiss: use sedesc() diff -r ea02fe275b3f -r 46bb16b07f1a tazwikiss/rootfs/var/www/wiki/index.sh --- a/tazwikiss/rootfs/var/www/wiki/index.sh Thu Aug 20 21:26:04 2015 +0200 +++ b/tazwikiss/rootfs/var/www/wiki/index.sh Wed Sep 02 10:14:11 2015 +0200 @@ -56,6 +56,12 @@ cache_auth "$PASSWORD" } +sedesc() +{ + echo "$1" | sed 's|[/&"]|\\&|g' | \ + sed ':a;N;$!ba;s|\n|\\n|g;s|'$(echo -en "\r")'||g' +} + plugin_call_method() { local status @@ -154,7 +160,7 @@ EOT )" else - CONTENT="$(sed -e "s#%page%#$PAGE_TITLE#" <$line EOT )" - CONTENT="$(sed "s#^!!* *$line\$#$line#" <$(sedesc "$line")<\/a><\/h$i>/" <
#" \ +html="$(sed -e "s/{\([^}]*\)RECENT_CHANGES\([^}]*\)}/\1$(sedesc "$RECENT")\2/" \ + -e "s/{\([^}]*\)HOME\([^}]*\)}/\1$(sedesc "$HOME")\2/" \ + -e "s/{\([^}]*\)HELP\([^}]*\)}/$(sedesc "$HELP")/" \ + -e "s/{SEARCH}/
<\/div><\/form>/" \ < $template )" [ "$action" != "" -a "$action" != "edit" -o ! -e "$PAGE_txt" ] && TIME="-" plugin_call_method template @@ -478,37 +484,31 @@ if $editable ; then EDIT="$PROTECTED_BUTTON" [ -w "$PAGE_txt" -o ! -e "$PAGE_txt" ] && - EDIT="$EDIT_BUTTON" + EDIT="$EDIT_BUTTON" fi [ -n "$toc" ] && toc="\1$toc\2" AUTH_GET="" AUTH_POST="" if authentified; then - AUTH_GET="auth=$AUTH\&" + AUTH_GET="auth=$AUTH&" AUTH_POST="\n" fi header "Content-type: text/html" -sed -e "s#{ERROR}#$ERROR#" -e "s#{WIKI_TITLE}#$WIKI_TITLE#" \ - -e "s|{\([^}]*\)HISTORY\([^}]*\)}|${HISTORY//&/\&}|" \ - -e "s|{PAGE_TITLE}|${PAGE_TITLE_str//&/\&}|" \ - -e "s|{\([^}]*\)EDIT\([^}]*\)}|\1${EDIT//&/\&}\2|" \ - -e "s|{\([^}]*\)TOC\([^}]*\)}|$(awk '{ printf "%s\\n" $0 }' <#&$AUTH_POST#g" \ - -e "s#{WIKI_VERSION}#$WIKI_VERSION#" \ - -e "s#{TIME}#$TIME#" -e "s#{DATE}#$datew#" \ - -e "s#{IP}#$REMOTE_ADDR#" -e "s#{COOKIE}##" </&$(sedesc "$AUTH_POST")/g" \ + -e "s/{WIKI_VERSION}/$(sedesc "$WIKI_VERSION")/" \ + -e "s/{TIME}/$(sedesc "$TIME")/" -e "s/{DATE}/$(sedesc "$datew")/" \ + -e "s/{IP}/$REMOTE_ADDR/" -e "s/{COOKIE}//" -e "s/{RSS}//" < : -->, <^--> : <--> * Copyrights : ^(c) ou ^(C) : (c), ^(r) ou ^(R) : (r) +* Fractions : ^(1/2) : (1/2), ^(1/4) : (1/4), ^(3/4) : (3/4) +* Divers : ^(+-) : (+-), ^(!=) : (!=) +* Quelques icônes : ^(phone) : (phone), ^(wphone) : (wphone), ^(bflag) : (bflag), ^( +wflag) : (wflag) ^(radioactive) : (radioactive), ^(sad) : (sad), ^(smile) : (sm +ile), ^(recycle) : (recycle), ^(wheelchair) : (wheelchair), ^(anchor) : (anchor +), ^(flower) : (flower), ^(gear) : (gear), ^(volt) : (volt), ^(warn) : (warn), +^(skull) : (skull), ^(star) : (star) ---- Les liens externes et les adresses eMail sont reconnus automagiquement ... ^http://wikiss.tuxfamily.org/ --> http://wikiss.tuxfamily.org/ diff -r ea02fe275b3f -r 46bb16b07f1a tazwikiss/rootfs/var/www/wiki/pages/Help.txt --- a/tazwikiss/rootfs/var/www/wiki/pages/Help.txt Thu Aug 20 21:26:04 2015 +0200 +++ b/tazwikiss/rootfs/var/www/wiki/pages/Help.txt Wed Sep 02 10:14:11 2015 +0200 @@ -9,10 +9,10 @@ ---- -Tiles use the exclamation mark '''!'''%% -^! Big%% -^!! Less big%% -^!!! Smaller%% +Tiles use the exclamation mark '''!''' +^! Big +^!! Less big +^!!! Smaller gives you : ! Big !! Less big @@ -31,10 +31,10 @@ ---- -Stroke of a work use quote and two dashes%% +Stroke of a work use quote and two dashes ^'--Stroked--' --> '--Stroked--' -the same applies for underline, quote followed by by two underscore%% +the same applies for underline, quote followed by by two underscore ^'__Underlined__' --> '__Underlined__' ---- @@ -53,10 +53,10 @@ ---- -The code, and all of those things where formatting is important, use the braces %% -^{{import sys%% -if len(sys.argv) == 2:%% - print "Hello",sys.argv^[1]}}%% +The code, and all of those things where formatting is important, use the braces +^{{import sys +if len(sys.argv) == 2: + print "Hello",sys.argv^[1]}} give : {{import sys if len(sys.argv) == 2: @@ -65,13 +65,16 @@ ---- The separation between paragraphs of text is done through an empty line. -To force a line break in the middle of a paragraph, use: ^%% +To force a line break in the middle of a paragraph, use: ^ ---- Some special characters are recognized: -* Arrows : <^-- : <--, ^--> : -->, <^--> : <--> -* Copyrights : ^(c) or ^(C) : (c), ^(r) or ^(R) : (r) +* Arrows: <^-- : <--, ^--> : -->, <^--> : <--> +* Copyrights: ^(c) or ^(C) : (c), ^(r) or ^(R) : (r) +* Fractions: ^(1/2) : (1/2), ^(1/4) : (1/4), ^(3/4) : (3/4) +* Miscellaneous: ^(+-) : (+-), ^(!=) : (!=) +* Some icons: ^(phone) : (phone), ^(wphone) : (wphone), ^(bflag) : (bflag), ^(wflag) : (wflag) ^(radioactive) : (radioactive), ^(sad) : (sad), ^(smile) : (smile), ^(recycle) : (recycle), ^(wheelchair) : (wheelchair), ^(anchor) : (anchor), ^(flower) : (flower), ^(gear) : (gear), ^(volt) : (volt), ^(warn) : (warn), ^(skull) : (skull), ^(star) : (star) ---- @@ -79,7 +82,7 @@ '''^['''Accueil''']''' --> [Accueil] If a page does not exists, it will be created on first click. -Click on "SandBox" below and you will be able to create it ...%% +Click on "SandBox" below and you will be able to create it ... [SandBox] To link a wiki-page with a different text use : @@ -97,21 +100,21 @@ ---- -Images are automagically inserted with the picture URL between square brackets%% +Images are automagically inserted with the picture URL between square brackets '''^['''^http://wikiss.tuxfamily.org/img/logo_100.png''']''' --> [http://wikiss.tuxfamily.org/img/logo_100.png] -You can also use an image as a link : %% +You can also use an image as a link : '''^['''^http://wikiss.tuxfamily.org/img/logo_100.png'''|'''^http://wikiss.tuxfamily.org/''']''' --> [http://wikiss.tuxfamily.org/img/logo_100.png|http://wikiss.tuxfamily.org/] But also position the image on a floating left or right: [http://wikiss.tuxfamily.org/img/logo_100.png|left] [http://wikiss.tuxfamily.org/img/logo_100.png|http://wikiss.tuxfamily.org|right] -%% -<-- '''^['''^http://wikiss.tuxfamily.org/img/logo_100.png'''|left]'''%% + +<-- '''^['''^http://wikiss.tuxfamily.org/img/logo_100.png'''|left]''' '''^['''^http://wikiss.tuxfamily.org/img/logo_100.png'''|'''^http://wikiss.tuxfamily.org'''|right]''' --> -%% + ---- @@ -119,7 +122,7 @@ ---- -Finally, in order to neutralize the syntax WiKiss, use the caret ^ %% +Finally, in order to neutralize the syntax WiKiss, use the caret ^ Thus, enter '''^^^['''WiKiss''']''' can display ^[WiKiss] rather than [WiKiss] ---- diff -r ea02fe275b3f -r 46bb16b07f1a tazwikiss/rootfs/var/www/wiki/plugins/wkp_Upload.sh --- a/tazwikiss/rootfs/var/www/wiki/plugins/wkp_Upload.sh Thu Aug 20 21:26:04 2015 +0200 +++ b/tazwikiss/rootfs/var/www/wiki/plugins/wkp_Upload.sh Wed Sep 02 10:14:11 2015 +0200 @@ -11,7 +11,7 @@ { case "$(GET action)" in edit) UPLOAD="$UPLOAD" - html="$(sed "s|HISTORY|$UPLOAD / HISTORY|" <