Alright, I'm glad that's settled. Screenshot of output shows initial output. I'm really impressed with the style, thank you for writing it. The campaign continues between readmore tags:
Here is the output from the script that tries to broaden this result, 4.tthtml.pl:
<table> <tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td><td>f</td></tr> <tbody> <tr><td>a</td><td>q</td><td>c</td><td>d</td><td>e</td><td>f</td></tr> <tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td><td>█</td +></tr> <tr><td>█</td><td>b</td><td>c</td><td>d</td><td>e</td><td>f</td +></tr> </tbody> </table> ------- ------- <style> table { border:0; border-collapse:collapse; } td { font-weight:700; text-align:center; line-height:200%; font-size: 150%; border:2px solid black; width:2em; height:2em } td.fill { background-color:black; } </style><table> <tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td><td>f</td></tr> <tbody> <tr><td>a</td><td>q</td><td>c</td><td>d</td><td>e</td><td>f</td></tr> <tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td><td>█</td +></tr> <tr><td>█</td><td>b</td><td>c</td><td>d</td><td>e</td><td>f</td +></tr> </tbody> </table>
Here is the source:
#!/usr/bin/env perl use 5.16.0; use utf8; use strictures; binmode STDOUT, 'utf8'; use open OUT => ':utf8'; my $out_string = ' <style> table { border:0; border-collapse:collapse; } td { font-weight:700; text-align:center; line-height:200%; font-size: 150%; border:2px solid black; width:2em; height:2em } td.fill { background-color:black; } </style>'; use Text::Table::HTML; my $rows = [ [ "a" .. "f" ], [ "a", "q", "c" .. "f" ], [ "a" .. "e", "\x{2588}" ], [ "\x{2588}", "b" .. "f" ], ]; my $string = Text::Table::HTML::table(rows => $rows); say "$string"; say "-------"; $out_string .= $string; say "-------"; say "$out_string"; $
Do I have a string here, or is it something that isn't a string and I'm trying to shoehorn it into one?
When I try to take the ascii example and put it in a place where it will get spliced into my script, I get:
------------string inserted "<table>\n<tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td><td>f< +/td></tr>\n<tbody>\n<tr><td>a</td><td>q</td><td>c</td><td>d</td><td>e +</td><td>f</td></tr>\n<tr><td>a</td><td>b</td><td>c</td><td>d</td><td +>e</td><td>█</td></tr>\n<tr><td>█</td><td>b</td><td>c</ +td><td>d</td><td>e</td><td>f</td></tr>\n</tbody>\n</table>\n" ------------string to be inserted ^^^ Can't use string ("<table> <tr><td>a</td><td>b</td>"...) as a SCALAR ref while "strict refs" in u +se at template_stuff/html9.pm line 150. $
from:
say "------------string inserted"; use Text::Table::HTML; use Data::Dump; my $rows = [ [ "a" .. "f" ], [ "a", "q", "c" .. "f" ], [ "a" .. "e", "\x{2588}" ], [ "\x{2588}", "b" .. "f" ], ]; my $string = Text::Table::HTML::table( rows => $rows ); #say "$string"; dd $string; say "------------string to be inserted ^^^"; print $fh $$string;
It looks like a string coming from Data::Dump, does it not?
Thanks for your comments,
In reply to Re^2: getting html characters to align
by Aldebaran
in thread getting html characters to align
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |