HTML-Toc

 view release on metacpan or  search on metacpan

TocUpdator.pm  view on Meta::CPAN

}  # toc()


#--- HTML::TocUpdator::_processTocText() --------------------------------------
# function: Toc text processing function.
# args:     - $aText: Text to add to ToC.
#           - $aToc: ToC to add text to.

sub _processTocText {
	# Get arguments
    my ($self, $aText, $aToc) = @_;
	# Delete output?
    if (! $self->{_doDeleteTokens}) {
	# No, don't delete output;
	    # Call ancestor
	$self->SUPER::_processTocText($aText, $aToc);
    }
}  # _processTocText()


#--- HTML::TocUpdator::_processTocTokenChildren() ----------------------
# function: Toc token children processing function.
# args:     - $aText: Text to add to ToC.
#           - $aToc: ToC to which text belongs.

sub _processTocTokenChildren {
	# Get arguments
    my ($self, $aText, $aToc) = @_;
	# Delete output?
    if (! $self->{_doDeleteTokens}) {
	# No, don't delete output;
	    # Call ancestor
	$self->SUPER::_processTocTokenChildren($aText, $aToc);
    } # if
}  # _processTocTokenChildren()


#--- HTML::TocUpdator::_processTocTokenText() --------------------------
# function: Toc token text processing function.
# args:     - $aText: Text to add to ToC.
#           - $aToc: ToC to which text belongs.

sub _processTocTokenText {
	# Get arguments
    my ($self, $aText, $aToc) = @_;
	# Delete output?
    if (! $self->{_doDeleteTokens}) {
	# No, don't delete output;
	    # Call ancestor
	$self->SUPER::_processTocTokenText($aText, $aToc);
    } # if
}  # _processTocTokenText()


#--- HTML::TocUpdator::update() -----------------------------------------------
# function: Update ToC in string.
# args:     - $aToc: (reference to array of) ToC object to update
#           - $aString: string to update ToC of
#           - $aOptions: optional updator options

sub update {
	# Get arguments
    my ($self, $aToc, $aString, $aOptions) = @_;
	# Do start update
    $self->_update(MODE_DO_UPDATE, $aToc, $aString, $aOptions);
}  # update()


#--- HTML::TocUpdator::updateFile() -------------------------------------------
# function: Update ToC of file.
# args:     - $aToc: (reference to array of) ToC object to update
#           - $aFile: (reference to array of) file to parse for updating.
#           - $aOptions: optional updator options

sub updateFile {
	# Get arguments
    my ($self, $aToc, $aFile, $aOptions) = @_;
	# Do start update
    $self->_updateFile(MODE_DO_UPDATE, $aToc, $aFile, $aOptions);
}  # update()




#=== HTML::_TokenUpdateParser =================================================
# function: Parse 'update tokens'.  'Update tokens' mark HTML code which is
#           inserted by 'HTML::TocInsertor'.
# note:     Used internally.

package HTML::_TokenUpdateParser;


BEGIN {
    use vars qw(@ISA);

    @ISA = qw(HTML::Parser);
}

END {}


#--- HTML::_TokenUpdateParser::new() ------------------------------------------
# function: Constructor

sub new {
	# Get arguments
    my ($aType, $aTokenArray) = @_;
	# Create instance
    my $self = $aType->SUPER::new;
	# Reference token array
    $self->{tokens} = $aTokenArray;
	# Return instance
    return $self;
}  # new()


#--- HTML::_TokenUpdateParser::comment() --------------------------------------
# function: Process comment.
# args:     - $aComment: comment text with '<!--' and '-->' tags stripped off.

sub comment {
	# Get arguments
    my ($self, $aComment) = @_;
	# Add token to array of update tokens
    $self->{tokens}[HTML::TocUpdator::TUT_TOKENTYPE_COMMENT]{$aComment} = '';
}  # comment()


#--- HTML::_TokenUpdateParser::end() ------------------------------------------
# function: This function is called every time a closing tag is encountered
#           by HTML::Parser.
# args:     - $aTag: tag name (in lower case).

sub end {
	# Get arguments



( run in 0.569 second using v1.01-cache-2.11-cpan-e1769b4cff6 )