ruricolist/spinneret

:pre is inserting extra whitespace, I believe in appropriately

dfmorrison opened this issue · 2 comments

Given the nature of the pre tag, it would seem that spinneret shouldn't insert any extra whitespace between its open and close tags, just the verbatim text supplied by the caller. Unfortunately it appears to be inserting extra whitepace, including a newline, before the close tag. This makes a mess of things for anyone trying to not have an extra newline between the end of their verbatim text and the next element. For example

ORG> (with-html
       (:div.some-class
         (:pre "verbatim line one
verbatim line two")
         (:p "Some following stuff")))
  
<div class=some-class>
 <pre>verbatim line one
verbatim line two
 </pre>
 <p>Some following stuff
</div>
NIL
ORG> (with-html
       (:div.some-class
         (:pre (:raw "verbatim line one
verbatim line two"))
         (:p "Some following stuff")))
  
<div class=some-class>
 <pre>verbatim line one
verbatim line two
 </pre>
 <p>Some following stuff
</div>
NIL
ORG> (let ((*suppress-inserted-spaces* t))
       (with-html
         (:div.some-class
          (:pre (:raw "verbatim line one
verbatim line two"))
          (:p "Some following stuff"))))
  
<div class=some-class>
 <pre>verbatim line one
verbatim line two
 </pre>
 <p>Some following stuff
</div>
NIL
ORG> 

I believe the results in all three cases should instead be

<div class=some-class>
 <pre>verbatim line one
verbatim line two</pre>
 <p>Some following stuff
</div>

That is, neither the added newline nor indentation should be within the preformatted block. Those two different version will render differently in a browser (there'll be a spurious line between the "verbatim line two" and the "Some following stuff").

Or am I missing something:?

You weren't missing anything; it was a bug.

That was quick! Many thanks. I can confirm that all seems well now, and I've happily removed my workaround from my own code.