Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

When i tried to convert a html content to plain text using the HTML::HTML5::ToText module ( am using the newer version 0.003 which had fixed the comment bug). The converted text contains html comment text which should have been removed.
But When i removed the "RenderTables" trait. The module works fine. It does not show the html comment text
Any idea guys ??
Here is my example code Html Part

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/ +/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>my html</title> </head> <body> <table width="100%" border="0" bgcolor="a5a3a6"> <tr> <td> <p>&nbsp;</p> <table width="600" cellpadding="0" cellspacing="0" border="0" align="c +enter" style="margin-top:10px;font-family:Verdana, Geneva, sans-serif +"> <tr style="background-color:#5d5d65;background: -webkit-gradie +nt(linear, 0% 0%, 0% 100%, from(#5d5d65), to(#45454d));background: -w +ebkit-linear-gradient(top, #5d5d65, #45454d bottom);background: -moz- +linear-gradient(top, #5d5d65 0%, #45454d 100%);background: -ms-linear +-gradient(top, #5d5d65, #45454d bottom);background: -o-linear-gradien +t(top, #5d5d65, #45454d bottom);filter: progid:DXImageTransform.Micro +soft.gradient(startColorstr='#5d5d65', endColorstr='#45454d');"> <td style="border-top-left-radius: 5px;-webkit-border-top-left +-radius:5px;-moz-border-top-left-radius:5px;padding:15px 0 15px 25px" +><img src="http://www.midphase.com/emails/midphase-email/images/logo. +png" width="191" height="52" style="display:block" /></td> <td align="right" style="border-top-right-radius: 5px;-webkit-bord +er-top-right-radius:5px;-moz-border-top-right-radius:5px;padding:15px + 25px 15px 0;color:#cccccc;font-size:21px;"><!-- SUBJECT HERE -->Tha +nk You <!-- // SUBJECT HERE --></td> </tr> </table> </body> </html>
Perl Part
print HTML::HTML5::ToText->with_traits(qw/ShowLinks ShowImages TextFor +matting RenderTables/)->new()->process_string($html_string);

*=*=*dEEPAk*=*=*

In reply to remove html comments using HTML::HTML5::ToText by mendeepak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (8)
    As of 2015-07-06 10:20 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (71 votes), past polls