I personally believe that this morning I must be even more dumb than usual, because I seem to be completely unable to find a supposedly simple but not entirely trivial module suitable for my needs and that IMHO should be out there...

Specifically, I have some pure text chunks: code, preformatted text, ASCII art and so on. Now, for visualization purposes, I'd like not to print them to a terminal but into an HTML file, presumably within <pre> tags, but also possibly further embedded in a <div> complete with a caption, like as if it were a figure, and so on.

To put it briefly, something akin to what PM's code tags themselves do, except that I do not need the automatic wrap on long lines, which would even be annoying in my case, but that's just a detail... Of course and to put it briefly, there's nothing in this that I could not concoct up myself, but as a matter of principle it seems strange to me that there's not a module that would simply allow me to do something like:

print $t2h->add(text => $font->figify(-A => 'Hello, World!'), caption => "Text::FIGlet example, with font '$fontname +'");

I noticed I could find stuff just as complex as HTML::FromANSI which in turn looks like an overkill for what I'm really after. Thus the actual questions are:

--
If you can't understand the incipit, then please check the IPB Campaign.

In reply to [ASCII 2 HTML] Appearently unable to find simple module! by blazar

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.