17 Dec 2015 02:49:35 UTC
- Distribution: Rubric
- Module version: 0.156
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Testers (397 / 12 / 0)
- KwaliteeBus factor: 1
- 77.46% Coverage
- License: perl_5
- Activity24 month
- Download (75.24KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:2 non-PAUSE usersRJBS Ricardo SIGNES 😄
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Rubric::Entry::Formatter - a base class for entry body formatters
This class serves as a single point of dispatch for attempts to format entry bodies from their native format into rendered output.
my $formatted = Rubric::Entry::Formatter->format(\%arg);
This method accepts a set of named arguments and returns formatted output in the requested format. If it is unable to do so, it throws an exception.
Valid arguments are:
markup - the markup format used to mark up the text (default: _default) text - the text that has been marked up and should be formatted (required) format - the requested output format (required)
Formatting requests are dispatched according to the configuration in
Writing a formatter should be very simple; the interface is very simple, although it's also very young and so it may change when I figure out the problems in the current implementation.
A formatter must implement an
as_FORMATmethod for each format to which it claims to be able to output formatted text. When Rubric::Entry::Formatter wants to dispatch text for formatting, it will call that method as follows:
my $formatted = Formatter->as_whatever(\%arg);
The arguments in
%argwill be the same as those passed to Rubric::Entry::Formatter.
Actually, the method is found and called via
can, so a suitably programmed module can respond to
canto allow it to render into all the format it likes -- or at least to claim to.
Ricardo SIGNES <firstname.lastname@example.org>
This software is copyright (c) 2004 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.