###############################################################################
#                                                                             #
#          XML to HTML translations for John Hurst's Train Web Pages          #
#                                                                             #
###############################################################################
<TrainPage>
    <HTML><HEAD>.^^.
    "</BODY></HTML>\n".{print "\n"; ""}
</TrainPage>
#
# generates the title in the border title bar, and in the "go" list
<border><TITLE>.^^.</TITLE></border>
###############################################################################
# generate the visitor number box and message.  Record the attributes defining
# the root of the trains directory, the (directory) name of the system
# relative to the root directory, and the background image to use.
<TrainHeader>
    { ($traindir,$system,$background)= 
      ($$rattr{traindir},$$rattr{system},$$rattr{background});
      $filename=main::sourcename();
      $filename=~s#.*trains/##;
      $filename=~s#\.xml$##;
      $trainpage=$system.$filename.".html";
      ""}.
    "<form method=get action=$traindir/search.cgi name=search>\n".
    "Train Search: <input type=text name=word size=50><td>\n".
    "<input type=submit name=Submit value=Search>\n".
    "</form>\n".
    </HEAD><BODY Background=".
    @<background>.'.jpg"/>'.
    "<A HREF=\"start\"></A>\n".
    {if (!(@?<visitor> && @<visitor> eq "no")) {
        main::output("<P>You are visitor number ");
        $pagecnt = $system; $pagecnt=~s#/#-#; $pagecnt=~s#-$##;
        main::output("<IMG SRC=\"/cgi-bin/Count.cgi?df=ajh-trains-");
        main::output($pagecnt.".dat\"> ");
        $updatetime=`/home/ajh/bin/fmod index.xml`;
        main::output("to this page, which was last updated at ");
        main::output($updatetime.".</P>\n");
     }}
</TrainHeader>
<title><H1>.^^.</H1></title>
################################################################################
# include the translations for handling the shunting (navigation) tools
include TrainShunt.html
################################################################################
# include some source (XML) files.  Text in this file is processed by
# the parser
<include>
    {
        my($filename)=@<file>;
        $|=1; print "[$filename";
        if (main::nested_source($filename)) {
          print " cannot open!";
        }
        print "] "; $|=0; ""
    }
</include>
################################################################################
# include some target (HTML) files. Text in this file is NOT processed by the
# parser.
<includeHTML>
    {my($filename)=@<file>; main::nested_target($filename); ""}
</includeHTML>
################################################################################
# include a shunting (navigation) tool.
<Shunting>
    {$filename=@<system>.".xml"; main::nested_source($filename); ""}
</Shunting>
################################################################################
# dummy tags for intro texts
<intro>^^</intro>
################################################################################
# collect the number sections translations
include NumberedSections.html
<photo>{
    $filename=$$rattr{insert}.".xml";
    if (defined($$rattr{directory})) {
      $photodirectory = $$rattr{directory};
    } else {
      $photodirectory = ".";
    }
    if ($photodirectory!~/^\./) {
      $photodirectory=$traindir."/".$photodirectory;
    }
    $|=1; print "[$filename";
    if (main::nested_source($photodirectory."/".$filename)) {
      print " cannot open!";
    }
    ""}.
    ^^.
    {print "] "; $|=0; ""}
</photo>
<TrainTrailer>
        "<HR>\n<TABLE>\n".
        '<TR VALIGN="center">'."\n".
        '<TD><A HREF="'.$traindir.'/index.html">'.
        '<IMG SRC="'.$traindir.'/trains.gif"></A></TD>'."\n".
        '<TD><A HREF="'.$traindir.
        '/index.html">Back to Main Railway Page</A></TD>'."\n". 
        '<TD><A HREF="'.$traindir.'/new/index.html">'.
        '<IMG SRC="'.$traindir.'/new/new.gif"></A></TD>'."\n".
        '<TD><A HREF="'.$traindir.
                '/new/index.html">Go to The Latest!</A></TD>'."\n".
        "</TR>\n".
        '</TABLE>'."\n".
        '<P>This page and its images are copyright, A.J.Hurst 2000<BR>'."\n".
        'last updated by <A HREF="http://www.csse.monash.edu.au/~ajh/">'."\n".
        "John Hurst</A> on $updatetime\n".
        '</P>'."\n".
        '<FONT SIZE="-2">'.
        '<P>Maintainer use only; not generally accessible: '.
        '<A HREF="file:/home/ajh/trains/'.$trainpage.
        '">File version</A>  '."\n".
        '<A HREF="http://central/~ajh/trains/'.
        $trainpage.'">Home Server</A> '."\n".
        '<A HREF="http://hawthorn.csse.monash.edu.au/~ajh/trains/'.
        $trainpage.'">Work Server</A> '."\n".
        '<A HREF="http://www.csse.monash.edu.au/~ajh/trains/'.
        $trainpage.'">CSSE Server</A> '."\n".
        '</P></FONT>'."\n".
        '</BODY>'."\n".
        '</HTML>'."\n"
