in reply to Re^3: Newlines in HTML::LoL
in thread Newlines in HTML::LoL

Sorry, no idea!

I'm normally fond of DSLs ... but this module doesn't look so promising, that I'd like to try it. :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^5: Newlines in HTML::LoL
by BernieC (Pilgrim) on Feb 01, 2021 at 23:15 UTC
    how annoying. This is the example in the POD:
    &hl(sub { print shift }, [table => {border => 2, width => '80%'}, [tr => [td => {nowrap => &hl_bool(1)}, 'This & that'], [td => {nowrap => &hl_bool(0)}, '<b>This is not bold</b>'], [td => [b => 'But this is']], [td => &hl_noquote('<b>And so is this</b>')]]]);
    and it produces:
    <table border="2" width="80%"> <tr> <td nowrap>This &amp; that</td> <td>&lt;b&gt;This is not bold&lt;/b&gt;</td> <td><b>But this is</b></td> <td><b>And so is this</b></td> </tr> </table>
    I can't figure out what's right with their example and what's wrong with my usage.. and it doens't look like there's another module for generating HTML structurally ... sigh
      > and it doens't look like there's another module for generating HTML structurally

      Sure CGI does, it's just now only documented in CGI::HTML::Functions

      And though it's not officially maintained anymore it's for sure a better bet than "19 year-old abandonware" (quoting Your Mother here)

      edit

      and after further reading there is also HTML::Tiny

      update

      And there is DSL::HTML which "takes the alternative approach, but does it in a significantly more elegent way."

      I intentionally left the typo in the quote ... you'll notice it has an "early version warning" and no changes since 2013

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        Thanks for the pointers. I already have the CGI module, I didn't know it was the html-generation stuff broken out. I also found another module that is fascinating me: HTML::TagTree. Everything is objects and the HTML tags are methods. whtn you create a table, your $table is a TagTree object {it says that every HMTL tag is a method} and it seems to produce nice-looking code. More to play with :)