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

h1_preserve didn't work at all. What I got back for the same program, but the h1 changed to hl_preserve was an array ref, no text at all and a dd on the result showed me:
[ bless(do{\(my $o = "preserve")}, "HTML::LoL::Special"), sub { ... }, [ "HTML", [ "BODY", [ "FORM", ["LABEL", { for => "user" }, "Who are you?"], ["INPUT", { name => "user", type => "text" }], ], ], ], ]
which isn't quite what I wanna send to a browser :)

Replies are listed 'Best First'.
Re^4: Newlines in HTML::LoL
by LanX (Saint) on Feb 01, 2021 at 18:17 UTC
    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

      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