From: paul Date: Tue, 16 Jun 2015 15:36:23 +0000 (+0000) Subject: improvement in wiki toc generator X-Git-Url: http://git.plutz.net/?p=busy;a=commitdiff_plain;h=35a0a997d4cef1b4784079a9e3ca85f9ba24d397 improvement in wiki toc generator svn path=/trunk/; revision=68 --- diff --git a/templates/Wiki.css b/templates/Wiki.css index 17f69be..af1411b 100644 --- a/templates/Wiki.css +++ b/templates/Wiki.css @@ -33,16 +33,16 @@ } .toc{ padding: 0em .5em;} -.toc a.i0 { +.toc a.i1 { font: normal bold 1em sans-serif; text-decoration: underline; margin-left: 0em; } -.toc a.i1 { +.toc a.i2 { font: normal bold .9em sans-serif; margin-left: 1em; } -.toc a.i2 { +.toc a.i3 { font: normal normal .8em sans-serif; margin-left: 2em; } diff --git a/templates/Wiki_show.page b/templates/Wiki_show.page index d00f0e5..fc3fd26 100755 --- a/templates/Wiki_show.page +++ b/templates/Wiki_show.page @@ -14,20 +14,25 @@ list_comments() { add_comment(){ info="$1" - cat <Comment / Ask - -WikiEND + cat <<-WikiEND + Comment / Ask + + WikiEND } +wikitext="$(_wiki Wiki/"${info}${rev}")" +wikitoc="$(echo -E "$wikitext" \ + | sed -rn '/.+<\/h[0-9]>/s;^.*(.+).*$;\3
;p' + )" + cat <
@@ -53,22 +58,14 @@ cat <')

Table of Content

- $(cat Wiki/"${info}${rev}" |while read line; do - if (egrep -q '^ *###' <<<"$line"); then - echo "$(sed 's,^ *###,,' <<<"$line")
" - elif (egrep -q '^ *##' <<<"$line"); then - echo "$(sed 's,^ *##,,' <<<"$line")
" - elif (egrep -q '^ *#' <<<"$line"); then - echo "$(sed 's,^ *#,,' <<<"$line")
" - fi - done) + ${wikitoc}

$title

- $(_wiki Wiki/"${info}${rev}") + ${wikitext}