Tk-HyperText
view release on metacpan or search on metacpan
lib/Tk/HyperText.pm view on Meta::CPAN
package Tk::HyperText;
##########################################################
# Look to the end of this file for the POD documentation #
##########################################################
use strict;
use warnings;
use base qw(Tk::Derived Tk::ROText);
use Tk::PNG;
use Tk::JPEG;
use Tk::BrowseEntry;
use Tk::Listbox;
use Tk::Text;
use HTML::TokeParser;
use URI::Escape;
use HTML::Entities::Numbered ();
our $VERSION = '0.13';
my %fontCache = ();
Construct Tk::Widget 'HyperText';
sub Populate
{
my ($cw,$args) = @_;
# Strip out the custom arguments for this widget.
my $opts = {
-attributes => {
-anchor => {
-normal => '#0000FF',
-hover => '#FF0000',
-active => '#FF0000',
-visited => '#990099',
},
-font => {
-family => 'Times',
-mono => 'Courier',
-size => 'medium',
-bold => 0, # Bold
-italic => 0, # Italic
-under => 0, # Underline
-over => 0, # Overstrike
},
-style => {
-margins => 0,
-color => '#000000', # Text color
-back => '#FFFFFF', # Text back
},
},
-continuous => 0,
-allow => [],
-deny => [],
};
# Copy attributes over.
if (exists $args->{'-attributes'}) {
my $attr = delete $args->{'-attributes'};
foreach my $tag (keys %{$attr}) {
foreach my $name (keys %{$attr->{$tag}}) {
$opts->{'-attributes'}->{$tag}->{$name} =
$attr->{$tag}->{$name};
}
}
}
# Copy other options over.
lib/Tk/HyperText.pm view on Meta::CPAN
<select> (name, size, multiple)
<option> (value, selected)
<input> (name, type, size, value, maxlength, disabled, checked)
types: text, password, checkbox, radio, button, submit, reset
<table> (border, cellspacing, cellpadding)
<tr>
<td> (colspan, rowspan)
<th>
<thead>
<tbody>
<tfoot>
<hr> (height, size)
<img> (src, width, height, vspace, hspace, align, alt)*
<font> (face, size, color, back)
<basefont>
<h1>..<h6>
<ol> (type, start)
<ul> (type)
<li>
<blockquote>
<div> (align)
<span>
<pre>
<code>
<tt>
<kbd>
<samp>
<center>
<right>
<left>
<sup>
<sub>
<big>
<small>
<b>
<strong>
<i>
<em>
<address>
<var>
<cite>
<def>
<u>
<ins>
<s>
<del>
=head1 SEE ALSO
L<Tk::ROText> and L<Tk::Text>.
=head1 CHANGES
0.12 Feb 25, 2016
- Add more dependencies to get CPANTS to pass.
0.11 Feb 23, 2016
- Add dependency on HTML::TokeParser.
0.10 Sep 18, 2015
- Add dependency on Tk::Derived.
0.09 Nov 11, 2013
- Reformatted as per CPAN::Changes::Spec -neilbowers
0.08 Nov 1, 2013
- Use hex() instead of eval() to convert hex strings into numbers.
- Set default values for body colors.
- Stop demo.pl from being installed; rename it to eg/example.
0.06 July 14, 2008
- The module uses HTML::TokeParser now and does "real" HTML parsing.
- Badly broke backwards compatibility.
0.05 July 11, 2007
- Added support for "tag permissions", so that you can allow/deny specific tags from
being rendered (i.e. say you're making a chat client which uses HTML and you don't
want people inserting images into their messages, or style sheets, etc)
- Added the tags <address>, <var>, <cite>, and <def>.
- Added the <hr> tag.
- Added two "default images" that are displayed when an <img> tag tries to show
an image that couldn't be found, or was found but is a file type that isn't
supported (e.g. <img src="index.html"> would show an "invalid image" icon).
- Bug fix: every opened tag that modifies your style will now copy all the other
stacks. As a result, opening <font back="yellow">, then <font color="red">, and
then closing the red font, will still apply the yellow background to the following
text. The same is true for every tag.
- Added some support for Cascading StyleSheets.
- Added some actual use for the "active link color": it's used as the hover color
on links (using it as a true active color is mostly useless, since most of the
time the page won't remain very long when clicking on a link to even see it)
0.04 June 23, 2007
- Added support for the <basefont> tag.
- Added support for <ul>, <ol>, and <li>. I've even extended the HTML specs a
little and added "diamonds" as a shape for <ul>, and allowed <ul> to specify
a decimal escape code (<ul type="#0164">)
- Added a "page history", so that the "visited link color" on pages can actually
be applied to the links.
- Fixed the <blockquote> so that the margin applies to the right side as well.
0.02 June 20, 2007
- Bugfix: on consecutive insert() commands (without clearing it in between),
the entire content of the HTML already in the widget would be inserted again,
in addition to the new content. This has been fixed.
0.01 June 20, 2007
- Initial release.
=head1 AUTHOR
Noah Petherbridge, http://www.kirsle.net/
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.
=cut
# vim: noet ts=8 sw=8
( run in 0.327 second using v1.01-cache-2.11-cpan-eab888a1d7d )