dtRdr::Book::ThoutBook_1_0::Base - shared stuff
my $book = dtRdr::Book::ThoutBook_1_0_subclass->new();
URI-escapes the id because Thout1.0 books didn't have a proper ID.
$book->set_id($id);
$id = $self->_id_escape($id);
$book->set_base_dir($dir);
Overrides the dtRdr::Book method.
This is needed because Thout 1.0 implements a showpage instruction (a pseudo goto) and because loading a render="false" *root* node renders the first child.
my $toc = $book->find_toc($id);
$self->set_xml_content($string);
my $meta = $self->setup_metadata(\%propsheet, \%xml_props);
my %props = $self->load_properties;
Transform parsed info into properties hash.
my %propinfo = $self->propify(%parse_info);
$self->finish_load;
Returns a Range with the appropriate TOC node and start/end positions (in cache-coordinates.)
my $range = $book->reduce_word_scope($node, $start, $end);
In our case, this involves checking each node along the way to ensure that we properly account for holes (renderchildren=0s' children and render=0s are holes.)
Translate a rendered position to a node position.
$self->_RP_to_NP($node, $pos);
Translate the node position to a rendered position.
my $render_pos = $self->_NP_to_RP($node, $node_position);
Gets the holes (nonrendered children) for a node. @holes will be a list of [$global_start, $global_stop] array-ref pairs.
my @holes = $self->_node_holes($node);
Our rendered structure does not map directly onto the TOC structure.
We have to handle:
showpage - does nothing except give a different response for find_toc() -- therefore we ignore it in all node relations
render=0 - trim yourself
render="parent" - trim yourself
render_children=0 - trim all your children
root node - is a switcharoo to its first child when render=false
my @nodes = $book->descendant_nodes($node); render_children=0 - stop descending render=0 - bye showpage - not an issue
Returns the node's ancestors, taking into account whether this node or one of it's parents is a hole.
my @nodes = $book->ancestor_nodes($node);
Run through a sax parse to build-up a TOC tree and memorize some byte offsets and character positions, extract package info, file your taxes, etc.
my %info = $self->build_toc;
Returns a hash of properties/metadata.
Gets the SAX parser handler subs.
my $data = $self->_get_toc_handlers(%options) $parser->setHandlers(%{$data->{handlers}}); ... return($data->{done}->());
Options: none for now
$self->_load_cached_toc($filename);
$book->whitespace_before($node);
Get the content for the $id (ala find_toc().)
find_toc()
my $content = $book->get_content_by_id($id);
Gets trimmed, wrapped, and NBH'd content.
my $content = $book->get_content($toc);
my $xml = $self->get_trimmed_content($toc);
@plan = $self->_build_trim_plan($node);
$self->_append_trim_plan($start, $stop, \@plan);
$book->get_copy_content($toc);
$book->get_raw_content($toc);
TODO rework these
$content = $self->_fancy_html_lead;
$self->_html_lead;
$self->_html_tail;
These methods contain the rendering-order logic for this type of book. Goto and redirect constructs make this slightly different than the purely structural ordering of the TOC object.
Return the TOC object for the (linearly) next node. If there is none, returns undef.
my $next = $book->next_node($toc);
Return the TOC object for the (linearly) previous node.
my $prev = $book->prev_node($toc);
Returns a subref for the quicksearch (first-pass.) See dtRdr::Search::Book for details.
my $subref = $book->searcher($regexp);
Eric Wilhelm <ewilhelm at cpan dot org>
http://scratchcomputing.com/
Copyright (C) 2006-2007 Eric L. Wilhelm and OSoft, All Rights Reserved.
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.
The dotReader(TM) is OSI Certified Open Source Software licensed under the GNU General Public License (GPL) Version 2, June 1991. Non-encrypted and encrypted packages are usable in connection with the dotReader(TM). The ability to create, edit, or otherwise modify content of such encrypted packages is self-contained within the packages, and NOT provided by the dotReader(TM), and is addressed in a separate commercial license.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
To install dtRdr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm dtRdr
CPAN shell
perl -MCPAN -e shell install dtRdr
For more information on module installation, please visit the detailed CPAN module installation guide.