NAME

Text::Smart - Processor for 'smarttext' markup

SYNOPSIS

use Text::Smart;

my $markup = Text::Smart->new(entities => \%entities);

my $text = $markup->process($text, %opts);

my $text = $markup->process_divider($text);
my $text = $markup->process_itemize($text, %opts);
my $text = $markup->process_enumeration($text, %opts);
my $text = $markup->process_paragraph($text, %opts);
my $text = $markup->process_smart($text, %opts);

my $text = $markup->generate_divider();
my $text = $markup->generate_itemize(@items);
my $text = $markup->generate_enumeration(@items);
my $text = $markup->generate_paragraph($text);
my $text = $markup->generate_bold($text);
my $text = $markup->generate_italic($text)
my $text = $markup->generate_monospace($text);
my $text = $markup->generate_link($text, $url);

DESCRIPTION

This module provides an interface for converting smarttext markup into an arbitrary text based markup language, such as HTML, Latex, or Troff.

SMARTTEXT MARKUP

Smarttext markup can be split into two categories, block level and inline. Block level elements are separated by one or more completely blank lines. Inline elements encompass one or more words within a block. Valid inline markup is:

*foo* - Puts the word 'foo' in bold face
/foo/ - Puts the word 'foo' in italic face
=foo= - Puts the word 'foo' in fixed width face
@foo(bar) - Makes the word 'foo' a link to the url 'bar'

There are six pre-defined entities

(C) - Insert copyright symbol
(TM) - Insert trademark symbol
(R) - Insert registered symbol

1/2 - insert a fraction
1/4 - insert a fraction
3/4 - insert a fraction

There are six levels of heading available

&title(Main document heading)
&subtitle(Secondary document heading)
&section(Section heading)
&subsection(Secondary section heading)
&subsubsection(Tertiary section heading)
&paragraph(Paragraph heading)

There are three special blocks. Horizontal dividing bars can be formed using

---
___

Numbered lists using

+ item one
+ item two
+ item three

Bulleted lists using

* item one
* item two
* item three

Anything not fitting these forms is treated as a standard paragraph.

OPTIONS

All the process_XXX family of methods accept a number of options which control which pieces of markup are permitted in the text. The following options are recognised:

no_links
no_symbols
no_lists
no_rules
no_inline

To use this options pass them as a named parameter:

$markup->process($text, no_links => 1, no_lists => 1);

METHODS

AUTHORS

Daniel Berrange <dan@berrange.com>

COPYRIGHT

Copyright (C) 2000-2004 Daniel P. Berrange <dan@berrange.com>

SEE ALSO

perl(1)