NAME
Text::Frundis - object interface for the frundis markup language
SYNOPSIS
my $frundis = Text::Frundis->new;
# file written in the frundis language
my $file = "somefile.frundis";
# produce a directory named "htmldir" of indexed html files
$frundis->process_source(
input_file => $file,
target_format => 'xhtml',
output_file => 'htmldir',
);
# produce a file with an html fragment
$frundis->process_source(
input_file => $file,
target_format => 'xhtml',
all_in_one_file => 1,
output_file => 'fragment.html',
);
# produce a complete html file
$frundis->process_source(
input_file => $file,
target_format => 'xhtml',
all_in_one_file => 1,
standalone => 1,
output_file => 'document.html',
);
# produce a complete LaTeX file
$frundis->process_source(
input_file => $file,
target_format => 'latex',
standalone => 1,
output_file => 'document.tex',
);
# produce a directory "epubdir" ready to be zipped into an epub
$frundis->process_source(
input_file => $file,
target_format => 'epub',
output_file => 'epubdir',
);
# add an user defined macro
$frundis->add_macro(
'some-name' => sub {
my $self = shift;
# some code...
}
);
DESCRIPTION
frundis
intends to be a semantic markup language with a roff-like syntax for supporting authoring of a variety of light to medium weight documents, from novels to technical tutorials.
The documentation of the frundis
tool and frundis
language are maintained as the mdoc manual pages frundis(1) and frundis_syntax(5), respectively. This man page describes the module interface.
Text::Frundis
provides the following methods:
- process_source(%opts)
-
This function processes frundis source from an UTF-8 encoded file, a decoded string, or reads from standard input. The %opts hash accepts the following keys:
- input_file
-
The name of an input file.
- input_string
-
The name of a decoded string.
- target_format
-
The format to produce. Can be
xhtml
,epub
orlatex
. - standalone
-
Produce a complete document. It is implied by
epub
target format, andxhtml
target format unlessall_in_one_file
is specified. - all_in_one_file
-
Boolean flag that, in case of exporting to
xhtml
, specifies that output should be a single file. - output_file
-
The name of an output file or directory. A directory when exporting to
epub
orxhtml
(unlessall_in_one_file
is specified for the last one).
- add_macro($macro_name, $code)
-
Add an user defined macro for a posterior
process_source
invocation, with name $macro_name and code $code, where $code is a coderef that takes an object as first argument, that accepts methods described in frundis_syntax(5). Works as ade -perl
in frundis source, except that @Arg isn't exported byText::Frundis
. - add_filter($tag_name, $code)
-
Add an user defined filter for a posterior
process_source
invocation, with tag $tag_name and code $code, where $code is a coderef that takes an object as first argument, that accepts methods described in frundis_syntax(5). Works as aX ftag -code
in frundis source, except that @Arg isn't exported byText::Frundis
.
SEE ALSO
frundis(1), frundis_syntax(5).
http://bardinflor.perso.aquilenet.fr/frundis/intro-en (homepage of the project)
COPYRIGHT AND LICENSE
Copyright (c) 2014, 2015 Yon <anaseto@bardinflor.perso.aquilenet.fr>
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.