skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    Thanks for all suggestions above. A "full paragraph" solution didn't work as the sample should appear in free-flowing text. So here's the approach (again, a full sample file) that did the trick for me:

    =pod
    
    This is a free flowing text where "I want E<32>these E<32>4 E<32>additional E<32>whitespaces to remain in HTML". Is this doable?
    
    =cut
    

    Apologies for not having thought about being more specific / providing sample code.


  2. 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:[email protected]" />
    </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>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search