Text::UberText::Node::Text - UberText Text Node


ubertext documentation Contained in the ubertext distribution.

Index


Code Index:

NAME

Top

Text::UberText::Node::Text - UberText Text Node

DESCRIPTION

Top

The Node::Text module handles processing an UberText text segment embedded within an UberText file. It is a subclass of the Text::UberText::Node class.

ESCAPE SEQUENCES

Top

UberText files cannot contain certain characters, as a result of which, they need to be specified with escape sequences.

Escape sequences start with a percent sign (%), and end with a semi-colon (;). Two alpabetic characters in the middle specify what character they intend to replace.

%pc;

Percent sign (%)

%dq;

Double quote (")

%sq;

Single quote (')

%co;

Colon (:)

%sc;

Semi-colon (;)

%lb;

Left bracket ([)

%rb;

Right bracket (])

%lp;

Left parenthesis (()

%rp;

Right parenthesis ())

METHODS

Top

The following methods are overriden from the Text::UberText::Node module to perform specific functions on passed input.

$node->process();

Generates the output, replacing all escape sequences.

$node->quickReplace();

Performs the actual escape sequence replacement.

$node->run();

The run method does nothing. All processing of the text is performed before the document tree is actually run.

AUTHOR

Top

Chris Josephes <cpj1@visi.com>

SEE ALSO

Top

Text::UberText::Node, Text::UberText::Node::Command

COPYRIGHT

Top


ubertext documentation Contained in the ubertext distribution.

#
# Package Definition
#

package Text::UberText::Node::Text;

#
# Compiler Directives
#

use strict;
use warnings;

#
# Includes
#

use Text::UberText::Node;

#
# Global Variables
#

use vars qw/@ISA $EscapeChar $VERSION /;

$VERSION=0.95;

# Text within a block that can be replaced with other characters
# An escape sequence within an UberText doc would look like this:
# %pc; (percent sign)

$EscapeChar={
        "lb" => "[",
        "rb" => "]",
        "pc" => "%",
        "lp" => "(",
        "rp" => ")",
        "dq" => "\"",
        "sq" => "'",
        "co" => ":",
	"sc" => ";",
};


#
# Inheritance
#

@ISA=("Text::UberText::Node");

#
# Methods
#

sub new
{
my ($class)=shift;
my ($object);
$object={};
bless ($object,$class);
$object->_init(@_);
return $object;
}

sub process
{
my ($self)=shift;
$self->{output}=quickReplace($self->{input});
return;
}

sub quickReplace
{
my ($string)=shift;
$string=~s/\%(\w\w);/$EscapeChar->{$1}/g;
return $string;
}

#
# Hidden Methods
#

#
# Exit Block
#
1;

#
# POD Documentation
#