[hamlet] implicit spaces with newlines?

I find it a bit unintuitive that the hamlet code <p>hello <strong>there or <p> hello <strong>there generates the html <p>hello<strong>there</strong></p> I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.

I am wondering if the default behavior should be changed in hamlet, because
I find the white space issues a bit annoying myself. You end up with issues
either way, but in Hamlet we have made html the default, so maybe white
space behavior should be more closely aligned.
Yes, you need to append a space. You can follow the space with a '#' to let
everyone know there is a space there. This is documented in the book:
http://www.yesodweb.com/book/templates#tags
Greg Weber
On Thu, May 19, 2011 at 1:49 PM, Patrick Palka
I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On 05/19/11 at 02:08pm, Greg Weber wrote:
I am wondering if the default behavior should be changed in hamlet, because I find the white space issues a bit annoying myself. You end up with issues either way, but in Hamlet we have made html the default, so maybe white space behavior should be more closely aligned.
I agree with Greg that the more closely aligned with standard HTML, the better. Though, I don't really know the HTML standard well enough for my opinion to hold much weight... I can, however, offer a slightly out-of-the-box solution I've been using when my hamlet seems to grow too far vertically due to inline tags. It has the interesting side effect that your spacing intentions are more accurately passed through: -- I use Text and Widgets mostly, but this type signature could be -- made more general I'm sure strong :: T.Text -> GWidget strong t = [hamlet|<strong>#{t}|] Then you can just do: <p>hello ^{strong "there"}, how are you? Awkward? Silly? Sure, but I find it more visually pleasing than: <p> hello # <strong>there , how are you? Which can get exponentially worse (like when discussing something that requires <code> tags peppered throughout your paragraphs). HTH, Pat -- patrick brisbin

