Text-Markdown-Slidy
view release on metacpan or search on metacpan
lib/Text/Markdown/Slidy.pm view on Meta::CPAN
if ( my ($delim) = $line =~ /^([- ]+?|=+)\s*$/ and @slide_lines) {
if ($delim =~ / / || !$slide_lines[$#slide_lines]) {
# <hr />
# `- - -`
# "\n\n----\n"
push @slides, join("\n", (@slide_lines, $line));
@slide_lines = ();
next;
}
# h1 or h2
my $prev = pop @slide_lines;
push @slides, join("\n", @slide_lines) if @slide_lines;
@slide_lines = ($prev); # $prev is title;
}
push @slide_lines, $line;
}
push @slides, join("\n", @slide_lines) if @slide_lines;
@slides;
}
1;
__END__
=encoding utf-8
=head1 NAME
Text::Markdown::Slidy - Markdown converter for HTML slide tools
=head1 SYNOPSIS
use Text::Markdown::Slidy;
markdown(<<'MARKDOWN');
Title1
======
## sub title
abcde
fg
Title2
------
hoge
MARKDOWN
# <div class="slide">
# <h1>Title1</h1>
# <h2>sub title<h2>
#
# <p>abcde
# fg</p>
# </div>
#
# <div class="slide">
# <h2>Title2</h2>
#
# <p>hoge</p>
# </div>
# split markdown text to slide sections
my @markdowns_per_section = split_markdown($markdown_text);
=head1 DESCRIPTION
Text::Markdown::Slidy is to convert markdown syntax to HTML slide tools.
=head1 METHODS
=head2 C<< $md = Text::Markdown::Slidy->new(%opt) >>
Constructor.
=head2 C<< $html_text = $md->markdown($markdown_text) >>
=head1 FUNCTIONS
=head2 C<< $html_text = markdown($markdown_text) >>
=head2 C<< @markdowns_per_section = split_markdown($markdown_text) >>
=head1 LICENSE
Copyright (C) Masayuki Matsuki.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 AUTHOR
Masayuki Matsuki E<lt>y.songmu@gmail.comE<gt>
=cut
( run in 1.506 second using v1.01-cache-2.11-cpan-71847e10f99 )