</TrainTrailer>
################################################################################
# some standard translations
include basic.html

<quotation><UL>.^^.</UL></quotation>
<quote>'<UL><PRE>'.^^.'</PRE></UL>'</quote>
<img><IMG SRC="@<src>">.^^</img>
<uri>
        {
          $href=@<href>;
          if (@?<dir>) {$dir="$traindir/".@<dir>."/";} else {$dir="";}
          if ($href!~/^http/) {$href="$dir$href";};
          ""
        }.
        <A HREF=".$href.">.
        ^^.
        </A>
</uri>
<thumb>
        <A HREF=@<href>><IMG ALIGN=@<align> HEIGHT=@<height> \
        WIDTH=@<width> SRC=@<source>></A>.
        ^^.
        <BR CLEAR="all">
</thumb>
<inline><IMG SRC="@<src>">.^^.</IMG></inline>
#
#################################################################################
## now the translations for handling the conversion of images from XML to HTML. #
## Most of these just record the relevant data for final output in the closing  #
## image tag.                                                                   #
#################################################################################
<name></name>
<image/thumb>
        {if (@?<width>) {$width = @<width>} else {$width = ""};""}.
        {if (@?<height>) {$height = @<height>} else {$height = ""};""}.
        {if (@?<uri>) {$uri = @<uri>} else {$uri = ""};""}.
        ^^
</image/thumb>
<size>
        {if (@?<bytes>) {$bytes = @<bytes>} else {$bytes = ""};""}.
        {if (@?<pixels>) {$pixels = @<pixels>} else {$pixels = ""};""}
</size>
<date>
        {if (@?<taken>) {$taken = @<taken>} else {$taken = ""};""}.
        {if (@?<catalogued>) {$catalogued = @<catalogued>} 
         else {$catalogued = ""};""}.
        {if (@?<installed>) {$installed = @<installed>} 
         else {$installed = ""};""}
</date>
<medium></medium>
<photographer></photographer>
<catalogue>
    {if (@?<cd>) {$cd = @<cd>} else {$cd = ""};""}
    {if (@?<slide>) {$slide = @<slide>} else {$slide = ""};""}
    {if (@?<print>) {$print = @<print>} else {$print = ""};""}
    {if (@?<digital>) {$digital = @<digital>} else {$digital = ""};""}
</catalogue>
<image/index></image/index>
<image/description></image/description>
#################################################################################
## here's where the real work gets done.
<image>{
        $name=$width=$height=$uri=$bytes=$pixels=$taken=$catalogued=
        $photographer=$medium=$slide=$cd=$print=$digital=
        $index=$description=""; ""
        }.
        ^^.
        "<P>\n".
        "<A name=\"$name\" HREF=\"$photodirectory/$name.jpg\">\n".
        "<IMG align=left width=\"$width\" height=\"$height\" ".
        "src=\"$photodirectory/thumb/$name.gif\" \n".
        "     ALT=\"click me for full image\"></A>\n".
        "<UL>\n".
        "<LI><I>Image</I> : <A HREF=\"$photodirectory/$name.jpg\">$name</A>, ".
        "$bytes bytes, $pixels pixels</LI>\n".
        {
          if ($catalogued) {
            main::output("<LI><I>Date</I> : $taken, catalogued $catalogued</LI>\n");
          } elsif ($installed) {
            main::output("<LI><I>Date</I> : $taken, installed $installed</LI>\n");
          } else {
            main::output("<LI><I>Date</I> : $taken</LI>\n");
          }
        }.
        "<LI><I>Photographer</I> : $photographer</LI>\n".
        "<LI><I>Medium</I> : $medium".
        {if ($cd) {main::output(", CD location $cd");} ""}.
        {if ($slide) {main::output(", slide number $slide");} ""}.
        {if ($print) {main::output(", print number $print");} ""}.
        {if ($digital) {main::output(", image location $digital");} ""}.
        "</LI>\n".
        "<LI><I>Description</I> : $description</LI>\n".
        "</UL>\n".
        "</P>\n".
        "<BR clear=\"ALL\">\n"
</image>
########################################################################
# quick index stuff
<quicklist><UL>.^^.</UL></quicklist>
<quick>
    '<LI>'.
    { $href=@<href>;
      if (@?<new>) {
        my($op)='<IMG SRC="';
        if (@<new> eq "1") {$op.="new_tiny.gif"} 
        else {$op.="new_tiny2.gif"};
        $op.='">'
      }
    }.
    '<A HREF="@<href>.html">'.
    ^^.
    '</A>  <I>'.{`/home/ajh/bin/fmodz $href.xml`}.</I></LI>
    </quick>

#&ldq;"
#&rdq;"
#
# Local Variables:
# mode: XML
# fill-prefix: "    "
# fill-column: 78
# eval: (auto-fill-mode 1)
# End:

274 accesses since 13 Oct 2008, HTML cache rendered at 20090820:1136