#!/bin/sed -f #l; #-- replace all tabs with two spaces s@ @ @g; #-- html entities. #-- allow literal html between /^ */,/^ *<\/html>/ { s///g; s/<\/html>//g; b; } s@&@\&@g; s@<@\<@g; s@>@\>@g; /^ *-\+ *$/d #-- stop formatting between '-->' and '--<' /^ *-->/,/^ *--/
/;
 s/--/;
 b; 
}

#-- stop formatting on line that starts with ":>"
/^ *:>/ {
 s@:>@
@; s@$@
@; b; } #-- stop formatting on line that starts with ">>" /^ *>>/ { s@>>@
@; s@$@
@; b; } #-- if the file contains DOS newlines line below may be necessary #-- in order to get rid of the "\r" characters. #s@.$@@g # s/[ ][ ]*/ /g #-- get rid of leading spaces to simplify matches s/^[[:blank:]]\+//; #-- use the gnu 'e' command to execute shell commands embedded #-- in pages format: [** shell-command ] /^\[\*\*/ { s/\[\*\*//; s/\]//; e } #-------------------------- # widgets #-- use the gnu 'e' command to "widgets" in the format [@@name] # # eg: [@@filelist /img/*.txt] /^\[@@filelist/ { s|\[@@filelist *|../htdocs/webscript/file-list.sh '|; s/\]/'/; e } #-------------------------- #-- lists #-- definition lists, the term begins with a "-" and #-- ends which a ":" at the end of a line or followed by a #-- space. The list end with a blank line eg; #-- D- sea: a lot of water #-- - see: look with the eyes #-- /^[ ]*D-/,/^[ ]*$/ { s@^\([ ]*\)D-\(.*\):$@\1
\2
@; s@^\([ ]*\)D-\(.*\): @\1
\2
@; s@^\([ ]*\)-\(.*\): @\1
\2
@; s@^\([ ]*\)-\(.*\):$@\1
\2
@; s@^\([ ]*\)$@\1
\ @; } #---------------------------- #-- The virtual machine state /^[ ]*-machine-/,/^[ ]*$/ { s@^\([ ]*\)-machine-$@\1@; /^ *-/ { s@-workbuffer:@-workspace:@; s@^\([ ]*\)-workspace:\(.*\)$@\1@g; s@^\([ ]*\)-peep:\(.*\)$@\1@g; s@,@@g; } s@^\([ ]*\)$@\1
workspace\2
peep\2
@g; s@^\([ ]*\)-\([^:]*\):\(.*\)$@\1
\2\3

\ @; } #---------------------------- #-- the page title #-- formats: && title #-- = title = s@^[ ]*=\(.*\)=@

\1

@ s@^[ ]*&&\(.*\)@

\1

@ #---------------------------- #-- headings. starting with ** or all upper case s@^[ ]*\*\*\(.*\)@

\L\1

@ s@^[ ]*\([A-Z]\)\([[:upper:] ]\{2,\}\)@

\1\L\2


@ #---------------------------- #-- make star lines bold italic s@^[ ]*\* \(.*\)@\1@ #---------------------------- #-- make file names fixed pitch s@\(/\?[-a-zA-Z]\+/[-a-zA-Z/]\+\.[^ ]\+\)@\1@ #---------------------------- #-- make file names fixed pitch, links s@ \([-a-zA-Z/]\+\.[^ ]\+\) file@\1@ #---------------------------- #-- make file names fixed pitch, links s@file \([-a-zA-Z/]\+\.[^ ]\+\)@\1@ #---------------------------- #-- make folder names fixed pitch, links s@\([-a-zA-Z]\+/\) folder@\1@ #---------------------------- #-- make folder names fixed pitch, links s@\([-a-zA-Z]\+/ \)dir@\1@ #---------------------------- #-- make function names fixed pitch italic s@\([a-zA-Z]\+() \)@\1@ #---------------------------- #-- special links #-- format: "location" (googlemap) s@"[ ]*(maplink)@" (googlemap)@Ig; s@"[ ]*(map)@" (googlemap)@Ig; s@"\([^"][^"]*\)"[ ]*(googlemap)@\1@g #-- format: "term" (google) s@"\([^"][^"]*\)"[ ]*(google)@\1@g #---------------------------- #-- format: "term" (google:nn) s@"\([^"][^"]*\)"[ ]*(google:\([a-z][a-z]\))@\1@g #s@"\([^"]\+\)" \+\(/[^ ]\+\)@\1@g s@"\([^"]\+\)" \+file://\([^ ]\+\)@\1@g s@"\([^"]\+\)" \+doc:\([^ ]\+\)@\1@g s@"\([^"]\+\)" \+\(http://[^ ]\+\)@\1@g s@"\([^"]\+\)" \+\(ftp://[^ ]\+\)@\1@g s@"\([^"]\+\)" \+\(www\.[^ ]\+\)@\1@g #---------------------------- #-- format: file: s@\bdoc:\([^ ]\+\)@ \1@g s@\bfile://\([^ ]\+\)@ \1@g s@[^"]\(http://[^ ]\+\)@ \1@g s@[^"]\(https://[^ ]\+\)@ \1@g s@\(https://[^ ]\+\)@ \1@g s@[^"]\(https\?://[^ ]\+\)@ \1@g s@[^"]\(ftps\?://[^ ]\+\)@ \1@g s@ \(www\.[^ ][^ ]*\)@ \1@g s@^\(www\.[^ ][^ ]*\)@ \1@g s@-->@\→@g s@<--@\←@g #---------------------------- #-- unordered lists /^[ ]*u-/,/^[ ]*$/ { s@^\([ ]*\)u-@\1
  • @; s@^\([ ]*\)-@\1
  • @; s@^\([ ]*\)$@\1
\ @; } #---------------------------- #-- ordered lists /^[ ]*o-/,/^[ ]*$/ { s@^\([ ]*\)o-@\1
  1. @; s@^\([ ]*\)-@\1
  2. @; s@^\([ ]*\)$@\1
\ @; } #---------------------------- #-- ordered lists, alphabetic style /^[ ]*a-/,/^[ ]*$/ { s@^\([ ]*\)a-@\1
  1. @; s@^\([ ]*\)-@\1
  2. @; s@^\([ ]*\)$@\1
\ @; } #---------------------------- s@^\([ ]*\)$@

@; s@:$@:
@; #---------------------------- #-- make -text- bold s@-\([a-z][a-z]*\)- @\1 @Ig;