Coder Social home page Coder Social logo

Comments (8)

jameshfisher avatar jameshfisher commented on July 22, 2024

Any opinions on this? I can have a go at fixing this myself, if time is the issue. I just really hope it's not by design.

from shakespeare.

snoyberg avatar snoyberg commented on July 22, 2024

I thought I'd responded to this, but apparently it didn't make it through.

There's a discussion on the Yesod mailing list about this right now. This approach is by design. If you want a workaround for now, you can turn on newline appending.

This approach may be changed in the future, but it's not clear yet that we'll actually do so.

from shakespeare.

jameshfisher avatar jameshfisher commented on July 22, 2024

Does closing this issue signal that this behavior is not going to be changed? Could you point me to the mailing list discussion? What do you mean by "turn on newline appending"? This is pretty much a deal-breaking bug in Hamlet for me, BTW.

from shakespeare.

jameshfisher avatar jameshfisher commented on July 22, 2024

There are other serious issues with Hamlet not respecting HTML whitespace semantics, too. For instance:

  • [|hamlet|<span>foo|] gives me <span>foo</span>, but [|hamlet|<span>#{foo}|] gives me <span>\nfoovalue\n</span>
  • mconcat inserts newlines between elements

Both of which are unacceptable. Are these going to be changed? Is there any documented justification for the current behavior?

from shakespeare.

snoyberg avatar snoyberg commented on July 22, 2024

Closing indicates that a bug report is not the right place for this discussion. There have been a few threads about this recently, eg:

https://groups.google.com/d/topic/yesodweb/-nTfT9SZsWQ/discussion

As far as turning on newlines, please have a look at the Haddocks:

http://hackage.haskell.org/packages/archive/hamlet/1.0.1.4/doc/html/Text-Hamlet.html#v:hamletNewlines

Simply referring to this as a bug isn't going to make it true; there are valid reasons for both behaviors, and insisting that your way is the only correct way is not really going to motivate any change. A healthy discussion on the mailing list, however, will.

As far as your other cases, if they are true, they are bugs. I'd like to see a reproducing test case, as I have seen no such behavior. (If the mconcat case is true, it's coming from blaze-html, not hamlet, so the bug report would need to be filed there.)

from shakespeare.

jameshfisher avatar jameshfisher commented on July 22, 2024

Apologies: that behavior is Blaze.

hamletNewlines seems an OK workaround for now.

I suspect the current behavior is because where multiple lines represent multiple tags, you want to concatenate them all without any space in between.

Could we not have an exception to this for two adjacent lines of text, in which case a space is inserted?

from shakespeare.

jameshfisher avatar jameshfisher commented on July 22, 2024

Unfortunately hamletNewlines seems to be inserting newlines where I don't want them. Specifically, if I do

[hamlet|
  One ^{two}.
|]

I get the output

One 
two
.

Is this desired behaviour? What can I do to work around this?

from shakespeare.

snoyberg avatar snoyberg commented on July 22, 2024

I don't believe this is coming from Hamlet, but from your definition of two (you had a similar example above I believe). For future bug reports, can you include full test programs so we can avoid false reports?

I'm not going to make any decisions about changes to Hamlet based on a discussion in this issue. If you would like to propose changes, please do so on the mailing list.

from shakespeare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.