view release on metacpan or search on metacpan
license => 'perl',
create_makefile_pl => 'traditional',
configure_requires => { 'Module::Build' => '0.4209' },
recommmends => { 'CommonMark' => '0.290000' },
test_requires => {
'File::Spec::Functions' => 0,
'Module::Build' => '0.4209',
'Test::More' => '0.96',
},
requires => {
'File::BOM' => '0.14',
'HTML::Entities' => 0,
'HTML::Tagset' => 0, # Needed by Text::MediawikiFormat
'IPC::Open3' => 0,
'perl' => 5.008001,
'Pod::Simple::XHTML' => '3.15',
'Symbol' => 0,
'Text::Markdown' => '1.000004',
'Text::MultiMarkdown' => '1.000028',
'Text::MediawikiFormat' => '1.0',
'Text::Textile' => '2.10',
},
"develop" : {
"requires" : {
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.06",
"Test::Spelling" : "0.25"
}
},
"runtime" : {
"requires" : {
"File::BOM" : "0.14",
"HTML::Entities" : "0",
"HTML::Tagset" : "0",
"IPC::Open3" : "0",
"Parse::BBCode" : "0.15",
"Pod::Simple::XHTML" : "3.15",
"Symbol" : "0",
"Text::Markdown" : "1.000004",
"Text::MediawikiFormat" : "1.0",
"Text::MultiMarkdown" : "1.000028",
"Text::Textile" : "2.10",
Text::Markup::Rest:
file: lib/Text/Markup/Rest.pm
version: '0.33'
Text::Markup::Textile:
file: lib/Text/Markup/Textile.pm
version: '0.33'
Text::Markup::Trac:
file: lib/Text/Markup/Trac.pm
version: '0.33'
requires:
File::BOM: '0.14'
HTML::Entities: '0'
HTML::Tagset: '0'
IPC::Open3: '0'
Parse::BBCode: '0.15'
Pod::Simple::XHTML: '3.15'
Symbol: '0'
Text::Markdown: '1.000004'
Text::MediawikiFormat: '1.0'
Text::MultiMarkdown: '1.000028'
Text::Textile: '2.10'
Makefile.PL view on Meta::CPAN
'Text::MediawikiFormat' => '1.0',
'Text::WikiCreole' => '0.07',
'Pod::Simple::XHTML' => '3.15',
'Parse::BBCode' => '0.15',
'Symbol' => 0,
'HTML::Tagset' => 0,
'IPC::Open3' => 0,
'Text::Trac' => '0.10',
'HTML::Entities' => 0,
'Text::MultiMarkdown' => '1.000028',
'File::BOM' => '0.14'
},
'VERSION_FROM' => 'lib/Text/Markup.pm',
'NAME' => 'Text::Markup',
'EXE_FILES' => [],
'PL_FILES' => {},
'INSTALLDIRS' => 'site'
)
;
perl Makefile.PL
make
make test
make install
Dependencies
------------
Text-Markup requires the following modules:
* File::BOM 0.15
* HTML::Entities
* perl 5.8.1
* Pod::Simple::XHTML 3.15
* Text::Markdown 1.000004
* Text::MediawikiFormat 1.0
* Text::Textile 2.10
* Text::Trac 0.10
* Parse::BBCode 0.15
* Text::WikiCreole 0.07
lib/Text/Markup.pm view on Meta::CPAN
The markup format in the file, which determines the parser used to parse it.
If not specified, Text::Markup will try to guess the format from the file's
suffix. If it can't guess, it falls back on C<default_format>. And if that
attribute is not set, it uses the C<none> parser, which simply encodes the
entire file and wraps it in a C<< <pre> >> element.
=item C<encoding>
The character encoding to assume the source file is encoded in (if such cannot
be determined by other means, such as a
L<BOM|https://en.wikipedia.org/wiki/Byte_order_mark>). If not specified, the
value of the C<default_encoding> attribute will be used, and if that attribute
is not set, UTF-8 will be assumed.
=item C<options>
An array reference of options for the parser. See the documentation of the
various parser modules for details.
=back
lib/Text/Markup.pm view on Meta::CPAN
=item 4
Implement the C<parser> function in your new module. If you were to use a
C<Text::FooBar> module, it might look something like this:
package Text::Markup::FooBar;
use 5.8.1;
use strict;
use Text::FooBar ();
use File::BOM qw(open_bom)
sub import {
# Replace the regex if passed one.
Text::Markup->register( foobar => $_[1] ) if $_[1];
}
sub parser {
my ($file, $encoding, $opts) = @_;
my $md = Text::FooBar->new(@{ $opts || [] });
open_bom my $fh, $file, ":encoding($encoding)";
lib/Text/Markup.pm view on Meta::CPAN
'</head>',
'<body>',
$html,
'</body>',
'</html>',
);
}
Use the C<$encoding> argument as appropriate to read in the source file. If
your parser requires that text be decoded to Perl's internal form, use of
L<File::BOM> is recommended, so that an explicit BOM will determine the
encoding. Otherwise, fall back on the specified encoding. Note that some
parsers, such as an HTML parser, would want text encoded before it parsed it.
In such a case, read in the file as raw bytes:
open my $fh, '<:raw', $file or die "Cannot open $file: $!\n";
The returned HTML, however, B<must be encoded in UTF-8>. Please include an
L<encoding declaration|https://en.wikipedia.org/wiki/Character_encodings_in_HTML>,
such as a content-type C<< <meta> >> element:
lib/Text/Markup/Asciidoctor.pm view on Meta::CPAN
=head1 Description
This is the L<Asciidoc|https://asciidoc.org/> parser for L<Text::Markup>. It
depends on the C<asciidoctor> command-line application; see the
L<installation docs|https://asciidoctor.org/#installation> for details, or
use the command C<gem install asciidoctor>. Note that L<Text::Markup> does
not load this module by default, but when loaded manually will replace
Text::Markup::Asciidoc as preferred Asciidoc parser.
Text::Markup::Asciidoctor reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<C<asciidoctor>|https://asciidoctor.org> for parsing, and then returns the
generated HTML as an encoded UTF-8 string with an C<http-equiv="Content-Type">
element identifying the encoding as UTF-8.
Text::Markup::Asciidoctor recognizes files with the following extensions as
Asciidoc:
=over
=item F<.asciidoc>
lib/Text/Markup/Bbcode.pm view on Meta::CPAN
package Text::Markup::Bbcode;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Parse::BBCode;
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( bbcode => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Bbcode.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'file.bbcode');
my $raw = Text::Markup->new->parse(
file => 'file.bbcode',
options => [ raw => 1 ],
);
=head1 Description
This is the L<BBcode|https://www.bbcode.org/> parser for L<Text::Markup>. It
reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::Markdown> for parsing, and then returns the generated HTML as an
encoded UTF-8 string with an C<http-equiv="Content-Type"> element identifying
the encoding as UTF-8.
It recognizes files with the following extensions as Markdown:
=over
=item F<.bb>
lib/Text/Markup/CommonMark.pm view on Meta::CPAN
package Text::Markup::CommonMark;
use 5.8.1;
use strict;
use warnings;
use CommonMark;
use Text::Markup;
use File::BOM qw(open_bom);
our $VERSION = '0.33';
sub import {
# Replace Text::Markup::Markdown.
Text::Markup->register( markdown => $_[1] || qr{m(?:d(?:own)?|kdn?|arkdown)} );
}
sub parser {
my ($file, $encoding, $opts) = @_;
lib/Text/Markup/CommonMark.pm view on Meta::CPAN
=head1 Description
This is the L<CommonMark|https://commonmark.org> parser
for L<Text::Markup>. On load, it replaces the default L<Text::Markup::Markdown>
parser for parsing L<Markdown|https://daringfireball.net/projects/markdown/>.
Note that L<Text::Markup> does not load this module by default, but when
loaded manually will be the preferred Markdown parser.
Text::Markup::CommonMark reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<CommonMark> for parsing, and then returns the generated HTML as an
encoded UTF-8 string with an C<http-equiv="Content-Type"> element identifying
the encoding as UTF-8.
It recognizes files with the following extensions as CommonMark Markdown:
=over
=item F<.md>
lib/Text/Markup/Creole.pm view on Meta::CPAN
package Text::Markup::Creole;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Text::WikiCreole;
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( creole => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Creole.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'file.creole');
my $raw = Text::Markup->new->parse(
file => 'file.creole',
options => [ raw => 1 ],
);
=head1 Description
This is the L<Creole|https://www.wikicreole.org/> parser for L<Text::Markup>.
It reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::Markdown> for parsing, and then returns the generated HTML as an
encoded UTF-8 string with an C<http-equiv="Content-Type"> element identifying
the encoding as UTF-8.
It recognizes files with the following extensions as Markdown:
=over
=item F<.creole>
lib/Text/Markup/Markdown.pm view on Meta::CPAN
package Text::Markup::Markdown;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Text::Markdown ();
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( markdown => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Markdown.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'README.md');
my $raw = Text::Markup->new->parse(
file => 'README.md',
options => [ raw => 1 ],
);
=head1 Description
This is the L<Markdown|https://daringfireball.net/projects/markdown/> parser
for L<Text::Markup>. It reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::Markdown> for parsing, and then returns the generated HTML as an
encoded UTF-8 string with an C<http-equiv="Content-Type"> element identifying
the encoding as UTF-8.
It recognizes files with the following extensions as Markdown:
=over
=item F<.md>
lib/Text/Markup/Mediawiki.pm view on Meta::CPAN
package Text::Markup::Mediawiki;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Text::MediawikiFormat 1.0;
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( mediawiki => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Mediawiki.pm view on Meta::CPAN
my $raw = Text::Markup->new->parse(
file => 'README.mediawiki',
options => [ {}, { raw => 1 } ],
);
=head1 Description
This is the L<MediaWiki
syntax|https://en.wikipedia.org/wiki/Help:Contents/Editing_Wikipedia> parser
for L<Text::Markup>. It reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::MediawikiFormat> for parsing, and then returns the generated HTML as
an encoded UTF-8 string with an C<http-equiv="Content-Type"> element
identifying the encoding as UTF-8.
It recognizes files with the following extensions as MediaWiki:
=over
=item F<.mediawiki>
lib/Text/Markup/Multimarkdown.pm view on Meta::CPAN
package Text::Markup::Multimarkdown;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Text::MultiMarkdown ();
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( multimarkdown => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Multimarkdown.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'README.mmd');
my $raw = Text::Markup->new->parse(
file => 'README.mmd',
options => [ raw => 1 ],
);
=head1 Description
This is the L<MultiMarkdown|https://fletcherpenney.net/multimarkdown/> parser
for L<Text::Markup>. It reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::MultiMarkdown> for parsing, and then returns the generated HTML as an
encoded UTF-8 string with an C<http-equiv="Content-Type"> element identifying
the encoding as UTF-8.
It recognizes files with the following extensions as MultiMarkdown:
=over
=item F<.mmd>
lib/Text/Markup/None.pm view on Meta::CPAN
package Text::Markup::None;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use HTML::Entities;
use File::BOM qw(open_bom);
our $VERSION = '0.33';
sub import {
# Set a regex if passed one.
Text::Markup->register( none => $_[1] ) if $_[1];
}
sub parser {
my ($file, $encoding, $opts) = @_;
lib/Text/Markup/None.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'README');
my $raw = Text::Markup->new->parse(
file => 'README',
options => [ raw => 1 ],
);
=head1 Description
This is the default parser used by Text::Markdown in the event that it cannot
determine the format of a text file. All it does is read the file in (relying
on a L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>, encodes all
entities, and then returns an HTML string with the file in a C<< <pre> >>
element. This will be handy for files that really are nothing but plain text,
like F<README> files.
By default this parser is not associated with any file extensions. To have
Text::Markup also recognize files for this module, load it directly and pass
a regular expression matching the desired extension(s), like so:
use Text::Markup::None qr{te?xt};
lib/Text/Markup/Pod.pm view on Meta::CPAN
=head1 Synopsis
use Text::Markup;
my $pod = Text::Markup->new->parse(file => 'README.pod');
=head1 Description
This is the L<Pod|perlpod> parser for L<Text::Markup>. It runs the file
through L<Pod::Simple::XHTML> and returns the result. If the Pod contains any
non-ASCII characters, the encoding must be declared either via a BOM or via
the C<=encoding> tag. Text::Markup::Pod recognizes files with the following
extensions as Pod:
=over
=item F<.pod>
=item F<.pm>
=item F<.pl>
lib/Text/Markup/Textile.pm view on Meta::CPAN
package Text::Markup::Textile;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Text::Textile 2.10;
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( textile => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Textile.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'README.textile');
my $raw = Text::Markup->new->parse(
file => 'README.textile',
options => [ raw => 1 ],
);
=head1 Description
This is the L<Textile|https://textile-lang.com> parser for L<Text::Markup>.
It reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::Textile> for parsing, and then returns the generated HTML as an
encoded UTF-8 string with an C<http-equiv="Content-Type"> element identifying
the encoding as UTF-8.
It recognizes files with the following extension as Textile:
=over
=item F<.textile>
lib/Text/Markup/Trac.pm view on Meta::CPAN
package Text::Markup::Trac;
use 5.8.1;
use strict;
use warnings;
use Text::Markup;
use File::BOM qw(open_bom);
use Text::Trac 0.10;
our $VERSION = '0.33';
sub import {
# Replace the regex if passed one.
Text::Markup->register( trac => $_[1] ) if $_[1];
}
sub parser {
lib/Text/Markup/Trac.pm view on Meta::CPAN
my $html = Text::Markup->new->parse(file => 'README.trac');
my $raw = Text::Markup->new->parse(
file => 'README.trac',
options => [ raw => 1 ],
);
=head1 Description
This is the L<Trac wiki syntax|https://trac.edgewall.org/wiki/WikiFormatting>
parser for L<Text::Markup>. It reads in the file (relying on a
L<BOM|https://www.unicode.org/unicode/faq/utf_bom.html#BOM>), hands it off to
L<Text::Trac> for parsing, and then returns the generated HTML as an encoded
UTF-8 string with an C<http-equiv="Content-Type"> element identifying the
encoding as UTF-8.
It recognizes files with the following extensions as Trac:
=over
=item F<.trac>