"Fossies" - the Fresh Open Source Software Archive

Member "Grutatxt-2.20/doc/grutatxt_apache_handlers.txt" (5 May 2015, 1496 Bytes) of package /linux/www/Grutatxt-2.20.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 Apache + Grutatxt: The Simplest Possible Website
    2 ================================================
    3 
    4 By http://gweb.org (Geoffrey Plitt)
    5 
    6 I envisioned an entire website consisting of nothing but human-readable
    7 text files that are converted to HTML by the web server when necessary,
    8 with the least amount of extra junk in there. Here's how I did it.
    9 
   10 .htaccess (root folder):
   11 ------------------------
   12   Options -Indexes
   13   DirectoryIndex index.html index.text
   14   Action handle_text /cgi-bin/handle_text.cgi
   15   AddHandler handle_text .text
   16 
   17 This allows you to mix html and "text" content, which is converted to HTML
   18 by Grutatxt.
   19 
   20 /cgi-bin/handle_text.cgi:
   21 -------------------------
   22   #!/bin/bash
   23   echo "Content-type: text/html"
   24   echo
   25   base=`basename $PATH_TRANSLATED`
   26   if [ "$QUERY_STRING" = "" ]; then
   27     echo "<HTML><BODY>"
   28     cat $PATH_TRANSLATED | grutatxt -nb
   29     echo "<br><br><small><i>"
   30     echo "Generated with <a href='"
   31     echo "http://www.triptico.com/software/grutatxt.html"
   32     echo "'>Grutatxt</a>. View <a href='$base?SOURCE'>page source</a>"
   33     echo "</i></small></BODY></HTML>"
   34   else
   35     echo "<html><body><small>"
   36     # The confusing sed stuff just displays ampersands and brackets.
   37     cat $PATH_TRANSLATED | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g' |
   38      while read L; do
   39        echo "$L<br>"
   40      done
   41     echo "</small></body></html>"
   42   fi
   43 
   44 /index.text (any folder)
   45 -----------------------
   46   I'm an auto-grutatxt'ed HTML page
   47   -----
   48 
   49   And here is a body paragraph!
   50