hsc

Special Tags

hsc adds some special tags, which can be quite useful for maintainers of big HTML-projects. If you use them right, they can save a lot of time and nerves.

Comments

You can insert a comment with
<* This is a hsc-comment *>
You can also nest such comments.

And you can comment out sections of html-source without any problems for the browser. This simply is possible because comments in the HSC-source are not written to the HTML-object.

Of course, if you need the standard comments, you can use

<!-- This is a html/sgml-comment -->
as usual.


Execute shell command

A shell command can be executed with
    <$EXEC COMMAND="command">
An example usage would be to insert a listing of a directory:
<$if (__SYSTEM__="AMIGA")>

<$exec COMMAND="list >t:hugo.list DIRS">   <* write listing to "t:hugo.list" *>
<$include FILE="t:hugo.list" SOURCE PRE>   <* include directory list *>
<$exec COMMAND="delete t:hugo.list QUIET"> <* remove temporary file *>

<$else><$if (__SYSTEM__="UNIX")>

<$exec COMMAND="ls -al >hugo.list">       <* write listing to "t:hugo.list" *>
<$include FILE="hugo.list" SOURCE PRE>    <* include directory list *>
<$exec COMMAND="rm hugo.list">            <* remove temporary file *>

<$else>

<* unknown OS: abort conversion with error message *>
<$message text="operating system not supported" class="fatal">

</$if></$if>
And the data created by this code sequence would look like this:
inc                          Dir ----rwed Today     17:48:21
image                        Dir ----rwed Thursday  07:10:36
features                     Dir ----rwed Yesterday 04:10:17
macro                        Dir ----rwed Thursday  06:45:15
exmpl                        Dir ----rwed Yesterday 03:43:59
5 directories - 10 blocks used
If the command's return code is not equal to zero, a warning message will be displayed.

Conditional conversion

As there is a lot to tell about this feature, it has it's own page.

Include file

A hsc-file can be included to the text using
<$INCLUDE FILE="filename" [SOURCE] [PRE]>
If you include a file this way, it is handled as an usual hsc-file. That means, all tags and special characters are handled as before.

To include a source file, eg a C- or HTML-source so that the tags are not interpreted but displayed, add the optional boolean attribute SOURCE.

<$INCLUDE FILE="hugo.c" SOURCE>
Now the basic special characters "<", ">" and "&" are replaced by their entities.

Note that this does not include a <PRE>-tag to render the text as it exists with the same line breaks and spaces.

To get this done, you should use the optional boolean attribute PRE. This inserts a <PRE> before the included data and a </PRE> afterwards.


Insert several stuff

You can insert several stuff using the tag
<$INSERT what [options]>

Insert current date and time

You can insert the current date and time simply by
<$INSERT TIME>
using a default format.

Optionally, you can pass a format-string, that discribes the time. As hsc just calls the ANSI-C function strftime() to perform that task, I've included an extract of the man-pages to this function:

        Each conversion specification is replaced by the characters as follows
        which are then copied into the buffer.

         %A    is replaced by the full weekday name.

         %a    is replaced by the abbreviated weekday name, where the abbreviation
              is the first three characters.

         %B    is replaced by the full month name.

         %b or h
              is replaced by the abbreviated month name, where the abbreviation
              is the first three characters.

         %C    is equivalent to ``%a %b %e %H:%M:%S %Y'' (the format produced by
              asctime(3).

         %c    is equivalent to ``%m/%d/%y''.

         %D    is replaced by the date in the format ```mm/dd/yy'''.

         %d    is replaced by the day of the month as a decimal number (01­31).

         %e    is replaced by the day of month as a decimal number (1­31); single
              digits are preceded by a blank.

         %H    is replaced by the hour (24­hour clock) as a decimal number
              (00­23).

         %I    is replaced by the hour (12­hour clock) as a decimal number
              (01­12).

         %j    is replaced by the day of the year as a decimal number (001­366).

         %k    is replaced by the hour (24­hour clock) as a decimal number (0­23);

              single digits are preceded by a blank.

         %l    is replaced by the hour (12­hour clock) as a decimal number (1­12);
              single digits are preceded by a blank.

         %M    is replaced by the minute as a decimal number (00­59).

         %m    is replaced by the month as a decimal number (01­12).

         %n    is replaced by a newline.

         %p    is replaced by either ``AM'' or ``PM'' as appropriate.

         %R    is equivalent to ``%H:%M''

         %r    is equivalent to ``%I:%M:%S %p''.

         %t    is replaced by a tab.

         %S    is replaced by the second as a decimal number (00­60).

         %s    is replaced by the number of seconds since the Epoch, UCT (see
              mktime(3)).

         %T or X
              is equivalent to ``%H:%M:%S''.

         %U    is replaced by the week number of the year (Sunday as the first day
              of the week) as a decimal number (00­53).

         %W    is replaced by the week number of the year (Monday as the first day
              of the week) as a decimal number (00­53).

         %w    is replaced by the weekday (Sunday as the first day of the week) as
              a decimal number (0­6).

         %x    is equivalent to ``%m/%d/%y %H:%M:%S''.

         %Y    is replaced by the year with century as a decimal number.

         %y    is replaced by the year without century as a decimal number
              (00­99).

         %Z    is replaced by the time zone name.

         %%
            is replaced by `%'.
Example:
<$INSERT TIME FORMAT="%b %d %y">
inserts current date with the strange ANSI-C __TIME__-format.

Insert text

As an required argument, you must give a string that contains the text. Example:
<$INSERT TEXT="hugo was here!">
inserts the text "hugo was here". Of course, this does not make much sense.<$INSERT TEXT="..."> is suggested to be used with attribute values. Example:
<$INSERT TEXT=<href>>
inserts the value of the macro-attribute href.

Set attributes

You can create or update an attribute and pass a value to it via
<$LET [$UPDATE] [$GLOBAL] attribute>
The optional flag $UPDATE is used to update the value of an already existing attribute.

If you define an attribute via <$LET> inside a macro, it is of local existence only and is removed after processing the macro. You can suppress this with using the optional flag $GLOBAL: in this case, the attribute exists until the end of conversion.


Define macros

I think, this feature needs an own page...

User messages

During conversion, you can envoke messages by yourself using
    <$message TEXT="message text" [CLASS="class"]>
For an example, look at <$exec>.

Don't parse section

If you created some perverted HTML source or use features hsc can't handle (which is theoretically impossible), you can keep of hsc from parsing this section by surrounding it with <| ... |>. Of course, this is a dirty hide-out and should be used only for special cases.

Define a new entity

This tag should be used within hsc.prefs only. It defines a new entity.

Define a new tag

This tag should be used within hsc.prefs only. It defines a new tag, and is used quite similar to <$MACRO>.
MAIN COPY PREV NEXT
Thomas Aglassinger ( agi@sbox.tu-graz.ac.at ), 21-Dec-1995