cgiprint (1) Convert a text into HTML (Dec. 2011)
If the name of this program starts by Show (e.g. by creating a link named Show-text to cgiprint ), it can then be called directly by the httpd(1) daemon.
A few examples of entité taggée : <Uni:unit_symbol>, an entity-GLU tag (<%type value>), or an action-GLU tag (<&action value>). A BibCode, bibliographical reference made of 19 characters YYYYJJJJJvvvvMppppA, can typically be recognized automatically.
The text to convert can be in TeX form (with the –tex option), in a TeX-light form which contains only basic TeX macros and is used for the abstracts (with the –tex2 option), or can be in HTML (with the –html option); it can alos be a mixture of latex/HTML with e.g. the text between \begin{HTML} and \end{HTML} markers written in HTML.
cgiprint also permits the substitution of environment variables, either via the TeX macro \env{...} (in a TeX context), or with the usage of the $ sign (in a HTML context). It should be notieced thatn as in a shell, the braces { } can be used to delimit the variable's name, as in ${var}1.
–%letter
asks to desactivate the automatic recognition of lines startin by
%-letter.
For instance, -%R does not generate an anchor for the line
%R 1996ApJS..123.1234A
lorsque la reconnaissance automatique des bibcodes est active.
–bib | -+bib asks to transform the BibCodes embedded in the input text into anchors or GLU tags (the option -+bib removes this feature). Note that the bibCode has to be written in its canonical form (19 characters) to be recognized, and must be separated from the preceding and following text by a blank or non-ambiguous punctuation characters like comma, bracket, ... Such bibcodes are interpretated as if these were written as entités taggées <Bib:bibcode> or ou <%R bibcode> (–glu)
–cat | -+cat asks to recognized the CatCodes — codes designating astronomical catalogues like III/123 or J/A+AS/112/234 (the -+cat option disables this recognition). These CatCodes are interpretated as if these were written as entités taggées <Cat:CatCode> or <%E bibcode> (–glu)
–Dmacro=definition is meant to add macro definition(s) on the command line. Notice that the definition must be attached to the –D symbol (as for pre-processor instructions in C compiler); the leading \ backslash may be omitted, and for instance -DmyURL=http://myhost and -D'\myURL=http://myhost' are equivalent.
–f tag_file indicates a file which contains definitions. See below the tag_file section for details.
–HELP gives a list of options, and the list of all TeX macros recognized.
–html | -+html
indicates that the input text contains HTML tags
— for instance things like <B>bold text</B>
(the -+html option disables this recognition).
The list of the acceptable ``tags'' are given in the tag_file
(see tag_file section), while the non-recognized tags
are transformed: as an example, the text
Search for quasars in range 2<z<3
is (correctly) transformed into
Search for quasars in range 2<z<3
Note: an HTML tag is not recognized as proper HTML syntax (and hence the < is translated into <) if:
–ic asks to ignore the input comments; by default the input comments are translated into HTML comments.
–keep[^_$~%] asks to consider the characters enumerated as normal characters; otherwise the characters indicate the modes exponent, indice, mathematical, tilde accent, and comment modes.
–lang specifies the language (english of french) for the textx like Contents or Table es Matières. The default (not surprinsingly) is en (english).
–lis writes out, as HTML comments, a list of the known definitions:
–LIST issues a complete list of TeX macros with their equivalence, as a simple text.
–mail | -+mail
asks to interpret e-mail addresses;
note that the form
<adresse[?Subject=sujet]> also recognized,
as if written
<Mail:e-mail_adress>
or <%M e-mail> (–glu)
The -+mail option disables this recognition.
Note: email addresses are crypted.
–math^ asks to intrepret the character ^ (carret) as exponentiation, even outside the mathematical mode . The -+math disables this interpretation.
–n name assigns a name to the input stream – its default name is (stdin). This option also changes the action of the macro \thefile.
–nomath asks to use the standard font for the mathematical mode (what is between $ ... $). The default is to write the mathematical mode in italics.
–nooutput asks to not edit the result – until the next \enableoutput macro.
–oglu asks to ``filter'' the output by the program /usr/local/bin/glufilter. This option also implies –glu.
–o programme
asks to ``filter'' the output by the program
programme. The options of programme, if any,
are separated by an ampersand &.
Typically, the –glu option can be followed by
-o glu&-D&gluDic.
Note: when the –sec option is active, the
program must reside in the
directory $HTTPD_HOME/bin
(the default value of $HTTPD_HOME is /usr/httpd).
–pre indicates that the text is already pre-formatted (blanks and newlines are meaningful). This option simply inserts the HTML tags <PRE> at the beginning and </PRE> en fin (the -+pre option disables this interpretation).
–sec (secure) restricts the access to files starting by the 8-character \cgidef{ string \cgidef{ – any file not starting by this signature being rejected. In addition any executable program specified in the –o option (see above) must be in the unique $HTTPD_HOME/bin directory.
–tex indicates that the input text uses the TeX conventions. (the -+tex option -+tex disables this convention). See below the Définitions TeX section the details of the tex-like definitions.
–tex2 indicates that the input text uses a `light-TeX'' format, as the one used for the abstracts: the symbols { }, %, $ keep their usual signification, indices are within underscores _, the exponents are within carrets ^. Some other commonly used conventions are also recognized, like +/- which is written ±. The -+tex option disables this convention.
–tag tag_prefix specifies the prefix used for the conversion of entités taggées into actual anchors – the default value of tag_prefix is URL_
–vversion_number defines the HTML version of the emulation used. The default is 3.0
input_file... indicates the files to convert. The default is the standard input.
To be more detailed, if the variable $URL_Essai is defined, either
in the standard Unix environment, or in the tag_file, as
$URL_Essai=http://machine/cgi-bin/Programme?
the the complete translation of
http://machine/cgi-bin/Programme?valeur>valeur
The tagging prefix URL_ can be replaced by any other text defined in the –tag option, or by the environment variable TAG2HTML.
Example: the data concerning the cluster NGC 2244 of the Base de Données sur les Amas are tagged by <Cat:BDA/ngc/2244>. With the definition
:Cat:BDA/ http://vizier.u-strasbg.fr/cgi-bin/BDA?$$2the text <Cat:BDA/ngc/2244> is converted into:
<A HREF="http://vizier.u-strasbg.fr/cgi-bin/BDA?ngc/2244">BDA/ngc/2244</A>
<A HREF="http://vizier.u-strasbg.fr/cgi-bin/BDA?ngc/2244">BDA/ngc/2244</A>assuming the definition
%E:BDA/ http://vizier.u-strasbg.fr/cgi-bin/BDA?$$2
\cgidef{ [begin|plain|html|tex|end] [options]
......(definitions)
}
with the following meanings:
Note 1: le comportement par défaut d'un environnement (dans le cas d'environnement non défini dans la tag_file, est de générer son correspondant HTML. Par exemple, \begin{FORM} est converti en <FORM>, et \end{FORM} en </FORM>.
Note 2: il est possible d'utiliser les macros
\Beg et \End au lieu de
\begin et \end, qui ont un paramètre complémentaire
contenant les options HTML. Ainsi
\Beg{tabular}{BGCOLOR="\xcolor{LightYellow2}"}{rll}
rajoute les options de couleur de fond dans une table HTML.
Pour illustrer la différence entre les 2 commandes;
-rw-r--r-- 1 root root 404 Mar 31 2021 /etc/hosts
Il existe encore \execexpanded et \specialexpanded
qui convertissent leur argument
avant l'exécution – voir la différence entre
Note: \execexpanded est défini par:
\def\execexpanded#1{\expand1arg{#1}\exec{#1}}
Note 1: les arguments ne sont pas rescannés – à moins
d'utiliser \expand1arg, par exemple
\def\bleq#1{\expand1arg{#1}\sed{s/ /=/g}{#1}} \bleq{\exec{date}}Fri=Mar=29=13:47:10=CET=2024
Note 2: comme dans sed(1), la commande y pour faire l'équivalent d'un tr(1) est possible, par exemple
\sed{y/[A-Z][0-9]/[a-z]/}{TOUS4 LES3 CHIFFRES8 SUPPRIMES9...}donne:
Quelques variables d'environnement peuvent être utilisees:
Note: A function
char *cgitr(char *text, char *html_version)
is available in /usr/$MACHINE/lib which interprets the input
string text and returns a newly allocated interpreted result.