Issue #9 resolved

space around newline in markup should not be removed

Anthon van der Neut
created an issue

If you look at the 404 page for the template example: http://wheezy.pythonanywhere.com/en/error/404, you can see that 'beenremoved' is one word although in the template source they are seperated by newline and whitespace.

The combination of the preprocessor (removing leading space from a line) and the tokenizer(replacing newlines with the empty string), results in incorrect rendering of markup text.

I tried changing the replace in core.py:351 from '' to ' ', and this reslults in correct output but also several failing tests.

An ungly workaround is to remove newlines from markup in the html templates...

Comments (4)

  1. Andriy Kornatskyy repo owner

    A workaround is to use space + backslash at the end of line.

        <p>
        Unfortunately the page you are looking for may have been \
        removed, had its name changed, under construction or is \
        temporarily unavailable. Try checking the web address for \
        typos, please. We apologize for the inconvenience.
        </p>
    

    The issue is most likely related to WhitespaceExtension in wheezy.html.

  2. Andriy Kornatskyy repo owner

    This commit fixes the issue in WhitespaceExtension (you do not need backslash in this case). The demo template was improved and covered with tests to prevent this issue in the future (here). Live demo updated as well.

  3. Log in to comment