On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that: <i>foo</i> <b>bar</b> and <i>foo</i><b>bar</b> Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML: <p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p> In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace. So when designing Hamlet, I thought up a few possibilities: 1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired. (2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently. I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach. Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them. Michael

# render this:
<p>You are logged in as <i>Michael Snoyman</i>, <a
href="/logout">logout</a>.</p>
<p>Multi
line
paragraph.
</p>
# current - explicit
<p>You are logged in as #
<i>Michael Snoyman
, #
<a href="/logout">logout
.
<p>Multi
\ line
\ paragraph.
# alternative #! - implicitly add space, explicitly remove on the next line
<p>You are logged in as
<i>Michael Snoyman
,
<a href="/logout">logout
!.
<p>Multi
line
paragraph.
# alternative #2 - implicitly add space, explicitly remove on the current
line
<p>You are logged in as
<i>Michael Snoyman
,
<a href="/logout">logout#
.
<p>Multi
line
paragraph.
# alternative #3 - implicitly add space when there is a new line before tag
contents
# seems bad, just throwing it out there :)
<p>
You are logged in as
<i>Michael Snoyman
,
<a href="/logout">logout
.
<p>
Multi
line
paragraph.
# alternative #4 - implicitly add space. remove space with 'whitespace
alligators'
# somewhat similar to:
http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#whitespace_removal__and_
# > chomps white space *after* the tag
# < chomps white space *within* the tag
# would need more examples to see if this plays out well
<p>You are logged in as
<i>Michael Snoyman
,
<a href="/logout">logout>
.
<p>Multi
line
paragraph.
On Thu, May 19, 2011 at 8:57 PM, Michael Snoyman
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

Is it possible to have multiline $with construction ? Sometimes i have many
variables and very long line . Looks not pretty
for example
*$with a <- func1 val, b <- func2 val, c <- func3 val*
* d <- func4 val*
* <p>{a}*
*.....*
Thanks.
2011/5/20 Greg Weber
# render this: <p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p> <p>Multi line paragraph. </p>
# current - explicit <p>You are logged in as # <i>Michael Snoyman , # <a href="/logout">logout . <p>Multi \ line \ paragraph.
# alternative #! - implicitly add space, explicitly remove on the next line <p>You are logged in as <i>Michael Snoyman , <a href="/logout">logout !. <p>Multi line paragraph.
# alternative #2 - implicitly add space, explicitly remove on the current line <p>You are logged in as <i>Michael Snoyman , <a href="/logout">logout# . <p>Multi line paragraph.
# alternative #3 - implicitly add space when there is a new line before tag contents # seems bad, just throwing it out there :) <p> You are logged in as <i>Michael Snoyman ,
<a href="/logout">logout . <p> Multi line
paragraph.
# alternative #4 - implicitly add space. remove space with 'whitespace alligators' # somewhat similar to: http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#whitespace_removal... # > chomps white space *after* the tag # < chomps white space *within* the tag # would need more examples to see if this plays out well <p>You are logged in as <i>Michael Snoyman , <a href="/logout">logout> . <p>Multi line paragraph.
On Thu, May 19, 2011 at 8:57 PM, Michael Snoyman
wrote: On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- Best regards, Cheshkov Anton Phone: +7 909 005 18 82 Skype: cheshkov_anton

Hi Anton,
Your message is a bit off topic for white space- maybe you meant to reply to
one of several other recent hamlet messages requesting more features. Adding
more features is not being ruled out, but we have concluded there is a need
for a hamlet that allows for *arbitrary* haskell, probably using this
package: http://hackage.haskell.org/package/haskell-src-exts-qq-0.4.0
Greg Weber
On Fri, May 20, 2011 at 6:30 AM, Anton Cheshkov
Is it possible to have multiline $with construction ? Sometimes i have many variables and very long line . Looks not pretty
for example
*$with a <- func1 val, b <- func2 val, c <- func3 val* * d <- func4 val* * <p>{a}* *.....*
Thanks.
2011/5/20 Greg Weber
# render this: <p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p> <p>Multi line paragraph. </p>
# current - explicit <p>You are logged in as # <i>Michael Snoyman , # <a href="/logout">logout . <p>Multi \ line \ paragraph.
# alternative #! - implicitly add space, explicitly remove on the next line <p>You are logged in as <i>Michael Snoyman , <a href="/logout">logout !. <p>Multi line paragraph.
# alternative #2 - implicitly add space, explicitly remove on the current line <p>You are logged in as <i>Michael Snoyman , <a href="/logout">logout# . <p>Multi line paragraph.
# alternative #3 - implicitly add space when there is a new line before tag contents # seems bad, just throwing it out there :) <p> You are logged in as <i>Michael Snoyman ,
<a href="/logout">logout . <p> Multi line
paragraph.
# alternative #4 - implicitly add space. remove space with 'whitespace alligators' # somewhat similar to: http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#whitespace_removal... # > chomps white space *after* the tag # < chomps white space *within* the tag # would need more examples to see if this plays out well <p>You are logged in as <i>Michael Snoyman , <a href="/logout">logout> . <p>Multi line paragraph.
On Thu, May 19, 2011 at 8:57 PM, Michael Snoyman
wrote: On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- Best regards, Cheshkov Anton Phone: +7 909 005 18 82 Skype: cheshkov_anton

I think what the original author was saying was that when you make a new line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag. So yes, writing <p>hello<strong>there</strong></p> should not put white spacing. But when you write, in html: <p>hello <strong>there</strong></p> It is equivalent to <p>hello <strong>there</strong></p> (note the space). On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

That makes sense, thanks for that clarification. But the newline
already has a different meaning in Hamlet, so we can't really assign
it the same semantics as HTML's newline.
Michael
On Fri, May 20, 2011 at 6:12 PM, Daniel Patterson
I think what the original author was saying was that when you make a new line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On 05/20/11 at 11:12am, Daniel Patterson wrote:
I think what the original author was saying was that when you make a new line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
Isn't that simply due to the fact that HTML compresses whitespace across the board? (turning that "\n\t" or "\n " into just " ") Leading spaces in hamlet are used to define nesting, so also compressing this whitespace (rather than stripping it) would produce odd effects: <div> <p>Hey <strong>there Would turn into <div> <p>Hey <strong>there</strong></p></div> Which has an unneeded space after the parent <div> Right?
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- patrick brisbin

The Yesod homepage looks like this:
<p>
If you are new to Yesod, you should start off with #
<a href=@{FiveMinutesR}>the five minute start instructions
. The #
<a href=@{ScreencastsR}>screencasts
\ give a nice introduction to some of the advanced concepts, and
#
<a href=@{BookR}>the book
\ is the recommended approach to learning Yesod. Ask the #
<a href=@{CommunityR}>commnunity
\ for help.
Allowing one-line tags in positions other than the very beginning allows for
the removal of the '#' character:
<p>
If you are new to Yesod, you should start off with
\ <a href=@{FiveMinutesR}>the five minute start instructions
. The <a href=@{ScreencastsR}>screencasts
\ give a nice introduction to some of the advanced concepts, and
\ <a href=@{BookR}>the book
\ is the recommended approach to learning Yesod. Ask the
\ <a href=@{CommunityR}>commnunity
\ for help.
Having implicit spaces is actually a huge win here:
<p>
If you are new to Yesod, you should start off with
<a href=@{FiveMinutesR}>the five minute start instructions
The
<a href=@{ScreencastsR}>screencasts
give a nice introduction to some of the advanced concepts, and
<a href=@{BookR}>the book
is the recommended approach to learning Yesod. Ask the
<a href=@{CommunityR}>commnunity
for help.
But I am wondering if it is best to keep things the way they are but just
indicate when there should be implicit spaces. My thought is to somehow use
angle brackets. Changing <p> to <p>> would indicate implicit spaces.
Greg Weber
On Fri, May 20, 2011 at 8:22 AM, Patrick Brisbin
I think what the original author was saying was that when you make a new
On 05/20/11 at 11:12am, Daniel Patterson wrote: line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white
spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
Isn't that simply due to the fact that HTML compresses whitespace across the board? (turning that "\n\t" or "\n " into just " ")
Leading spaces in hamlet are used to define nesting, so also compressing this whitespace (rather than stripping it) would produce odd effects:
<div> <p>Hey <strong>there
Would turn into
<div> <p>Hey <strong>there</strong></p></div>
Which has an unneeded space after the parent <div>
Right?
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote:
I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- patrick brisbin
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On Tue, May 24, 2011 at 7:00 AM, Greg Weber
The Yesod homepage looks like this: <p> If you are new to Yesod, you should start off with # <a href=@{FiveMinutesR}>the five minute start instructions . The # <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and # <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the # <a href=@{CommunityR}>commnunity \ for help. Allowing one-line tags in positions other than the very beginning allows for the removal of the '#' character: <p> If you are new to Yesod, you should start off with \ <a href=@{FiveMinutesR}>the five minute start instructions . The <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and \ <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the \ <a href=@{CommunityR}>commnunity \ for help. Having implicit spaces is actually a huge win here: <p> If you are new to Yesod, you should start off with <a href=@{FiveMinutesR}>the five minute start instructions The <a href=@{ScreencastsR}>screencasts give a nice introduction to some of the advanced concepts, and <a href=@{BookR}>the book is the recommended approach to learning Yesod. Ask the <a href=@{CommunityR}>commnunity for help. But I am wondering if it is best to keep things the way they are but just indicate when there should be implicit spaces. My thought is to somehow use angle brackets. Changing <p> to <p>> would indicate implicit spaces.
What's the advantage of adding a new syntax for "implicit" space versus just explicitly adding the space? Michael
Greg Weber On Fri, May 20, 2011 at 8:22 AM, Patrick Brisbin
wrote: On 05/20/11 at 11:12am, Daniel Patterson wrote:
I think what the original author was saying was that when you make a new line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
Isn't that simply due to the fact that HTML compresses whitespace across the board? (turning that "\n\t" or "\n " into just " ")
Leading spaces in hamlet are used to define nesting, so also compressing this whitespace (rather than stripping it) would produce odd effects:
<div> <p>Hey <strong>there
Would turn into
<div> <p>Hey <strong>there</strong></p></div>
Which has an unneeded space after the parent <div>
Right?
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- patrick brisbin
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On Tue, May 24, 2011 at 4:13 PM, Michael Snoyman
On Tue, May 24, 2011 at 7:00 AM, Greg Weber
wrote: The Yesod homepage looks like this: <p> If you are new to Yesod, you should start off with # <a href=@{FiveMinutesR}>the five minute start instructions . The # <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and # <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the # <a href=@{CommunityR}>commnunity \ for help. Allowing one-line tags in positions other than the very beginning allows for the removal of the '#' character: <p> If you are new to Yesod, you should start off with \ <a href=@{FiveMinutesR}>the five minute start instructions . The <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and \ <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the \ <a href=@{CommunityR}>commnunity \ for help. Having implicit spaces is actually a huge win here: <p> If you are new to Yesod, you should start off with <a href=@{FiveMinutesR}>the five minute start instructions The <a href=@{ScreencastsR}>screencasts give a nice introduction to some of the advanced concepts, and <a href=@{BookR}>the book is the recommended approach to learning Yesod. Ask the <a href=@{CommunityR}>commnunity for help. But I am wondering if it is best to keep things the way they are but just indicate when there should be implicit spaces. My thought is to somehow use angle brackets. Changing <p> to <p>> would indicate implicit spaces.
What's the advantage of adding a new syntax for "implicit" space versus just explicitly adding the space?
I think he means that the child nodes of <p>> would be affected by some implicit spacing rules. Personally I prefer one consistent behaviour (explicit spacing every time). Trying to get too smart will get confusing and inaccurate quickly.
Michael
Greg Weber On Fri, May 20, 2011 at 8:22 AM, Patrick Brisbin
wrote: On 05/20/11 at 11:12am, Daniel Patterson wrote:
I think what the original author was saying was that when you make a new line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
Isn't that simply due to the fact that HTML compresses whitespace across the board? (turning that "\n\t" or "\n " into just " ")
Leading spaces in hamlet are used to define nesting, so also compressing this whitespace (rather than stripping it) would produce odd effects:
<div> <p>Hey <strong>there
Would turn into
<div> <p>Hey <strong>there</strong></p></div>
Which has an unneeded space after the parent <div>
Right?
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka
wrote: I find it a bit unintuitive that the hamlet code
<p>hello <strong>there
or
<p> hello <strong>there
generates the html
<p>hello<strong>there</strong></p>
I expected there to be a space between "hello" and "there" similar to what the html specifications dictate. Is this behavior intentional or an oversight? If it's the former, then what is the recommended way to simulate my expected behavior? Appending a space to the end of a line is mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- patrick brisbin
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device

Yes, that is the idea- all the inner content or descendant nodes will now have implicit spacing- adding a '>' to get the "huge win" scenario from the examples given. I do think it adds confusion for new users- it isn't something we would want to use in a tutorial. It would be a feature for users already comfortable with Hamlet. Perhaps '<p>>' is actually too subtle. Some alternatives: <p>spaced> <p>S> <p>#> <p>< > There is also a possibility of adding an indicator inside the tag.
On Mon, May 23, 2011 at 11:22 PM, Mark Bradley
On Tue, May 24, 2011 at 4:13 PM, Michael Snoyman
wrote: On Tue, May 24, 2011 at 7:00 AM, Greg Weber
wrote: The Yesod homepage looks like this: <p> If you are new to Yesod, you should start off with # <a href=@{FiveMinutesR}>the five minute start instructions . The # <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts,
and
# <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the # <a href=@{CommunityR}>commnunity \ for help. Allowing one-line tags in positions other than the very beginning allows for the removal of the '#' character: <p> If you are new to Yesod, you should start off with \ <a href=@{FiveMinutesR}>the five minute start instructions . The <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and \ <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the \ <a href=@{CommunityR}>commnunity \ for help. Having implicit spaces is actually a huge win here: <p> If you are new to Yesod, you should start off with <a href=@{FiveMinutesR}>the five minute start instructions The <a href=@{ScreencastsR}>screencasts give a nice introduction to some of the advanced concepts, and <a href=@{BookR}>the book is the recommended approach to learning Yesod. Ask the <a href=@{CommunityR}>commnunity for help. But I am wondering if it is best to keep things the way they are but just indicate when there should be implicit spaces. My thought is to somehow use angle brackets. Changing <p> to <p>> would indicate implicit spaces.
What's the advantage of adding a new syntax for "implicit" space versus just explicitly adding the space?
I think he means that the child nodes of <p>> would be affected by some implicit spacing rules.
Personally I prefer one consistent behaviour (explicit spacing every time). Trying to get too smart will get confusing and inaccurate quickly.
Michael
Greg Weber On Fri, May 20, 2011 at 8:22 AM, Patrick Brisbin
On 05/20/11 at 11:12am, Daniel Patterson wrote:
I think what the original author was saying was that when you make a
new
line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
Isn't that simply due to the fact that HTML compresses whitespace across the board? (turning that "\n\t" or "\n " into just " ")
Leading spaces in hamlet are used to define nesting, so also compressing this whitespace (rather than stripping it) would produce odd effects:
<div> <p>Hey <strong>there
Would turn into
<div> <p>Hey <strong>there</strong></p></div>
Which has an unneeded space after the parent <div>
Right?
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
On Thu, May 19, 2011 at 11:49 PM, Patrick Palka <
wrote: patrick@parcs.ath.cx>
wrote: > I find it a bit unintuitive that the hamlet code > > <p>hello > <strong>there > > or > > <p> > hello > <strong>there > > generates the html > > <p>hello<strong>there</strong></p> > > I expected there to be a space between "hello" and "there" similar to > what > the html specifications dictate. Is this behavior intentional or an > oversight? If it's the former, then what is the recommended way to > simulate > my expected behavior? Appending a space to the end of a line is > mentally ugly and syntactically obscure.
I'm not sure what you mean by "what the html specifications dictate." HTML is whitespace-sensitive, meaning that:
<i>foo</i> <b>bar</b>
and
<i>foo</i><b>bar</b>
Are different. Now, in all likelihood in the above example, you will want to have the whitespace surrounding tags. But consider the following HTML:
<p>You are logged in as <i>Michael Snoyman</i>, <a href="/logout">logout</a>.</p><p>Another paragraph.</p>
In the case of the <i> and <a> tags, we definitely do *not* want to add whitespace after the tag (though we do want it before the tag). In the case of <p>, we don't care one way or another, but adding the whitespace everywhere will take up (a trivial amount of) extra bandwidth. tl;dr: Sometimes you don't want the whitespace.
So when designing Hamlet, I thought up a few possibilities:
1) What we do now: all whitespace must be explicit. 2) Implicitly add whitespace before/after every tag. 3) Do something "smart", adding whitespace where it's desired.
(2) isn't really an option because it makes having a tag as the last word in a sentence impossible. (3) gives me the creeps: I like smart libraries, but I will *never* trust a library to do this kind of stuff correctly all the time, even if I'm the one making up the rules for it to follow! And I have no doubt that it will quickly devolve into 500 lines of hairy code to try and cover millions of corner cases. Oh, and don't forget that there are other languages than English that might approach it differently.
I suppose another possibility is (2) along with some special way of forcing the removal of extra whitespace, but this seemed much less intuitive than the current approach.
Anyway, that's the reasoning behind this stuff, if people have better ideas, I'd like to hear them.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- patrick brisbin
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device

If people really want this, I'll consider it. But it looks to me like
a like of confusion and complexity for very little gain.
Michael
On Tue, May 24, 2011 at 5:05 PM, Greg Weber
Yes, that is the idea- all the inner content or descendant nodes will now have implicit spacing- adding a '>' to get the "huge win" scenario from the examples given. I do think it adds confusion for new users- it isn't something we would want to use in a tutorial. It would be a feature for users already comfortable with Hamlet. Perhaps '<p>>' is actually too subtle. Some alternatives: <p>spaced> <p>S> <p>#> <p>< > There is also a possibility of adding an indicator inside the tag.
On Mon, May 23, 2011 at 11:22 PM, Mark Bradley
wrote: On Tue, May 24, 2011 at 4:13 PM, Michael Snoyman
wrote: On Tue, May 24, 2011 at 7:00 AM, Greg Weber
wrote: The Yesod homepage looks like this: <p> If you are new to Yesod, you should start off with # <a href=@{FiveMinutesR}>the five minute start instructions . The # <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and # <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the # <a href=@{CommunityR}>commnunity \ for help. Allowing one-line tags in positions other than the very beginning allows for the removal of the '#' character: <p> If you are new to Yesod, you should start off with \ <a href=@{FiveMinutesR}>the five minute start instructions . The <a href=@{ScreencastsR}>screencasts \ give a nice introduction to some of the advanced concepts, and \ <a href=@{BookR}>the book \ is the recommended approach to learning Yesod. Ask the \ <a href=@{CommunityR}>commnunity \ for help. Having implicit spaces is actually a huge win here: <p> If you are new to Yesod, you should start off with <a href=@{FiveMinutesR}>the five minute start instructions The <a href=@{ScreencastsR}>screencasts give a nice introduction to some of the advanced concepts, and <a href=@{BookR}>the book is the recommended approach to learning Yesod. Ask the <a href=@{CommunityR}>commnunity for help. But I am wondering if it is best to keep things the way they are but just indicate when there should be implicit spaces. My thought is to somehow use angle brackets. Changing <p> to <p>> would indicate implicit spaces.
What's the advantage of adding a new syntax for "implicit" space versus just explicitly adding the space?
I think he means that the child nodes of <p>> would be affected by some implicit spacing rules.
Personally I prefer one consistent behaviour (explicit spacing every time). Trying to get too smart will get confusing and inaccurate quickly.
Michael
Greg Weber On Fri, May 20, 2011 at 8:22 AM, Patrick Brisbin
wrote: On 05/20/11 at 11:12am, Daniel Patterson wrote:
I think what the original author was saying was that when you make a new line with html, whitespace is inserted, not whether hamlet should automatically insert space after every tag.
So yes, writing <p>hello<strong>there</strong></p> should not put white spacing.
But when you write, in html: <p>hello <strong>there</strong></p>
It is equivalent to <p>hello <strong>there</strong></p> (note the space).
Isn't that simply due to the fact that HTML compresses whitespace across the board? (turning that "\n\t" or "\n " into just " ")
Leading spaces in hamlet are used to define nesting, so also compressing this whitespace (rather than stripping it) would produce odd effects:
<div> <p>Hey <strong>there
Would turn into
<div> <p>Hey <strong>there</strong></p></div>
Which has an unneeded space after the parent <div>
Right?
On May 19, 2011, at 11:57 PM, Michael Snoyman wrote:
> On Thu, May 19, 2011 at 11:49 PM, Patrick Palka >
> wrote: >> I find it a bit unintuitive that the hamlet code >> >> <p>hello >> <strong>there >> >> or >> >> <p> >> hello >> <strong>there >> >> generates the html >> >> <p>hello<strong>there</strong></p> >> >> I expected there to be a space between "hello" and "there" >> similar to >> what >> the html specifications dictate. Is this behavior intentional or >> an >> oversight? If it's the former, then what is the recommended way >> to >> simulate >> my expected behavior? Appending a space to the end of a line is >> mentally ugly and syntactically obscure. > > I'm not sure what you mean by "what the html specifications > dictate." > HTML is whitespace-sensitive, meaning that: > > <i>foo</i> <b>bar</b> > > and > > <i>foo</i><b>bar</b> > > Are different. Now, in all likelihood in the above example, you > will > want to have the whitespace surrounding tags. But consider the > following HTML: > > <p>You are logged in as <i>Michael Snoyman</i>, <a > href="/logout">logout</a>.</p><p>Another paragraph.</p> > > In the case of the <i> and <a> tags, we definitely do *not* want > to > add whitespace after the tag (though we do want it before the > tag). In > the case of <p>, we don't care one way or another, but adding the > whitespace everywhere will take up (a trivial amount of) extra > bandwidth. tl;dr: Sometimes you don't want the whitespace. > > So when designing Hamlet, I thought up a few possibilities: > > 1) What we do now: all whitespace must be explicit. > 2) Implicitly add whitespace before/after every tag. > 3) Do something "smart", adding whitespace where it's desired. > > (2) isn't really an option because it makes having a tag as the > last > word in a sentence impossible. (3) gives me the creeps: I like > smart > libraries, but I will *never* trust a library to do this kind of > stuff > correctly all the time, even if I'm the one making up the rules > for it > to follow! And I have no doubt that it will quickly devolve into > 500 > lines of hairy code to try and cover millions of corner cases. Oh, > and > don't forget that there are other languages than English that > might > approach it differently. > > I suppose another possibility is (2) along with some special way > of > forcing the removal of extra whitespace, but this seemed much less > intuitive than the current approach. > > Anyway, that's the reasoning behind this stuff, if people have > better > ideas, I'd like to hear them. > > Michael > > _______________________________________________ > web-devel mailing list > web-devel@haskell.org > http://www.haskell.org/mailman/listinfo/web-devel _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- patrick brisbin
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device
participants (7)
-
Anton Cheshkov
-
Daniel Patterson
-
Greg Weber
-
Mark Bradley
-
Michael Snoyman
-
Patrick Brisbin
-
Patrick Palka