Euphoria documenting -- eudoc, creole

eudoc creole - Source Documentation Tools

Two tools, written in Euphoria---eudoc.ex and creole.ex---make writing and managing documentation easier. They are used to produce HTML and PDF documentation for the OpenEuphoria project.

There is a lot of flexibility in how documentation can be written. Documentation is written using the creole markup language which provides many features such as: titles and sections, lists, tables, callout notes, cross-links, and font effects.

eudoc.ex lets you:

  • Write documentation in a plain text file.
  • Write documentation within source-code.
  • Combine documentation written in scattered files into one text file.

creole.ex converts creole formatted text to:

  • Produce HTML documentation.
  • Produce LaTeX documentation.
  • Produce PDF documentation using third-party software.
  • Provides formatting, indexing and cross links.

Creole in general is a text markup language popular as a simple way to format wiki content. The OpenEuphoria wiki and forum will accept creole formatted text. It is an equally simple and convenient way of formatting Euphoria documentation.

Documentation Software

The programs required for creating documentation are hosted on our Mercurial SCM server at

  1. eudoc:
  2. creole:

Creole.ex can produce LaTeX formatted documentation, which in turn requires:

Creole.ex by default produces HTML formatted documentation, which can be viewed directly in any web browser. Third-party software can convert this HTML into a PDF document. Two open-source choices for Windows or Unix are:

The htmldoc program has a convenient GUI but produces plain PDF. The wkhtmltopdf program is a command-line program that can use a style.css file to customize the look of the PF.

Look at the Euphoria source-code distribution as an example of how documentation may be written:

Additional information may be found at:

After downloading the source-code for eudoc and creole the most convenient way to use them may be to compile them with euc. The executables can then be copied to your working directory, or even to /euphoria/bin.

Creole Formatting

The simplest form of documentation is plain text file that accompanies your project. A example of formatted text using common elements:

== Section -- Creole Demo 
//italic// **bold** ##fixed## __underline__ 
* bullet 
* lists are 
* easy to produce 
||  tables || are | 
| //easy// to __produce__ |  with bold headers | 
-- euphoria code is colorized 
for i=1 to 5 do	  
   ? i 
end for 
Learn more about creole from the website. 

Copy the previous text into a file called test.txt and execute eudoc:
eudoc test.txt -o foo.txt 
You must explicitly specify the output file as -o foo.txt (the actual name is not critical.) (In this example the input and output files look almost identical because this is only a simplistic example.)

The output of the eudoc program is the used by the creole program:

creole foo.txt 

The default file produced is test_txt.html which when viewed in a web browser will look like:

Section -- Creole Demo

italic bold fixed underline

  • bullet
  • lists are
  • easy to produce
tables are
easy to produce with bold headers
-- euphoria code is colorized 
for i=1 to 5 do	  
   ? i 
end for 

Executing creole as:

creole foo.txt -f LaTeX 
produces a LaTeX file, which when processed by the LaTeX program produces a PDF file. Alternatively a PDF could be produced by:
wkhtmltopdf test_txt.html mypdf.pdf 

Creole is a text markup language used in wikis, such as the Euphoria Wiki, and for documenting source-code. Learn more about creole from the website. From there you can download a cheatsheet which will help when learning Creole.

More details about Euphoria Creole can be found at the Euphoria Wiki under CreoleHelp.

Documentation tags

Documentation can be written within Euphoria source-code using the regular - - comment markers starting in the first column. Documentation must be written as a block of comments starting with a special tag and ending with a blank line. The eudoc program can then extract the text in these comment blocks for use by the creole program.

Documentation is embedded in source-code using the Euphoria line comment. There are two kinds of starting tags:

--****         <== start of general documentation tag 
--**           <== start of special source documentation tag  
                -- extract the signature of the subroutine that 
                -- immediately follows this comment block                  

The eudoc program primarily extracts text from source-code. Creole formatting is not required; thus eudoc could be used to produce simple plain text documentation if you wish.

General Documentation

"General" documentation starts with the ( --**** ) tag, continues with lines starting with -- in the first column, and ends with the next blank line. The tags and -- will not appear in the documentation.

-- general text, thus tagged, will be extracted by eudoc 
-- write your documentation here... 
-- blank line is a terminator, this line is not included 


general text, thus tagged, will be extracted by eudoc 
write your documentation here... 

Source Documentation

"Source" documentation starts with the ( --** ) tag. Locate them before a subroutine or identifier that you wish to be described in your documentation. The eudoc program will extract the "signature" of the subroutine and combine it with the comments you write in that comment block.

Starting with the source-code file favorite.ex:

-- this is my favorite routine 
public procedure hello( sequence name ) 
   printf(1, "Hello %s!", {name} ) 
end procedure 

Executing eui eudoc -o foo.txt favorite.ex produces:

==== hello 
include favorite.ex 
public procedure hello(sequence name) 
  This is my favorite routine. 

Process with eui creole foo.txt:

include favorite.ex 
public procedure hello(sequence name) 

This is my favorite routine.

If you examine the Euphoria source-code will appreciate how these steps were used to create the documentation you are reading now.

Assembly file

Large projects are managed using an assembly file, which is a list of files (source-code, and external) that will be incorporated into one output file. Look at euphoria/docs/ for the file used to produce this documentation.

:= Euphoria Programming Language v4.0 
:<<LEVELTOC level=1 depth=4>> 
# General Routines 

A portion of the file used to produce the Euphoria documentation. Lines starting with # are just comment lines. Lines starting with : are used by the creole program. In this sample := is marks a chapter title, <<LEVELTOC... inserts a table of contents for that chapter.

The remaining lines are filenames that are read by eudoc and used to assemble the final documentation file. Plain text files and Euphoria source-code may be used as starting documents. The filenames will include directory information relative to the location of the assembly file.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu