TEMPLATES2ADA(1)
π templates2ada(1) β the Templates Parser User's Guide page, bestie edition π
β¨ NAME β¨
templates2ada β generate Ada sources from a templates file. That's the whole mood. π
π¦ SYNOPSIS π¦
templates2ada [options]
π DESCRIPTION π
Okay so picture this: templates2ada parses all the template files in a directory, then generates an output file from those, based on a template file. A default example of that template file is literally right here: /usr/share/doc/libtemplates-parser-dev/examples/templates.tads.
That template file actually contains two examples, depending on whether one Ada package should be generated per template, or whether a single package should be built. In the former case, if you are using the GNAT compiler, you should run gnatchop on the resulting file. Example time:
$ rm -f src/templates/*.ads
$ templates2ada -d resources/ -o src/templates/generated -r
$ cd src/templates; gnatchop -w -q generated
$ rm -f src/templates/generated
One of the goals of templates2ada is to make sure you're only setting tags that actually exist in the template. That's how it helps prevent typos in tag names as much as possible. Also, when it's combined with other tools, it helps make sure all the tags needed by the template are properly set. Teamwork, no cap. π«Ά
templates2ada also has special knowledge about HTTP constructs and will generate Ada constants for the HTTP parameters you might receive in return. Again, the goal is avoiding typos in the Ada code. Iconic behavior, honestly.
For instance, let's look at a simple template file in a local file resources/block1.thtml. This template has the following simple html code:
<form>
<input name="PARAM1" value="@_TAG1_@" />
<input name="PARAM2" value="@_TAG2_@" />
</form>
When you run templates2ada, the following Ada package gets generated. Note that this is only the default output of templates2ada; it can be fully tailored to your needs. Slay.
package Templates.Block1 is
pragma Style_Checks (Off);
Template : constant string := "resources/block1.thtml";
Tag1 : constant String := "TAG1";
Tag2 : constant String := "TAG2";
package Http is
Param1 : constant String := "PARAM1";
Param2 : constant String := "PARAM2";
end Http;
end Templates.Block1;
π OPTIONS π
Here's the flag menu, bestie β every single one, no skips:
-ddir β Search for template files in dir. directory scavenger hunt unlocked-hβ Display a summary of options. the help-me-bestie button-ofile β Write the output to file.-eext β Process all files with extension ext that are in the input directory; consider these files as template files.-rβ Recurse into subdirectories.-tfile β Use file as the output template file. The templates parser comes with an example for such a file,/usr/share/doc/templates-parser/examples/templates.tads, that you can adapt to your own needs.-vβ Verbose mode. This will output a warning when anhttpparameter has a name made only of template parser tags, since no matching entry can then be created for it in the output file. warning unlocked, but make it useful
π SEE ALSO π
templatespp(1)- The Template Parsers User's Guide in package
libtemplates-parser-dev.
π AUTHOR π
templates2ada was written by Pascal Obry <p.obry@wanadoo.fr> as part of the Ada Web Server.
This manual page was written by Ludovic Brenta <lbrenta@debian.org> for Debian GNU/Linux.
And that's the page, bestie! This iconic manual is from GNU Ada Tools, dated 2008-05-04. Periodt. ππ«Άβ¨
π¦ where this page comes from
- debian bookworm: libtemplates-parser16-dev 23.0.0-3 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- debian trixie: libtemplates-parser-dev 25.0.0-2 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- ubuntu jammy: libtemplates-parser14-dev 21.0.0-2 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- ubuntu noble: libtemplates-parser-dev 24.0.0-2build1 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- ubuntu noble: libtemplates-parser-dev 24.0.0-2build1.1 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- ubuntu questing: libtemplates-parser-dev 25.0.0-2build1
- ubuntu resolute: libtemplates-parser-dev 25.0.0-2build2 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- ubuntu stonking: libtemplates-parser-dev 25.0.0-2build3 Β· GPL-3.0-or-later WITH GCC-runtime-library exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms