USAGE: hypertxt - |- [ ..] writes and retrieves text-strings to stdout. With "-" reads from stdin. USAGE: hypertxt - [ ..] writes index-list or html-file with internal links to stdout. USAGE: hypertxt -R |- [ ..] list textstrings found in Rich Text Format file. USAGE: hypertxt -S |- [ ..] write summary of to stdout. USAGE: hypertxt -q | [v[erbose]] write "" (unquoted) to stdout. USAGE: hypertxt -q - [v[erbose]] write " ..." from "$QUERY_STRING" to stdout. USAGE: hypertxt -Q | [v[erbose]] write """" (quoted) to stdout. USAGE: hypertxt -Q - [v[erbose]] write "=""
..." from "$QUERY_STRING" to stdout. WHERE is value of or th value (starting at 0) found in "$QUERY_STRING", "%" is replaced by one character. With ARGUMENT verbose the "$QUERY_STRING" is written to stderr as is. USAGE: hypertxt -e lists HTML escape sequences as text to stdout. USAGE: hypertxt -E lists HTML escape sequences as webpage to stdout. OPTION1: I interpret as text_column plus column remarks. B list bold text from . C list comments from . H list head 1..6 from . N list anything but comments from . M print model of new HTML-file. l list textstrings and tags. r list textstrings and tags. Show tags in reverse video. t list textstrings only. Skip non-ASCII characters. i list textstrings and . T list tags only. u list quoted URLs found in "". U list quoted URLs found in "", precded by "#wget ". W list quoted URLs found in "", precded by "wget ". x list textstrings only. Allow non-ASCII characters. y list textstrings and tags. Allow non-ASCII characters. OPTION2: b write part of html-file specified in to stdout. c read files specified in and write index-list to stdout. g write CGI serverside program specified in to stdout. That is the HTML body preceded by "Content-type: text/html" plus an empty line and followed by an empty line. h write html-file specified in to stdout. DOCTYPE "HTML 4.0 Transitional//EN" and "charset=iso-8859-1" is included. Prudent use of this software will produce a document which upon validation by http://validator.w3.org/#validate_by_upload will be found to be free of errors. CFG: is a MSDOS or UNIX text-file where the first character of every line determines its fate with the following syntax: PRINTF-STYLE ESCAPE-SEQUENCES: The following formatting is applied to all text, including filenames: "%%" the "%" character. "%" is not changed. "%" at the end of a line is not changed. "%A" replaced by . "%B" replaced by . Used in and after FUNCTION[ call]. "%C" replaced by . Used in and after FUNCTION[ call]. "%D" date and time in English as f.e. "Wed Jun 30 21:49:08 1993". "%F" counter of funtion-calls, starting at 1. "%I" date as f.e. "30 juni 1993". "%J" date and time as "YYYY-MM-DD hh:mm". "%K" date as "YYYY-MM-DD". "%L" If a list is created and a line matching is found at a multiple of in the list, "%L" is replaced by the line at after the matching line, otherwise by "". "%N" global counter N, starting at 1, incremented after every call. "%P" replaced by , used by option "P" in only. "%Q=" replaced by found in "$QUERY_STRING". Default: "". "%R=" replaced by its value. Default: "". "%S" replaced by . "%T" replaced by . "%U" seconds remaining until Tue Jan 19 03:14:08 2038 (time 0x7fffffff+1). "%V" replaced by <variable1>. "%W" replaced by <variable2>. "%X" global counter X, starting at 1. "%Y" global counter Y, starting at 1. "%Z" global counter Z, starting at 1. "%_" replaced by <string> with spaces i.s.o. underscores. Note: an optional minimum field width can be inserted after %. SWITCHING REPLACEMENT: "&" suspend (restore) replacement %% by %, %S by <string>, etcetera. GENERAL: "T<title>" for browser titlebar, favorites &c. Default for -h,-g: basename of <cfg-file>. Default for -b: no title. "H<text>" for -h: write literal <text> in "<HEAD> </HEAD>". "%%" is replaced by "%". " for -g: write literal <text> before other output, but after title. "%%" is replaced by "%". "B<arguments>" for -h: write <text> between "<BODY" and ">". "%%" is replaced by "%". for -g: ignored. " Examples of <arguments>:"vlink=<color>", "bgcolor=<color>". "#<comment>" write <comment>. "?<returnvalue>" force exit value of hypertxt. Empty lines in <cfg-file> are ignored. BASIC TEXT: "<n><headertext>" for <n> in [1..6] write a header. "<n>" for <n> in [1..6] open or close a header. Use this for coloured headers. "0<headertext>" write a header as bold text. "t<text>" write <text>. "<TAB><text>" write <text>. "M<text>" write break "<br>" bullet "•" <text>. "M" write bullet "•". "m<text>" write break "<br>" bullet "•" <text> followed by break "<br>". "m" write bullet "•" followed by break "<br>". "n<text>" write <text> followed by break "<br>". "b<text>" write bold <text>. "b" ... ["b"] (lines with single character) begin ... end bold style. "c<text>" write typewriter <text>. "c" ... ["c"] (lines with single character) begin ... end typewriter style. "d<text>" write small(er) <text>. "d" ... "D" (lines with single character) begin ... end small(er) text. "d" ... "D" may be nested. "G<text>" write big(ger) <text>. "G" ... "g" (lines with single character) begin ... end big(ger) text. "G" ... "g" may be nested. The lettersize is treated as a continuous parameter. The tags are. closed and restored around headers, forms and tables. The lettersize is restored inside table captions, headers and data. Stacksize=40 "i<text>" write italic <text>. "i" ... ["i"] (lines with single character) begin ... end italic style. "]" ... "]" <center> ... </center>. Note: not allowed within "j". STRUCTURAL HTML-ELEMENTS: "=[<attributes>]" write begin of paragraph "<p>" with attributes (align). Implies end of paragraph. ":<attributes>" begin "<font ... >" with attributes (color,face). ":" write "</font>" matching preceding "<font ... >". ";[<count>][ <attributes>]" write line break "<br>". "-[<count>][ <attributes>]" write horizontal rule "<hr>". "+[<count>]" or "+[+ ..]" write no-break spaces " ". ANCHORS AND LINKS: N.B. Do not forget to escape "%" as "%%" in <URL>s. N.B. The W3C validator requires "&" in <URL>s to be escaped as "&". "a<anchorname>[ <text>]" define internal link <anchorname>. Used by INDEX. "a" stop selecting text from files for INDEX. "l<name>[ <text>]" write link to internal link <name>. "e<URL> <text>" write link to external link <URL> (without spaces). "e<URL>" same as "e<URL> <URL>". "h<partialURL>" same as "e[http://[www.]]<partialURL>", ignored if <partialURL> is (after expansion of %) empty. "j<URL>[ <script>]" begin link to external link <URL> (without spaces). "j<URL> -" begin link to external link <URL> (without spaces), add "target="_blank"" (i.e. open in new tab). "j" end external link with an image, (Java)script, etc. "[<filename>[ <attributes>]" .gif or .jpg file (without spaces) to display. Useful attributes are: width="70%%" height="70%%" alt="...". The required attribute alt="<filename>" is added by default. LITERAL INSERTIONS: In <literal text> "&","<" and non-printables are unchanged. Note that %% is replaced by %, %S by <string>, etcetera. "&<literal text>", but not "&", write <literal text>. Examples: "&©" for Copyright, "&ë" or "&ë" for "ë". "<<literal text>" for -h: insert <literal text> before "<HTML>", for -g: replace "Content-type: text/html" by <literal text>. "><literal text>" for -h: insert <literal text> after "</HTML>", for -g: replace trailing empty line by <literal text>. INCLUDE TEXT FROM A FILE: ".<filename> [skip=<skip>[ last=[-]<last>]]" "<filename>" can be relative or absolute. to be included as is line by line in the output. Note: "%" in "<filename>" should be escaped as "%%". <filename> should be a readable file with plain text. Lines commencing with a single "#" are ignored. From lines commencing with "##" the first character is removed. Default: include all lines (<skip>=0, <last>=0 i.e. EOF). Negative <last> value skips lines at end of <file>. "^<filename> [skip=<skip>[ last=<last>]]" include file with <literal text>. Default: include all lines (<skip>=0, <last>=0 i.e. EOF). "/<filename>" include the cfg-file <filename> recursively. "@<filename> [skip=<skip>[ last=<last>]]" include HTML-file <filename>. Note that %% is replaced by %, %S by <string>, etcetera. Default: include all lines (<skip>=0, <last>=0 i.e. EOF). Hint: make <filename> with "hypertxt -g" and use "skip=3". (ONE) FUNCTION AND VARIABLES: "F[UNCTION]" begin of function definition. "E[NDFUNCTION]" end of function definition. "%<string>" set the value of <string> explicitly. "v<text>" set the value of the string <variable1> explicitly. "w<text>" set the value of the string <variable2> explicitly. "C<global counter><operation>[<value>]" with <global counter> N,X,Y or Z, <operation> + - or =, Default: <value>=1. "![<firstarg>[ <secondarg>]]" execute function. The argument is split at the first space or TAB. No operation by default of FUNCTION. USING A TEXT-DATABASE: "L.<filename>" create a list consisting of ALL lines in <filename>. Note: "%" in "<filename>" should be escaped as "%%". "L=<listperiod>" a unique number, required when a list is defined. "L<listoffset>" See %L . Default: 1 . PREPARING AN INDEX: "P[<prefix>]%P[<suffix>]" formats indextext for next file. Default: "%P". "~" inserts no-break spaces in text for next file. "S[tyle/][<minlength>/<maxacrolength>]" Default 6 5 . <minlength> is minimum wordlength for INDEX (except for acronyms). <maxacrolength> is maximum wordlength for INDEX (for acronyms only). Moreover the following strings are rejected by INDEX: "january" "february" "march" "april" "may" "june" "july" "august" "september" "october" "november" "december" "version" "januari" "februari" "maart" "mei" "juni" "juli" "augustus" "oktober" "versie" "s" "et" "al" INSERTING AN INDEX: "A[LPHABET]" write alphabetical index for the INDEX. "A<alphabetfile>" write extendend alphabetical index for the INDEX. <alphabetfile> contains all one- and two-letter combinations. The first letter is cast to uppercase. The optional second character, if it is a letter, is cast to lowercase. "I[NDEX][#]" write alphabetical index for all words in selected files. With "#" INDEX with numbers i.s.o. <name>s. To activate selection use "!<string>" or "%<string>" and "a<string>[ <string>]". "I[NDEX][#]<filename>" INDEX restricted to entries in <filename>, "J[b][i]" write words in index from subsequent selected files in the indicated style. Default: regular. With "b" INDEX with keywords in bold style. With "i" INDEX with keywords in italic style. "R[EPEATININDEX]<repeatdistance>:<name>[ <text>]" repeated link in INDEX>. if the file exists. Lines commencing with "#" are ignored. One entry per line, always in lower case, is expected. HTML-TABLES: "|t[<attributes>]" begin table. Terminated at end of <cfg-file>. Tables may be nested up to 10 levels deep. "|c[<attributes>]" begin caption in table. Terminated by new row, caption or end of table. "|r[<attributes>]" begin row in table. Terminated by new row, caption or end of table. "|h[<attributes>]" begin header cel in table. Terminated by end of row/table or new header/data cel. "|d[<attributes>]" begin data cel in table. Terminated by end of row/table or new header/data cel. "|e" end table. HTML-FORMS: "(<attributes>" begin "<form ... >" with attributes (method,action). "*<attributes>" "<input ... >" with attributes (type,name,value). "**<name> <value>" "<input type="hidden" ... >". "{<attributes>" begin "<select ... >" with attributes (name,size,multiple). "$=<text>" write <option>. "$<file> [skip=<skip>[ last=[-]<last>]]" write <option>s listed in <file>. "}" end select. ")" end form. NOTES: A <filename> both can be a simple filename or directory/filename. For reasons of compatibility \ is replaced by / in names of files which are read or written by hypertxt. This is an OS-dependent feature. <maxwidth> defines characters per line output for <option1>. Default=64 <dotted> defines pattern of dotted lines. Default=5 <HTML-file> is read only. With "-" read from stdin. In <cfg-file> and in read <file>s the maximum linelength is 2048. In <cfg-file> the lines "T<title>" and "F".."E" may appear at any position in the file. Only one FUNCTION, one INDEX and one list can be defined. Four variables are available: <name>, <string> <variable1> and <variable2>. <name>s should be single words and uniquely defined, they are used by INDEX. Special characters in the text are written as an escape-sequences "&#<n>;". TABs in the text are written as "    ". A useful attribute is "style=color:<colour>". Attributes not consisting of [a-zA-Z-_.:] must be quoted with "s. ARGUMENTS: c[ontinue] skips a text-file when it is not found for <option2>. d[otted/]<dotted> for <option1>. Default: 5 . I[NDEXLIST] writes indexlist or wordcount to stdout. m[axwidth/]<maxwidth> for <option1>. Default: 64 . n[summary/]<number of words>. Default 15 . r[elax] allow lines commencing with "}" in converted <RTF-file>. S[tyle/]<minlength>/<maxacrolength> for word selection. Default 6 5 . t[erse] remove empty lines from converted <RTF-file>. Input may even be a plain text file. v[erbose] writes progress report to stderr for <option2>. v[erbose] v[erbose] writes progress while generating HTML-file to stderr. V<variable1>. Initialise <variable1>. Default: "". W<variable2>. Initialise <variable2>. Default: "". RETURN VALUES: 0 no errors. 1 Output is usage or charset info. 2 Syntax error in commandline argument. 3 File reading error, "$QUERY_STRING" or other <environment variable>, like "$REMOTE_ADDR" not found. 4 Runtime syntax error. All return values can be overruled by "?<returnvalue>" in a <cfg-file>. VERSION: Jun 24 2014 Copyright (C) 2011 by Harm J. Schoonhoven Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.