Ángel Ortega III

Un naufragio personal

artemus - Text substitution tool and much more

SYNOPSIS

 artemus -i|--input={input file} -o|--output={output file}
	[-c|--conf={config file}]
	[-p|--paragraph={paragraph_separator}]
	[-m|--msdos] [-a|--append]

DESCRIPTION

artemus is a text substitution tool (thought mainly for preprocessing HTML). Macros are defined in the file artemus.conf, in the form key=value, being value the destination text, that can have parameters. The macro is included in the source file between the {- and } marks. The (possible) parameters are delimited by the | symbol.

Examples:

In artemus.conf file:

  1. some simple definitions Perl=<a href="http://www.perl.com">Perl</a> LWN=<a href="http://www.lwn.net">Linux Weekly News</a> separator=<br><hr><br> head=<html><body bgcolor=ffffff>
  1. definitions with parameters
  2. generic link link=<a href="http://$1">$0</a>
  3. generic meta meta=<meta name="$1" content="$0">
  4. link using the link macro CPAN={-link|CPAN|www.cpan.org}

In a source file index.artemus:

 {-head}
 {-meta|links, free software|keywords}
 <h1>Links</h1>
 <ul>
 <li>{-Perl}
 <li>{-LWN}
 <li>{-CPAN}
 <li>{-link|kernel.org|www.kernel.org}
 </ul>
 {-separator}

By running

 artemus -i index.artemus -o index.html

you obtain the file index.html:

 <html><body bgcolor=ffffff>
 <meta name="keywords" content="links, free software">
 <h1>Links</h1>
 <ul>
 <li><a href="http://www.perl.com">Perl</a>
 <li><a href="http://www.lwn.net">Linux Weekly News</a>
 <li><a href="http://www.cpan.org">CPAN</a>
 <li><a href="http://www.kernel.org">kernel.org</a>
 </ul>
 <br><hr><br>

The --paragraph argument let us define a string to substitute the empty lines in the document. If defined as <p>, you can create HTML documents separating the paragraphs with only a blank line, as artemus will fill them with <p>.

The --msdos argument creates the typical MSDOS end of line, CR+LF.

The --append argument appends the output to destination file, instead of overwriting it.

AUTHOR

(C) Angel Ortega <angel@triptico.com> 2000/2008