Quote:
Originally Posted by capink
@chaley: is there a way to make the template output new lines. For example if I want to output all formats for a book separated by a new line? Or do I have to wrap the call to the formatter to maybe replace '\\n' with a new line (in Action Chains)?
Edit: Replacing '\\n' with newlines would be a really bad idea it can mess up file paths which can have the same character. I will think of a safer representation for a new line. Maybe a new_line() function that inserts a non-printable character.
|
The lexical analyser doesn't do any character escaping. The exception, which it gets wrong, is escaping quotes for example 'aa\'bb' that ends up as the string aa\'bb. Yes, the backslash is still there, which is wrong. I am looking for ways to fix this without breaking all strings containing backslashes.
If we use a "newline()" function, and presumably strcat(), then why not have it put a real newline in the string?
Note that by default leading and trailing whitespace is stripped (strip()). If you don't want that then call the formatter with strip_results=False.
EDIT: if strip_results is True then all white space, including newlines, is turned into a single space.