element or the
collected elements, whichever is appropriate.
See L for more information on element globs.
=over
=item cell(row,col,[row2,col2],[...])
Access an individual cell or collection of cells by their coordinates.
=item row(row,[row2,...])
Access the contents of a row or collection of rows by row coordinate.
=item col(col,[col2,...])
Access the contents of a column or collection of columns by column
coordinate.
=item box(row_a1,col_a1,row_a2,col_a2,[row_b1,col_b1,row_b2,col_b2],[...])
Access the contents of a span of cells, specified as a box consisting of
two sets of coordinates. Multiple boxes can be specified.
=item table()
Access all cells in the table. This is different from manipulating the
table object itself, which is reserved for such things as CELLSPACING
and other attributes specific to the tag. However, since table()
returns a glob of cells, if the attribute is more appropriate for the
top level tag, it will be placed there rather than in each
tag or every tag.
=back
ELEMENT/GLOB METHODS
The interfaces to a single table element or a glob of elements are
identical. All methods available from the HTML::ElementSuper class are
also available to a table element or glob of elements. See
L for details on these methods.
Briefly, here are some of the more useful methods provided by
HTML::ElementSuper:
=over
=item attr()
=item push_content()
=item replace_content()
=item wrap_content()
=item clone([element])
=item mask([mode])
=back
TABLE SPECIFIC EXTENSIONS
=over
=item blank_fill([mode])
Set or return the current fill mode for blank cells. The default is 0
for HTML::Element::Table elements. When most browsers render tables, if
they are empty you will get a box the color of your browser background
color rather than the BGCOLOR of that cell. When enabled, empty cells
are provided with an ' ', or invisible content, which will trigger
the rendering of the BGCOLOR for that cell.
=back
=head1 NOTES ON GLOBS
Globbing was a convenient way to treat arbitrary collections of table
cells as if they were a single HTML element. Methods are generally
passed blindly and sequentially to the elements they contain.
Most of the time, this is fairly intuitive, such as when you are setting
the attributes of the cells.
Other times, it might be problematic, such as with push_content(). Do
you push the same object to all of the cells? HTML::Element based
classes only support one parent, so this breaks if you try to push the
same element into multiple parental hopefuls. In the specific case of
push_content() on globs, the elements that eventually get pushed are
clones of the originally provided content. It works, but it is not
necessarily what you expect. An incestuous HTML element tree is probably
not what you want anyway.
See L for more details on how globs work.
=head1 REQUIRES
HTML::ElementSuper, HTML::ElementGlob
=head1 AUTHOR
Matthew P. Sisk, EFE
=head1 ACKNOWLEDGEMENTS
Thanks to William R. Ward for some conceptual nudging.
=head1 COPYRIGHT
Copyright (c) 1998-2010 Matthew P. Sisk. All rights reserved. All wrongs
revenged. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 SEE ALSO
A useful page of HTML::ElementTable examples can be found at
http://www.mojotoad.com/sisk/projects/HTML-Element-Extended/examples.html.
HTML::ElementSuper(3), HTML::ElementGlob(3), HTML::Element(3), HTML::TableExtract(3), perl(1).
=cut
HTML-Element-Extended-1.18/lib/HTML/ElementRaw.pm 0000644 0001750 0001750 00000005025 11403731021 017745 0 ustar sisk sisk package HTML::ElementRaw;
# Allow raw html as content so that special characters
# do not get encoded. The string is incorporated as part
# of the start tag in order to bypass the regular HTML::Element
# encoding.
use strict;
use vars qw($VERSION @ISA);
require HTML::Element;
@ISA = qw(HTML::Element);
$VERSION = '1.18';
# Whole lotta overrides
#
# Have to store the string somewhere besides _content, because
# traverse looks in the attribute directly rather than calling
# content().
sub push_content {
# Flatten elements into an HTML string if found,
# otherwise just slap the text in.
my @text = map(defined (ref $_ ? $_->as_HTML : $_) ? $_ : '', @_);
shift->{_string}[0] .= join('',@text);
}
sub insert_element {
push_content(@_);
}
sub starttag {
shift->{_string}[0];
}
sub as_HTML {
starttag(@_);
}
# These become degenerate
sub endtag { return }
sub pos { return }
sub attr { return }
sub content { return }
sub tag { return }
sub new {
my $that = shift;
my $class = ref($that) || $that;
# The tag type does not get displayed. We keep it
# around anyway, just in case.
my @args = @_ ? @_ : 'p';
my $self = new HTML::Element @args;
bless $self,$class;
$self;
}
1;
__END__
=head1 NAME
HTML::ElementRaw - Perl extension for HTML::Element(3).
=head1 SYNOPSIS
use HTML::ElementRaw;
$er = new HTML::ElementRaw;
$text = ' I would like this HTML to not be encoded ';
$er->push_content($text);
$h = new HTML::Element 'h2';
$h->push_content($er);
# Now $text will appear as you typed it, non-escaped,
# embedded in the HTML produced by $h.
print $h->as_HTML;
=head1 DESCRIPTION
Provides a way to graft raw HTML strings into your HTML::Element(3)
structures. Since they represent raw text, these can only be leaves in
your HTML element tree. The only methods that are of any real
use in this degenerate element are push_content() and as_HTML().
The push_content() method will simply prepend the provided text to
the current content. If you happen to pass an HTML::element to
push_content, the output of the as_HTML() method in that element
will be prepended.
=head1 REQUIRES
HTML::Element(3)
=head1 AUTHOR
Matthew P. Sisk, EFE
=head1 COPYRIGHT
Copyright (c) 1998-2010 Matthew P. Sisk.
All rights reserved. All wrongs revenged. This program is free
software; you can redistribute it and/or modify it under the
same terms as Perl itself.
=head1 SEE ALSO
HTML::Element(3), HTML::ElementSuper(3), HTML::Element::Glob(3), HTML::ElementTable(3), perl(1).
=cut
HTML-Element-Extended-1.18/Changes 0000644 0001750 0001750 00000005216 11404212204 015325 0 ustar sisk sisk Revision history for Perl extension HTML-Element-Extended.
1.18 Thu Jun 10 12:35:20 EDT 2010
- added push_attr() method
- tweaked glob dispatch for attr()
1.17 Wed May 3 16:52:03 EDT 2006
- new_from_tree() uses a better rasterizer now, properly
handling even more tortuous span issues. Thanks to Roland
Schar.
- Fixed as_XML rendering Thanks to Roger Crew.
1.16 Sat Feb 25 12:41:57 EST 2006
- Fixed new_from_tree() to handle (ignore) tbody, thead and
tfoot tags. Otherwise rows were ignored.
1.15 Fri Feb 24 15:34:13 EST 2006
- Fixed some scoping issues ('my' collisions)
- Fixed some undef issues running under -w (thanks to Carl
Franks)
1.14 Sun Dec 11 04:01:53 EST 2005
- Revised new_from_tree() to properly handle row and column
span issues. Thanks to Mark L. Lott for debugging and
prodding.
1.13 Mon Mar 28 15:14:12 EST 2005
- Fixed nasty content bug
1.12 Wed Mar 9 02:30:10 EST 2005
- Added new_from_tree() constructor which takes an HTML::Element
object based on a table tag and converts it into a cohesive
HTML::ElementTable structure.
1.11 Tue Apr 2 08:37:42 CST 2002
- Added some version dependencies on prereq modules
- More -w cleanup (tie/ref dep)
1.10 Mon Jan 8 19:29:59 CST 2001
- Maintenance release (-w cleanup)
1.09 Fri Nov 10 02:21:30 CST 2000
- Various bugs and warnings fixed.
1.08 Tue May 2 15:03:15 CDT 2000
- clone() bug fix regarding text vs ref on first node.
- adapted glob class to use content_list() rather than content()
1.07 Wed Apr 26 11:37:11 CDT 2000
- More stable content policing, used for both table integrity
and masking; new content methods should automatically be safe.
- Deprecated delete_attr(), since this can now be addressed via
attr($attr, undef).
- Syntactical cleanup, code fleecing. Inherited constructors
will work.
1.06 Tue Jan 25 20:05:05 CST 2000
1.05 - Versioning for the sake of CPAN
1.04 Tue Jan 25 20:05:05 CST 2000
- Fixed incompatabilities with HTML::Element 1.45
- Cleaned up -w noise
- Improved globbing cascades
- Added mailing list information
1.03 Wed Nov 17 23:53:58 CST 1999
- dynamic maxrow, maxcol, extent bug fix
1.02 Thu Sep 16 15:33:41 CDT 1999
- Bundle fix
1.01 Thu Aug 19 14:36:05 CDT 1999
- Minor typos corrected for tests
0.09 Thu Jul 8 19:02:39 CDT 1999
- initial merge from HTML::Element::*
1.00 Tue Jul 27 21:55:43 CDT 1999
- initial release
HTML-Element-Extended-1.18/META.yml 0000644 0001750 0001750 00000000647 11404212325 015312 0 ustar sisk sisk --- #YAML:1.0
name: HTML-Element-Extended
version: 1.18
abstract: ~
license: ~
author: ~
generated_by: ExtUtils::MakeMaker version 6.42
distribution_type: module
requires:
Data::Dumper: 0
HTML::Element: 3.01
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
HTML-Element-Extended-1.18/README 0000644 0001750 0001750 00000003436 10213523224 014720 0 ustar sisk sisk HTML-Element-Extended
---------------------
HTML-Element-Extended is a package of several enhanced HTML::Element
classes, most of which arose during the effort to implement an
HTML::Element based table class.
The modules are:
HTML::ElementTable
HTML::ElementSuper
HTML::ElementGlob
HTML::ElementRaw
The resulting functionality enables:
tables
element globs
element coordinates
content replacement
content wrapping
element cloning
raw HTML string adoption
INSTALLATION
You install HTML-Element-Extended, as you would install any perl
library, by running these commands:
perl Makefile.PL
make
make test
make install
DOCUMENTATION
POD style documentation is included with each module. This is normally
converted to a manual page and installed as part of the "make install"
process. You should also be able to use the 'perldoc' utility to extract
and read documentation from the module file directly. See Changes for
recent changes.
There should also be some examples on the web page mentioned below.
SUPPORT
There is a mailing list for the modules contained in
HTML-Element-Extended. To subscribe or view past messages, please
visit the following URL:
http://lists.sourceforge.net/mailman/listinfo/elementextended-general
Questions and comments may also be directed to Matt Sisk
AVAILABILITY
The library is available from CPAN:
http://www.cpan.org/authors/id/M/MS/MSISK/
The latest version is also available at:
http://www.mojotoad.com/sisk/projects/HTML-Element-Extended/
COPYRIGHT
Copyright (c) 1999-2005 Matthew P. Sisk. All rights reserved. All wrongs
revenged. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
| |