Skip to content

Commit

Permalink
Release 21.4.0 documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrha committed May 21, 2021
1 parent 4978330 commit 575fc4b
Show file tree
Hide file tree
Showing 23 changed files with 1,207 additions and 331 deletions.
114 changes: 62 additions & 52 deletions docs/CAF/CAF_TextRender.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ SYNOPSIS
.. code-block:: perl
use CAF::TextRender;
my $module = 'tiny';
my $trd = CAF::TextRender->new($module, $contents, log => $self);
print "$trd"; # stringification
$module = "yaml";
$trd = CAF::TextRender->new($module, $contents, log => $self);
# return CAF::FileWriter instance (rendered text already added)
Expand All @@ -49,95 +49,105 @@ Private methods


- ``_initialize``

Initialize the process object. Arguments:


- ``module``

The rendering module to use: either one of the following reserved values


- json
JSON format (using ``JSON::XS``) (JSON true and false have to be resp. ``\1`` and c<\0>)

JSON format (using ``JSON::XS``) (JSON true and false have to be resp. ``\1`` and ``\0``)



- yaml

YAML (using ``YAML::XS``) (YAML true and false, either resp. ``<$YAML_BOOL-``{yes}>> and
``$YAML_BOOL->{no}``; or the strings ``$YAML_BOOL_PREFIX."true"`` and
``$YAML_BOOL_PREFIX."false"`` (There are known problems with creating hashrefs using the
``$YAML_BOOL->{yes}`` value for true; Perl seems to mess up the structure when creating
the hashrefs))






- yamlmulti

Multi-document YAML, the keys of the passed contents are sorted and
the list of the corresponding values is used to generate the multi-document YAML.
(The keys are only used for sorting)

See ``yaml`` module for details on handling booleans.



- properties

Java properties format (using ``Config::Properties``),



- tiny

.INI format (using ``Config::Tiny``)



(Previously available module <general> was removed in 15.12.
Component writers needing this functionality can use
the \ **CCM::TextRender**\ subclass instead).

Or, for any other value, ``Template::Toolkit`` is used, and the ``module`` then indicates
the relative path of the template to use.



- ``contents``

``contents`` is a hash reference holding the contents to pass to the rendering module.



It takes some extra optional arguments:


- ``log``, ``eol`` and ``usecache``
Handled by ``_initialize_textopts`` from \ **CAF::ObjectText**\

Handled by ``_initialize_textopts`` from \ **CAF::ObjectText**\



- ``includepath``

The basedirectory for TT template files, and the INCLUDE_PATH
for the Template instance. The ``includepath`` is either a string
(i.e. ':'-separated list of paths), an arrayref (of multiple include paths)
or undef (the default '/usr/share/templates/quattor' is used).



- ``relpath``

The relative path w.r.t. the includepath to look for TT template files.
This relative path should not be part of the module name, however it
is not the INCLUDE_PATH. (In particular, any TT ``INCLUDE`` statement has
to use it as the relative basepath).
If ``relpath`` is undefined, the default 'metaconfig' is used. If you do not
have a subdirectory in the includepath, use an empty string.



- ``ttoptions``

A hash-reference ``ttoptions`` with Template Toolkit options,
except for INCLUDE_PATH which is forced via ``includepath`` option.
By default, STRICT (default 0) and RECURSION (default 1) are set.






Loading

0 comments on commit 575fc4b

Please sign in to comment.