Leading spaces and multiple spaces

Asked by Boris Gorelik on 2011-09-20

I need to place a verbatim copy of a text file into a document that I generate using pod.Renderer. The text contains many lines, some of which contain leading and/or multiple spaces. I need to keep these spaces as-is. I tried two approaches

First, I put a variable called "line" inside a paragraph and added a comment "do text for line in logMessages" This didn't work: all the leading spaces were removed and all the multiple spaces were changed to a single space

In my second attempt, I used the approach described here: https://answers.launchpad.net/appy/+question/134701 Namely, I added the following comment

do text
from xhtml(multilineString.replace('\n', '<br/>'))

Nevertheless, the effect was the same: leading spaces were removed and multiple spaces reduced to a single space.

Is there a way to solve this problem?
It would be nice to have something like LaTeX verbatim environment (http://en.wikibooks.org/wiki/LaTeX/Formatting#Verbatim_Text)

Question information

English Edit question
Appy Edit question
No assignee Edit question
Solved by:
Boris Gorelik
Last query:
Last reply:
Boris Gorelik (boris-gorelik) said : #1

Well, I managed to solve this problem as follows.
I created a function that creates XML representation of the desired text (including escaping the multiple spaces etc), assigning its output to a variable and adding the following comment to the template:

do text
from myFormatttedVariable

That's all.