yesodweb/shakespeare

Interpolated tags force a line break in Hamlet

Closed this issue · 2 comments

JaSpa commented

The following small program …

{-# LANGUAGE QuasiQuotes #-}
import Text.Blaze.Renderer.String
import Text.Hamlet

x = [shamlet|<a href=#>Foo|]
y = [shamlet|Foo #{x}!|]
main = putStrLn $ renderMarkup y

… generates this output:

Foo <a href="#">Foo</a>
!

But I would expect this output:

Foo <a href="#">Foo</a>!

Which makes quite a difference, because with the current behavior a space is displayed between the link and the punctation which I'm not able to get rid of.

ncaq commented

you can $newline never

{-# LANGUAGE QuasiQuotes #-}
import           Text.Blaze.Renderer.String
import           Text.Hamlet

x = [shamlet|$newline never
<a href=#>Foo|]
y = [shamlet|Foo #{x}!|]
main = putStrLn $ renderMarkup y
JaSpa commented

Oh my god, I thought I had tried this, I guess I tried $newline never everywhere expect there … never mind, thanks!