Menu

AidaHelp_3 Log in to Edit

Bernard Desgraupes

Top | Prev | Next

<A name="MARKSEC1"></A>

Quick start

Here is a quick example to give a more precise idea of what the Aida
mechanism is about.

Using your favorite text editor, create a new file named example.aida with a following contents:

    :DestDir:           aida_output/
    :Title:             Quick Example

    ((s1 Introduction s1))

    The ((b Aida b)) project is two-fold: 
    ((ol
    ((li it defines a simple common ((i markup language i)). li))
    ((li it provides a ((i compiler i)) to convert the markup into target 
    formats. li))
    ol))

    ((s1 Table s1))

    ((table border=1 align=center
    ((tr Number Element Symbol tr))
    ((tr 1  hydrogen    H tr))
    ((tr 2  helium  He tr))
    ((tr 3  lithium Li tr))
    ((tr 4  beryllium   Be tr))
    table))

    Updated on ((e clock format [clock seconds] -format "%Y-%m-%d" e)).

This file is an input file written in the aida syntax. It can now be
converted into various formats such as Html, Latex, Text, Mediawiki (the
editing format used by Wikipedia), etc.

For instance, the following command

    aida convert -target text example.aida

will produce an output like this:

1 Introduction

The Aida project is two-fold: 
    1. it defines a simple common markup language.

    2. it provides a compiler to convert the markup into target formats.

2 Table

                        _______________________________                         
                        | Number |  Element  | Symbol |                         
                        _______________________________                         
                        |   1    | hydrogen  |   H    |                         
                        _______________________________                         
                        |   2    |  helium   |   He   |                         
                        _______________________________                         
                        |   3    |  lithium  |   Li   |                         
                        _______________________________                         
                        |   4    | beryllium |   Be   |                         
                        _______________________________

Updated on 2011-02-08.

Now, let us change the target to Html format like this:

    aida convert -target html example.aida

This will produce the same contents in the Html language, ready for
publication on the Web :


<HTML>
<HEAD>
<TITLE>Quick Example</TITLE>
</HEAD>
<BODY>

<H1><A NAME="AIDASEC0"/>Introduction</H1>

The <B>Aida</B> project is two-fold: 
<OL type="1" start="1">
    <LI>it defines a simple common <I>markup language</I>.</LI>
    <LI>it provides a <I>compiler</I> to convert the markup into target 
formats.</LI>
</OL>

<H1><A NAME="AIDASEC1"/>Table</H1>

<TABLE border="1" align="center">
<TR><TD>Number</TD><TD>Element</TD><TD>Symbol</TD></TR>
<TR><TD>1</TD><TD>hydrogen</TD><TD>H</TD></TR>
<TR><TD>2</TD><TD>helium</TD><TD>He</TD></TR>
<TR><TD>3</TD><TD>lithium</TD><TD>Li</TD></TR>
<TR><TD>4</TD><TD>beryllium</TD><TD>Be</TD></TR>
</TABLE>

Updated on 2011-02-08.

</BODY>
</HTML>

Similarly, the command

    aida convert -target latex example.aida

would generate output in the Latex format, and the command

    aida convert -target mediawiki example.aida

would generate output in the Mediawiki format, ready to be published in
a Wikipedia article.

The previous examples demonstrate several characteristics of the markup
language. It makes use of pairs of tags such as ((i i)), ((b b)) which
enclose a portion of the text. In the example, the ((i tag switches
the text style to italics, the ((ol tag starts an ordered list, the
((li tags start list items, etc.

The first two lines are header lines: they
define settings concerning the conversion process. For
instance, the following header line

    :DestDir:           aida_output/

specifies the name of an output folder.
As a consequence, the command

    aida convert -target latex -output myfile.html example.aida

writes the output in a file named myfile.html located in a
subdirectory named aida_output inside the current directory.

The last line of the example

    Updated on ((e clock format [clock seconds] -format "%Y-%m-%d" e)).

shows how Aida can execute instructions while processing its input. The
instruction enclosed between the pair of tags ((e e)) is written in the
Tcl language and returns
the date of the day. The text delimited by the ((e e)) tags is
replaced by the actual date in the output.

The aida compiler embeds a Tcl
interpreter
making it possible to execute any valid Tcl code in a pair of
tags ((e e)).


Related

Wiki: AidaHelp_1
Wiki: AidaHelp_2
Wiki: AidaHelp_4

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.