htmlperlperl-pod

How can one stop pod2html from removing whitespaces in preformatted, quoted text?


Assume a .pod file contains preformatted text marked with ", e.g.,

 "I want  these  4  additional  whitespaces to remain in HTML".

pod2man correctly retains the formatting. pod2html removes the whitespaces.

Basically, what I'd like to get is

<pre>I want  these  4  additional  whitespaces to remain in HTML<\pre>
in the HTML output, not "I want these 4 additional whitespaces to remain in HTML" (additional white spaces gone).

Or asked differently, is there any way to mark up text such as for pod2html to not remove additional whitespaces?

The only solution I found so far is writing bespoke =begin html ... =end html code, but that seems a cludge.


Solution

  • I created this file, test.pod, which has a "Verbatim" block of indented text:

    =pod
    
    This is a basic paragraph:
    
        "I want  these  4  additional  whitespaces to remain in HTML".
    
    This is the last paragraph.
    
    =cut
    

    When I run this with pod2html (Pod::Html 1.35, but also tested back to 1.22). Note that the quotes are still there, but escaped:

    <?xml version="1.0" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rev="made" href="mailto:brian@m2otter.local" />
    </head>
    
    <body>
    
    
    <p>This is a basic paragraph:</p>
    
    <pre><code>&quot;I want  these  4  additional  whitespaces to remain in HTML&quot;.</code></pre>
    
    <p>This is the last paragraph.</p>
    
    
    </body>
    
    </html>