RejectedSoftware Forums

Sign up

diet-ng HTML pretty printing

I've noticed that something like this

                label(for="lower") 
                    em time
                    | lower bound
                input(type="number", id="lower", name="less", value="0")

generates something like this according to Firefox

		<label for="lower">
			<em>time</em>
							
lower bound
		</label>
		<input type="number" id="lower" name="less" value="0"/>

with an extra blank line that seems to be indented correctly for the unindented text that succeeds it.

A more complicated example is that something like this

                ol
                    li(value="2")
                        | Define which values of the 
                        strong status variable
                        | are mapped to 
                        strong zero
                        | and which to 
                        strong one.

generates something like this according to Firefox

		<ol>
			<li value="2">
				Define which values of the <strong>status variable</strong>
								
are mapped to <strong>zero</strong>
								
and which to <strong>one.</strong>
			</li>
		</ol>

which exhibits the same phenomenon wherever | is used to start a line, but not where strong is so used.

I'm unclear what I should expect here, but I suspect it's not the above. Please clarify.

Re: diet-ng HTML pretty printing

On Sat, 25 Feb 2017 21:49:51 GMT, Carl Sturtivant wrote:

I've noticed that something like this

                label(for="lower") 
                    em time
                    | lower bound
                input(type="number", id="lower", name="less", value="0")

generates something like this according to Firefox

		<label for="lower">
			<em>time</em>
							
lower bound
		</label>
		<input type="number" id="lower" name="less" value="0"/>

with an extra blank line that seems to be indented correctly for the unindented text that succeeds it.

A more complicated example is that something like this

                ol
                    li(value="2")
                        | Define which values of the 
                        strong status variable
                        | are mapped to 
                        strong zero
                        | and which to 
                        strong one.

generates something like this according to Firefox

		<ol>
			<li value="2">
				Define which values of the <strong>status variable</strong>
								
are mapped to <strong>zero</strong>
								
and which to <strong>one.</strong>
			</li>
		</ol>

which exhibits the same phenomenon wherever | is used to start a line, but not where strong is so used.

I'm unclear what I should expect here, but I suspect it's not the above. Please clarify.

Fixed by 2347a1a - the newlines before the text lines are indeed unexpected. Each text line is supposed to be output unindented (to not break pre-formatted nodes).