Tk-HyperText

 view release on metacpan or  search on metacpan

lib/Tk/HyperText.pm  view on Meta::CPAN

						-relief             => 'raised',
						-borderwidth        => $cw->_isNumber ($border,0),
						-background         => $style{background} || $mAttr->{'-style'}->{'-back'},
					);
				$tabledata->{$tableid}->{row} = -1;
				$tabledata->{$tableid}->{col} = -1;
				$tabledata->{$tableid}->{border} = $cw->_isNumber ($border,0);
				$tabledata->{$tableid}->{cellspacing} = $cw->_isNumber ($cellspacing,0);
				$tabledata->{$tableid}->{cellpadding} = $cw->_isNumber ($cellpadding,0);
				$browser->windowCreate ('end',
					-window => $tabledata->{$tableid}->{widget},
					-align  => 'baseline',
				);
				$style{intable} = 1;
				push (@stack, $cw->_addStack(\%style));
			}
			elsif ($tag eq "tr") { # Table Row
				if ($style{intable}) {
					$tabledata->{$tableid}->{col} = -1;
					$tabledata->{$tableid}->{row}++;
				}
			}
			elsif ($tag =~ /^(td|th|thead|tbody|tfoot)$/) { # Table Data
				if ($style{intable}) {
					my $at = $data[2];
					my $colspan = undef;
					my $rowspan = undef;
					if (defined $at->{colspan}) {
						$colspan = $at->{colspan};
					} if (defined $at->{rowspan}) {
						$rowspan = $at->{rowspan};
					}
					$style{intd} = 1;
					$tabledata->{$tableid}->{col}++;
					$browser = $tabledata->{$tableid}->{widget}->ROText (
						-exportselection => 1,
						-takefocus       => 0,
						-highlightthickness => 0,
						-relief          => 'sunken',
						-wrap            => 'word',
						-borderwidth     => $tabledata->{$tableid}->{border},
						-insertofftime   => 1000,
						-insertontime    => 0,
						-width           => 0,
						-height          => 2,
						-padx            => $tabledata->{$tableid}->{cellpadding},
						-pady            => $tabledata->{$tableid}->{cellpadding},
						-foreground      => $style{foreground} || $mAttr->{'-style'}->{'-color'},
						-background      => $style{background} || $mAttr->{'-style'}->{'-back'},
						-cursor          => undef,
						-font       => [
							-family => $style{family},
							-weight => $style{weight},
							-slant  => $style{slant},
							-size   => $cw->_size ($style{size}),
							-underline => $style{underline},
							-overstrike => $style{overstrike},
						],
					);
					my @spans = ();
					push (@spans, '-columnspan' => $colspan) if defined $colspan;
					push (@spans, '-rowspan' => $rowspan) if defined $rowspan;
					$browser->grid (
						-row => $tabledata->{$tableid}->{row},
						-column => $tabledata->{$tableid}->{col},
						-sticky => 'nsew',
						-padx => $tabledata->{$tableid}->{cellspacing},
						-pady => $tabledata->{$tableid}->{cellspacing},
						@spans,
					);
					$lineWritten = 0;
				}
				push (@stack, $cw->_addStack(\%style));
			}
			elsif ($tag eq 'hr') { # HR
				$browser->insert ('end',"\n") if $lineWritten;
				my $at = $data[2];
				my $height = 4;
				if (exists $at->{size}) {
					$height = $at->{size};
				}
				my $width = $cw->screenwidth;
				my $frame = $browser->Frame (
					-relief             => 'raised',
					-height             => $height,
					-width              => $width,
					-borderwidth        => 1,
					-highlightthickness => 0,
				);
				$browser->insert ('end', "\n", $format);
				$browser->windowCreate ('end',
					-window => $frame,
					-padx   => 0,
					-pady   => 5,
				);
				$browser->insert ('end', "\n", $format);
				$lineWritten = 0;
				$endedBlock = 1;
			}
			elsif ($tag eq 'img') { # IMG
				my $at = $data[2];

				my $format = '';
				my $align = lc($at->{align} // '');
				$align = 'baseline' unless $align =~ /^(top|center|bottom|baseline)$/;
				if (length $at->{src}) {
					my ($ext) = $at->{src} =~ /\.([^\.]+)$/i;
					if ($ext =~ /^gif$/i) {
						$format = 'GIF';
					}
					elsif ($ext =~ /^png$/i) {
						$format = 'PNG';
					}
					elsif ($ext =~ /^(jpeg|jpe|jpg)$/i) {
						$format = 'JPEG';
					}
					elsif ($ext =~ /^bmp$/i) {
						$format = 'BMP';
					}
				}



( run in 0.613 second using v1.01-cache-2.11-cpan-39bf76dae61 )