Text-XHTML

 view release on metacpan or  search on metacpan

lib/Text/XHTML.pm  view on Meta::CPAN

package Text::XHTML;
use strict;
use warnings;
use Types;
use Text::XML qw(:all);
use Carp;
use Exporter;
use base qw/Exporter/;

our $VERSION = '0.1';

our %EXPORT_TAGS = (
elements => [qw(abbr acronym address anchor area bdo big blockquote body bold
                button br caption cite col colgroup ddef define del dlist dterm
                emphasize fieldset form h1 h2 h3 h4 h5 h6 head hr image input
                ins italics keyboard label legend li meta noscript object olist
                optgroup option paragraph param pre quote sample script select
                small strong thestyle subscript superscript table tbody td
                textarea tfoot th thead thebase code div html span thetitle
                trow tt ulist variable)],
attributes => [qw(action align alt altcode archive base border bordercolor
                  cellpadding checked codebase cols colspan content coords
                  disabled enctype height href httpequiv identifier ismap lang
                  maxlength method multiple name nohref rel rev rows rowspan
                  rules selected shape size src class afor style type title
                  usemap valign value width)]
);

our @EXPORT_OK = ( qw(text comment attr cdata)
                 , @{$EXPORT_TAGS{elements}}
                 , @{$EXPORT_TAGS{attributes}}
                 );

$EXPORT_TAGS{all} = \@EXPORT_OK;

our $CHECKS = 1;

our %CTXT =
( 'Text::XHTML::CtxText'
        => { _text => 1 }
, 'Text::XHTML::CtxHead'
        => {map {$_=>1} qw(base link meta title stype script)}
, 'Text::XHTML::CtxOption'
        => {map {$_=>1} qw(option optgroup)}
, 'Text::XHTML::CtxDList'
        => {map {$_=>1} qw(dt dd)}
, 'Text::XHTML::CtxList'
        => { li => 1 }
, 'Text::XHTML::CtxTable'
        => {map {$_=>1} qw(caption col colgroup thead tfoot tbody tr)}
, 'Text::XHTML::CtxBlock'
        => {map {$_=>1} qw(ins del noscript address blockquote div dl fieldset
                           form h1 h2 h3 h4 h5 h6 hr ol p pre table ul script)}
, 'Text::XHTML::CtxForm'
        => {map {$_=>1} qw(ins del noscript address blockquote div dl fieldset
                           form h1 h2 h3 h4 h5 h6 hr ol p pre table ul script
                           fieldset)}
, 'Text::XHTML::CtxMap'
        => {map {$_=>1} qw(ins del noscript address blockquote div dl fieldset
                           form h1 h2 h3 h4 h5 h6 hr ol p pre table ul script
                           map)}
, 'Text::XHTML::CtxInline'
        => {map {$_=>1} qw(ins del noscript abbr acronym a bdo big b button
                           br cite dfn em img input i kbd label legend object
                           q sample select small strong sub sup
                           textarea code span tt var _text)}
, 'Text::XHTML::CtxAnchor'
        => {map {$_=>1} qw(ins del noscript abbr acronym bdo big b button
                           br cite dfn em img input i kbd label legend object
                           q sample select small strong sub sup
                           textarea code span tt var _text)}
, 'Text::XHTML::CtxInlineBlock'
        => {map {$_=>1} qw(ins del noscript address blockquote div dl fieldset
                           form h1 h2 h3 h4 h5 h6 hr ol p pre table ul script
                           abbr acronym a bdo big b button
                           br cite dfn em img input i kbd label legend object
                           q sample select small strong sub sup
                           textarea code span tt var _text)}
, 'Text::XHTML::CtxFieldSet'
        => {map {$_=>1} qw(ins del noscript address blockquote div dl fieldset
                           form h1 h2 h3 h4 h5 h6 hr ol p pre table ul script
                           abbr acronym a bdo big b button
                           br cite dfn em img input i kbd label legend object
                           q sample select small strong sub sup
                           textarea code span tt var _text legend)}
, 'Text::XHTML::CtxObject'
        => {map {$_=>1} qw(ins del noscript address blockquote div dl fieldset
                           form h1 h2 h3 h4 h5 h6 hr ol p pre table ul script
                           abbr acronym a bdo big b button

lib/Text/XHTML.pm  view on Meta::CPAN

sub identifier  ($) { attr id           => shift }
sub ismap        () { attr action       => 'true'}
sub lang        ($) { my $l=shift; attr(lang=>$l), attr('xml:lang',$l) }
sub maxlength   ($) { attr maxlength    => shift }
sub method      ($) { attr method       => shift }
sub multiple     () { attr multiple     => 'true'}
sub name        ($) { attr name         => shift }
sub nohref       () { attr nohref       => 'true'}
sub rel         ($) { attr rel          => shift }
sub rev         ($) { attr rev          => shift }
sub rows        ($) { attr rows         => shift }
sub rowspan     ($) { attr rowspan      => shift }
sub rules       ($) { attr rules        => shift }
sub selected     () { attr selected     => 'true'}
sub shape       ($) { attr shape        => shift }
sub size        ($) { attr size         => shift }
sub src         ($) { attr src          => shift }
sub class       ($) { attr class        => shift }
sub afor        ($) { attr 'for'        => shift }
sub style       ($) { attr style        => shift }
sub type        ($) { attr type         => shift }
sub title       ($) { attr title        => shift }
sub usemap      ($) { attr usemap       => shift }
sub valign      ($) { attr valign       => shift }
sub value       ($) { attr value        => shift }
sub width       ($) { attr width        => shift }

1;

__END__

=head1 NAME

Text::XHTML - The great new Text::XHTML!

=head1 VERSION

Version 0.1

=head1 SYNOPSIS

XHTML combinators and pretty printer.
More documentation coming soon.

=head1 EXPORT

abbr acronym address anchor area bdo big blockquote body bold
button br caption cite col colgroup ddef define del dlist dterm
emphasize fieldset form h1 h2 h3 h4 h5 h6 head hr image input
ins italics keyboard label legend li meta noscript object olist
optgroup option paragraph param pre quote sample script select
small strong thestyle subscript superscript table tbody td
textarea tfoot th thead thebase code div html span thetitle
trow tt ulist variable
action align alt altcode archive base border bordercolor
cellpadding checked codebase cols colspan content coords
disabled enctype height href httpequiv identifier ismap lang
maxlength method multiple name nohref rel rev rows rowspan
rules selected shape size src class afor style type title
usemap valign value width
text comment attr cdata

=head1 AUTHOR

Eugene Grigoriev, C<< <eugene.grigoriev at gmail.com> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-text-xhtml at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-XHTML>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Text::XHTML


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-XHTML>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Text-XHTML>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Text-XHTML>

=item * Search CPAN

L<http://search.cpan.org/dist/Text-XHTML>

=back


=head1 ACKNOWLEDGEMENTS


=head1 COPYRIGHT & LICENSE

Copyright 2008 Eugene Grigoriev, all rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.



( run in 0.858 second using v1.01-cache-2.11-cpan-63c85eba8c4 )