Bruno Postle > MKDoc-Text-Structured > MKDoc::Text::Structured::Inline

Download:
MKDoc-Text-Structured-0.83.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

MKDoc::Text::Structured::Inline - convert text to HTML without handling block-level tags

SYNOPSIS ^

  my $text = some_structured_text();
  my $this = MKDoc::Text::Structured::Inline::process ($text);
  my $that = MKDoc::Text::Structured::Inline::process_entities_only ($text);

SUMMARY ^

MKDoc::Text::Structured::Inline is used by MKDoc::Text::Structured to generate inline HTML elements such as hyperlinks, emphasis and entities.

This module is also useful directly when the full block-level rendering of MKDoc::Text::Structured is unwanted.

USAGE ^

Processing text and adding HTML tags

For example, when processing text that is going to end up in an <h1> header, you wouldn't want any block level tags generated:

  $header = "< My (c) symbol should be *bold* > -- and http://example.com/ 'linked'";
  $header = MKDoc::Text::Structured::Inline::process ($title);

$header is now:

  &lt; My &copy; symbol should be <strong>bold</strong> &gt; &mdash; and <a href="http://example.com/">http://example.com/<a> &lsquo;linked&rsquo;

Processing text without adding tags

Another example, if you were processing text that will end up in an HTML <title> tag, this tag should never contain any other tags, so you should use the MKDoc::Text::Structured::Inline::process_entities_only() method:

  $title = "< My (c) symbol shouldn't be *bold* > -- or http://example.com/ 'linked'";
  $title = MKDoc::Text::Structured::Inline::process_entities_only ($title);

$title is now:

  &lt; My &copy; symbol shouldn't be *bold* &mdash; &gt; or http://example.com/ &lsquo;linked&rsquo;
syntax highlighting: