NAME
HTML::TabbedExamples::Generate - generate syntax-highlighted examples for codes with a markup compatible with jQueryUI's tab widgets.
VERSION
version 0.0.5
SYNOPSIS
use HTML::TabbedExamples::Generate;
use strict;
use warnings;
# Examples generator:
my $ex_gen = HTML::TabbedExamples::Generate->new(
{
default_syntax => 'perl',
}
);
print $ex_gen->html_with_title(
{
title => "Copying a file",
id_base => "copying_a_file",
examples =>
[
{
id => "io_all",
label => "IO-All",
code => <<'EOF',
use IO::All;
my ($source_filename, $dest_filename) = @_;
io->file($source_filename) > io->file($dest_filename);
EOF
},
{
id => "core",
label => "Core Perl",
code => <<'EOF',
use File::Copy qw(copy);
my ($source_filename, $dest_filename) = @_;
copy($source_filename, $dest_filename);
EOF
},
],
}
);
print $ex_gen->html_with_title(
{
title => "Overwriting a file with text",
id_base => "overwrite_a_file",
examples =>
[
{
id => "io_all",
label => "IO-All",
code => <<'EOF',
use IO::All;
io->file("output.txt")->utf8->print("Hello World!\n");
EOF
},
{
id => "core",
label => "Core Perl",
code => <<'EOF',
use autodie;
open my $out, '>:encoding(utf8)', "output.txt";
print {$out} "Hello World!\n";
close($out);
EOF
},
],
}
);
METHODS
my $obj = HTML::TabbedExamples::Generate->new({ default_syntax => "perl", main_pre_css_classes => [qw( code my_example1 )]})
Returns a new object with a default_syntax for the examples, and some classes to add for the main pre tag. Default 'main_pre_css_classes'
value is only the class 'code'
.
my $html_markup_string = $obj->render({ examples => \@examples, id_base => 'my_example_id'})
Renders some examples. 'id_base'
is the prefix to prepend to the classes’ IDs. 'examples'
points to an array-ref of examples, which are hash-refs cotnaining:
label
The tab's label.
no_syntax
If true, disable syntax highlighting.
syntax
If true, override the default_syntax
my $html_markup_string = $obj->html_with_title({ title => 'My title to escape', %ARGS })
Same arguments as render() with the addition of 'title'
which is a title to be placed inside an <h3>..</h3>
tag, which will be escaped. Returns the complete markup.
AUTHOR
Shlomi Fish <shlomif@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
BUGS
Please report any bugs or feature requests on the bugtracker website http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-TabbedExamples-Generate or by email to bug-html-tabbedexamples-generate@rt.cpan.org.
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
perldoc HTML::TabbedExamples::Generate
Websites
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-TabbedExamples-Generate
AnnoCPAN
The AnnoCPAN is a website that allows community annotations of Perl module documentation.
CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
CPAN Forum
The CPAN Forum is a web forum for discussing Perl modules.
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
http://cpants.perl.org/dist/overview/HTML-TabbedExamples-Generate
CPAN Testers
The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions.
http://www.cpantesters.org/distro/H/HTML-TabbedExamples-Generate
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=HTML-TabbedExamples-Generate
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=HTML::TabbedExamples::Generate
Bugs / Feature Requests
Please report any bugs or feature requests by email to bug-html-tabbedexamples-generate at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-TabbedExamples-Generate. You will be automatically notified of any progress on the request by the system.
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
http://bitbucket.org/shlomif/perl-HTML-TabbedExamples-Generate
hg clone ssh://hg@bitbucket.org/shlomif/perl-HTML-TabbedExamples-Generate