#! d:/mjb/unixutils/bin/sh.exe # A command line to reformat a text 'documentation' document into # some kind of html # D:\mjb\eg\asp\doc>cat fnDisplayRecordset-doc.txt | sed "s/^ *\([A-Z]\{3,\}[A-Z ]*\)/\1<\/i>/g" # | sed "s/[ ]\{2\}/\ \ /g" | sed "s/^/
/g" | less # Slightly better. #D:\mjb\eg\asp\doc>cat fnDisplayRecordset-doc.txt | sed -e "s//\>/g" | sed "s/ #^ *\([A-Z]\{3,\}[A-Z ]*\)/\1<\/i>/g" | sed "s/[ ]\{2\}/\ \ /g" | sed "s/^/
/g" > t #t.html # This version makes the section headings into 'heading' elements and makes the # function title or name into an h3 element. This has the disadvantage that unless # there is a style sheet, browsers put quite a lot of space after the # heading elements. However, these heading elements will be usefull if it is # desired to convert the html into some more 'robust' format such as pdf. # By using the 'heading' elements and an html2pdf conversion engine, such as # for example the 'htmldoc' application, it is possible to generate a table of # contents with accurate page numbering for a given output device. This is the # real 'shang-ri-la' of printing as far as I am concerned at the moment. # # By placing a 'for' loop around this command line in a 'sh' shell it should be # possible to batch process plain text documentation files into html and pdf. # There will be those people who are shaking their heads and muttering the words # xml, and sgml and document parsing etc, and really I suppose that I am in # sympathy with those people. But the power of a dodgy plain text format should # not be underestimated. #cat fnDisplayRecordset-doc.txt | sed -e "s//\>/g" | sed "1, #/^ *DESC/s/^ *[a-z]\{2\}.*/

&<\/h3>/g" | sed "s/^ *\([A-Z]\{3,\}[A-Z ]*\)/

\1<\/i><\/h4>/ #g" | sed "s/[ ]\{2\}/\ \ /g" | sed "s/^/
/g" > tt.html # This version creates links to url like strings. # # The command line below has been run successfully on the Windows 2000 # command shell. (without the line continuation characters. I believe it # is possible to use the open and close brackets characters for line # continuation in the Win NT/2000 shell, but I really dont want to go # into it. for f in $(ls *doc.txt) do cat $f | \ sed -e "s//\>/g" | \ sed "1, /^ *DESC/s/^ *[a-z]\{2\}.*/

&<\/h3>/g" | \ sed "s/^ *\([A-Z]\{3,\}[A-Z ]*\)$/

\1<\/i><\/h4> /g" | \ sed "s/^ *\([A-Z]\{3,\}[A-Z ]*[: ]\)/

\1<\/i><\/h4>/g" | \ sed "s/[ ]\{2\}/\ \ /g" | \ sed "s/\(http:\/\/[^ \n\r]\{3,\}\)/\1<\/a>/gi" | \ sed "s/[^a-zA-Z\/]www\.[^ ]\{2,\}/&<\/a>/gi" | \ sed "s/^/
/g" done