Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

templates2ada(1) [debian man page]

TEMPLATES2ADA(1)					   Templates Parser User's Guide					  TEMPLATES2ADA(1)

NAME
templates2ada - generate Ada sources from a templates file SYNOPSIS
templates2ada [options] DESCRIPTION
templates2ada parses all the template files in a directory and then generates an output file from these, based on a template file (a default example of which is provided as /usr/share/doc/libtemplates-parser-dev/examples/templates.tads). The latter contains in fact two examples, depending on whether one Ada package should be generated per template, or whether a single package should be built. In the for- mer case, if you are using the GNAT compiler, you should run `gnatchop' on the resulting file. Here is an example: $ 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 ensure that you are only setting tags that actually exist in the template (and thus prevent, as much as possibly, typos in the name of tags); also, when combined with other tools, to help ensure that all tags needed by the template are properly set. templates2ada also has special knowledge about HTTP constructs and will generate Ada constants for the HTTP parameters you might receive in return. Once more the goal is to help avoid typos in the Ada code. For instance, we will consider a simple template file, found in a local file `resources/block1.thtml'. This template contains 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 will be generated. Note that this is only the default output of templates2ada, which can be fully tailored to your needs. 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
-d dir Search for template files in dir. -h Display a summary of options. -o file Write the output to file. -e ext Process all files with extension ext that are in the input directory; consider these files as template files. -r Recurse into subdirectories. -t file 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 an http parameter has a name made only of template parser tags, since no matching entry can then be created for it in the output file. 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. GNU Ada Tools 2008-05-04 TEMPLATES2ADA(1)

Check Out this Related Man Page

Any::Template::ProcessDir(3pm)				User Contributed Perl Documentation			    Any::Template::ProcessDir(3pm)

NAME
Any::Template::ProcessDir -- Process a directory of templates VERSION
version 0.07 SYNOPSIS
use Any::Template::ProcessDir; # Process templates and generate result files in a single directory # my $pd = Any::Template::ProcessDir->new( dir => '/path/to/dir', process_text => sub { my $template = Any::Template->new( Backend => '...', String => $_[0] ); $template->process({ ... }); } ); $pd->process_dir(); # Process templates and generate result files to a separate directory # my $pd = Any::Template::ProcessDir->new( source_dir => '/path/to/source/dir', dest_dir => '/path/to/dest/dir', process_file => sub { my $file = $_[0]; # do something with $file, return content } ); $pd->process_dir(); DESCRIPTION
Recursively processes a directory of templates, generating a set of result files in the same directory or in a parallel directory. Each file in the source directory may be template-processed, copied, or ignored depending on its pathname. CONSTRUCTOR
Specifying directory/directories o If you want to generate the result files in the same directory as the templates, just specify dir. my $pd = Any::Template::ProcessDir->new( dir => '/path/to/dir', ... ); o If you want to generate the result files in a separate directory from the templates, specify source_dir and dest_dir. my $pd = Any::Template::ProcessDir->new( source_dir => '/path/to/source/dir', source_dir => '/path/to/dest/dir', ... ); Specifying how to process templates process_file A code reference that takes the full template filename and the "Any::Template::ProcessDir" object as arguments, and returns the result string. This can use Any::Template or another method altogether. By default it calls "process_text" on the contents of the file. process_text A code reference that takes the template text and the "Any::Template::ProcessDir" object as arguments, and returns the result string. This can use Any::Template or another method altogether. Optional parameters dir_create_mode Permissions mode to use when creating destination directories. Defaults to 0775. No effect if you are using a single directory. file_create_mode Permissions mode to use when creating destination files. Defaults to 0444 (read-only), so that destination files are not accidentally edited. ignore_files Coderef which takes a full pathname and returns true if the file should be ignored. By default, all files will be considered. readme_filename Name of a README file to generate in the destination directory - defaults to "README". No file will be generated if you pass undef or if you are using a single directory. template_file_suffix Suffix of template files in source directory. Defaults to ".src". This will be removed from the destination file name. Any file in the source directory that does not have this suffix (or "ignore_file_suffix") will simply be copied to the destination. METHODS
process_dir Process the directory. If using multiple directories, the destination directory will be removed completely and recreated, to eliminate any old files from previous processing. SEE ALSO
Any::Template COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-14 Any::Template::ProcessDir(3pm)
Man Page