Discussion:
Unexpected behavior of pre directive with indented output
Jeff Cunningham
2007-12-29 18:48:25 UTC
Permalink
Hi,

I ran into some unexpected behavior this morning when using the pre
directive. Here is an example:

(with-html-output (*standard-output* nil :prologue nil :indent t)
(:body
(:pre "This block of text
should all be justified to the left
edge of the window when rendered
by a browser, even if the HTML itself
is indented, no?")))

What is generated is the following:

<body>
<pre>
This block of text
should all be justified to the left
edge of the window when rendered
by a browser, even if the HTML itself
is indented, no?
</pre>
</body>

Which will "indent" the first line unexpectedly, as well as pre-pending
an unexpected line break. I realize that I can turn off indenting in my
output, but this seems inelegant. It seems like the pre directive needs
to be handled as a special case.

--Jeff
Edi Weitz
2007-12-29 19:00:27 UTC
Permalink
I realize that I can turn off indenting in my output, but this seems
inelegant. It seems like the pre directive needs to be handled as a
special case.
I don't agree. To me, the :INDENT argument is there mostly for the
purpose of debugging. Also, there are other tags besides PRE which
would also need special treatment.

Edi.
Jeff Cunningham
2007-12-29 19:40:01 UTC
Permalink
Post by Edi Weitz
I realize that I can turn off indenting in my output, but this seems
inelegant. It seems like the pre directive needs to be handled as a
special case.
I don't agree. To me, the :INDENT argument is there mostly for the
purpose of debugging. Also, there are other tags besides PRE which
would also need special treatment.
Edi.
_______________________________________________
Such as? It doesn't seem wise to have a debugging mode that changes the
behavior of what it is you are trying to debug. And its another thing to
go wrong which seems unnecessary.

--Jeff
Edi Weitz
2007-12-29 20:09:02 UTC
Permalink
Post by Jeff Cunningham
Such as?
TEXTAREA, for example.

There are more. I don't remember the details, but I've had cases
where whitespace between tags in tables changed the way the tables
were rendered by certain browsers.
Post by Jeff Cunningham
It doesn't seem wise to have a debugging mode that changes the
behavior of what it is you are trying to debug.
I didn't say "debugging mode," I said that it's there for the purpose
of debugging. I sometimes (rarely) use it if I want to look at the
generated HTML. In production environments I always turn the
indentation of.

CL-WHO is all about output and :INDENT T clearly changes the output.

Edi.
Jeff Cunningham
2007-12-29 20:20:23 UTC
Permalink
Post by Edi Weitz
Post by Jeff Cunningham
Such as?
TEXTAREA, for example.
There are more. I don't remember the details, but I've had cases
where whitespace between tags in tables changed the way the tables
were rendered by certain browsers.
Post by Jeff Cunningham
It doesn't seem wise to have a debugging mode that changes the
behavior of what it is you are trying to debug.
I didn't say "debugging mode," I said that it's there for the purpose
of debugging. I sometimes (rarely) use it if I want to look at the
generated HTML. In production environments I always turn the
indentation of.
CL-WHO is all about output and :INDENT T clearly changes the output.
Edi.
Fair enough. Might be nice to stick line in the 'with-html-output
description like: "Note: indentation will change the behavior of certain
HTML tags, such as <pre>, <textarea> and possibly others. "

Also, the word "indented" is misspelled in the sentence: "However, if
|/indent/| is /true/ line breaks will be inserted and nested tags will
be intended properly. " in the same paragraph.

--Jeff
Edi Weitz
2007-12-29 20:34:40 UTC
Permalink
Post by Jeff Cunningham
Fair enough. Might be nice to stick line in the 'with-html-output
description like: "Note: indentation will change the behavior of
certain HTML tags, such as <pre>, <textarea> and possibly others. "
I've update the online documentation accordingly. The documentation
in the tarball will be updated with the next release.
Post by Jeff Cunningham
Also, the word "indented" is misspelled in the sentence: "However, if
|/indent/| is /true/ line breaks will be inserted and nested tags will
be intended properly. " in the same paragraph.
Thanks, I've changed that as well.

Edi.

Loading...