GTML Tool tutorial

Contents

GTML questions..

What is GTML?
GTML is a tool designed to help with generation of static web pages. Well, at least I use it for that.
From author's description:
From GTML documentation: What's GTML.
GTML is an HTML pre-processor which adds some extra features specially designed for maintaining multiple Web pages.
Where can I find it?

From GTML documentation: Where's GTML.

The home page of GTML is at http://www.lifl.fr/~beaufils/gtml/ , and archives may be found at ftp://ftp.lifl.fr/pub/users/beaufils/gtml/.
Is there any documentation about it?
I got it with tool's sources :)
What's the philosophy?
The philosophy is that you write your html files, just like you were writing before, except that it will be easier now :).
  • you won't have to rewrite file's header or footer every time (that's the coolest thing).
  • you can define some global constants, variables that GTML will replace with its values
  • for example: instead of writing &lt;<b>tag<b>& you can write: <[tag]> in your html source! (with little extra work of course) to achieve this: <tag>
  • you can define your html source file as a variable, and use variable when pointing to a file, instead writing file's name. Gtml will convert variable to file's name. So when you move or rename your html source files, there is no need to update other pages pointing to changed file (as soon, as you were using variables of course)
  • generating pages is fast, GTML can create Makefile for you (just hit F7 in Vim)

Samples

OK. I can see that page as a result of using the tool, but show me what to do to make it work!
Here is the source of that page (cut for clear view):
 #define VERSION $Id: gtml.gtml 3768 2005-07-25 23:47:33Z nthx $
 #define TITLE Tomasz Nazar - GTML Tool

 #include "inc-header.gtml"

<div class="back">
<div class="section" id="gtml">

<h2>GTML</h2>
<dl>
    <dt>What is GTML?</dt>
    <dd>
        GTML is a tool for helping with generation of web pages. 
        I use it for that.
        ...
    </dd>
    ...
    <dt>Is there any documentation about it?</dt>
    <dd>
        I got it with tool's sources :)
    </dd>

    <dt>What's the philosophy?</dt>
    <dd>
        The philosophy is that you write your html files 
        ...
    </dd>
</dl>
</div>
</div>

 #include "inc-footer.gtml"
My sources
Watch use of gtml file variables in the sources!
Simple sample: Using variables
GTML Source (in): [sample.gtml]
        #define MOVIE_TITLE Two Towers / 2CD

        <p>
        My favourite movie is <<MOVIE_TITLE>>
        
After:
15:08:05$~/public_html> gtml sample.gtml 
--- sample.gtml ---
15:08:07$~/public_html> 
        
HTML Source (out): [sample.html]
        <p>
        My favourite movie is Two Towers / 2CD
        
Advanced sample: Using filename variables
PROJECT.gtp
define INCLUDE_PATH includes/
definechar <{           <i>
definechar }>           </i>
definechar <url>        <<url(
definechar </url>       )>>
define url(url,text)          <a href="url">text</a>
//...

filename HOME           index-new.gtml
filename GTML           html/gtml.gtml
filename ANT            java/ant.gtml
filename ANT_PL         java/ant_pl.gtml
filename CSS_OLDSTYLE   css/core/Oldstyle.css
filename IMG_POLISH_VER  images/pl.png
filename IMG_ENGLISH_VER images/gb.png
//and <<HOME>> in java/ant.gtml will be replaced 
//to: ../index-new.html in java/ant.html
//....

hierarchy
//^^ important
//...

These are (my own) GTML tags and commands:

<{word}>
makes <i>word</i> which renders to: word
<[word]>
makes &lt<b>word</b>&gt; which renders to: <word>
<url>url, text</url>
makes <a href="url">text</a> which renders to: text

ant.gtml (part of it)
 #define VERSION $Id: gtml.gtml 3768 2005-07-25 23:47:33Z nthx $
 #define TITLE Tomasz Nazar - Ant tutorial [English]
 #define KEYWORDS ant tutorial English basic advanced tasks
 #define CREATED_WITH_GIMP
 #define HTML_VALIDATED
 #include "inc-header.gtml"

<h1>Ant tutorial</h1>
<iurl><<ANT>>,English version,<<IMG_ENGLISH_VER>></iurl> |
<iurl><<ANT_PL>>,Wersja Polska,<<IMG_POLISH_VER>></iurl>

<h2>Contents</h2>
<dl>
    <dt>What is the design of Ant?</dt>
    <dd>
        The root of XML file is a <[project]> tag.
        It consists of
        several <{targets}>. Each <[target]> consists of several
        <{tasks}>.
        <br/>
    ...
        <url>http://jakarta.apache.org/ant, original documentation</url>
        Here are some examples:
        <br/>

 #include "inc-footer.gtml"

Designed with CSS| Get Firefox!| | Opel Omega Forum|

Copyright © Tomasz Nazar 2007
Revision: $Id: gtml.gtml 3768 2005-07-25 23:47:33Z nthx $