NAME

oEdtk::LaTeX - build the LaTeX index of an edtk document

SYNOPSIS

use oEdtk::LaTeX qw(make_index latex_escape_string tag_args);

my $index = make_index( \%index_variables );
my $s     = latex_escape_string($utf8_string);

DESCRIPTION

Helpers used by an edtk application to turn Perl data into LaTeX: escape a string to the latin-9 output encoding (latex_escape_string), build the index definitions (make_index, ged_tag, tag, tag_args, concat_string, latex_boolean), translate a unit (translate_unit), and dump the character table for debugging (demo, demo_write, demo_expected_write, unfold_list).

Ported from the fork's oEdtk::LaTeX at S23. The latin-9 character table (@ORDS and compute_character_cache*) is kept verbatim from the fork. The fork exported demo_write, demo_expected_write and unfold_list without defining them; this port defines all three, so every exported symbol is callable.

FUNCTIONS

tag

my $latex = tag($name, \%pairs);

Return the LaTeX definition of one index tag from a hash of key/value pairs, or a one-line error list when the tag or a value is invalid.

tag_args

my $latex = tag_args($name, @args);

Build the backslash-tag call for $name and the argument list, where an argument may be a coderef paired with its own arguments.

ged_tag

my $latex = ged_tag($name, $value);

Return a LaTeX gdef definition of $name holding the escaped $value, or an error list when the tag is invalid.

make_index

my $index = make_index(\%index_variables, %extra);

Turn an index-variables hash, plus an optional extra hash, into the LaTeX index text, one definition per key.

demo

demo();

Write a LaTeX character table for the latin-9 ordinals to /tmp/demo_chars.tex (a diagnostic helper).

demo_write

demo_write();

Write the same character table, with unmapped characters replaced, to /tmp/demo_write.tex.

demo_expected_write

demo_expected_write();

Write the expected character table to /tmp/expected_write.txt, for a human to diff against "demo_write".

latex_escape_string

my $escaped = latex_escape_string($string);

Escape a string to the latin-9 output encoding.

translate_unit

my $latex = translate_unit($unit);

Translate a unit (EUR or a percent sign) to its LaTeX form; an unknown unit is an error.

concat_string

my $string = concat_string(@parts);

Concatenate the arguments into one string, escaping scalars and calling coderef arguments.

latex_boolean

my $word = latex_boolean($bool);

Return true or false for the boolean.

unfold_list

my @flat = unfold_list(@list);

Unfold the list one level, replacing each array reference element with its items.

The unexported helpers latex_escape_character, latex_escape_string_no_byte_a6, latex_list, special_colored_address, latex_xkeyval_value, remove_roman_numbering, sanitize_csv, index_value, check_index_is_complete, is_valid_tag, interpret_argument, the compute_character_cache* builders and @ORDS are not part of the public API.

AUTHOR

The oEdtk team.