1

Question is very simple but I am not found solution yet - probably it is not possible or very hard to find since it is very trivial.

Question is how to avoid adding spaces in formatted HTML after new line - especially in list of values.

First example see example:

1, 2

It produces required HTML like this:

1, 2

Now another example which not works:

1
, 
2

It produces invalid HTML like this:

1 , 2 required is 1, 2

How to achieve same result as in first example but using multiline text layout - I know that we could do it in one line but want to do in many lines to simplify program code (not HTML).

Chameleon
  • 9,722
  • 16
  • 65
  • 127

1 Answers1

1

It works as defined: in normal content, a newline is equivalent to a space. There is no way to change this principle in HTML. Just divide you content into lines so that the principle works for you, not against you. That is, break a line only at a point where a space is OK.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
  • Id there is not escape sequence to avoid it looks that is not solvable. It complicates i.e. django code - I will ask another question later if not solution will be proposed. Whatever thanks for answer. – Chameleon Jun 06 '12 at 11:06
  • @Chameleon, there is most probably some solution to the concrete problem you have, but you need to describe that problem (preferably illustrated by a specific example). – Jukka K. Korpela Jun 06 '12 at 11:40
  • It was explained completly above. I put two examples one that works and second which not works and want to make it working. Please explain what question do you have? – Chameleon Jun 08 '12 at 06:42
  • No @Chameleon, you just described that you would want to have text formatted by principles other than those applied by HTML rules, so that a line break would sometimes be ignored, sometimes produce a space. You just mentioned some complication of django code without saying what the real problem there would be. – Jukka K. Korpela Jun 08 '12 at 07:23
  • That is true question is about HTML in general not about Django. In Django problem is that code is not readable since have to use single line: 1{% if x %},{% endif %} not multiline - do you have idea how to avoid such constructions? – Chameleon Jun 08 '12 at 12:05