i'd rather easily converted my html files to hamlet format. the most
problematic thing both for conversion and probably further
maintenance was the handling of multiline contols - i mean than
something like
<p>text
text</p>
should be converted to
<p>text #
text
probably it was very motivated decision, but afair most html
templating systems i've learned don't require #'s, and for conversion
of typical, already structured html file it's the most time-consuming
and bug-prone part - the rest is just to remove all those </...> tags
and it's very fast and easy
so, the question is obvious - may be this decision need to be reversed?
-- Best regards,
Bulat mailto:Bulat.Zigans...@gmail.com
I don't think the current haskell hamlet implementation has the most
natural defaults, but it is easy to explain what the rules are.
For my other implementations [1] it defaults to adding new lines or a
space and I rarely need to point out spacing to hamlet.
> i'd rather easily converted my html files to hamlet format. the most
> problematic thing both for conversion and probably further
> maintenance was the handling of multiline contols - i mean than
> something like
> <p>text
> text</p>
> should be converted to
> <p>text #
> text
> probably it was very motivated decision, but afair most html
> templating systems i've learned don't require #'s, and for conversion
> of typical, already structured html file it's the most time-consuming
> and bug-prone part - the rest is just to remove all those </...> tags
> and it's very fast and easy
> so, the question is obvious - may be this decision need to be reversed?
> --
> Best regards,
> Bulat mailto:Bulat.Zigans...@gmail.com
There are two things I was trying to avoid in designing the current setup:
* A bunch of special case rules about when to add whitespace. I like
the fact that we can explain things with one sentence: there's no
extra whitespace added.
* It's possible to express anything. If whitespace is *always* added,
it's impossible to use Hamlet tag syntax for, e.g. <i>Michael</i>'s
car.
But we can probably still hit both of those requirements if we (1)
switch the default to *always* adding whitespace after a tag and (2)
having some escape mechanism (e.g., a backslash at the end of the
line) to disable auto-whitespace.
Personally, I don't mind the current setup, but if people want to make
the change, I'm open to it. What's general consensus?
On Wed, Jun 13, 2012 at 9:00 PM, Greg Weber <g...@gregweber.info> wrote:
> I don't think the current haskell hamlet implementation has the most
> natural defaults, but it is easy to explain what the rules are.
> For my other implementations [1] it defaults to adding new lines or a
> space and I rarely need to point out spacing to hamlet.
> On Wed, Jun 13, 2012 at 9:46 AM, Bulat Ziganshin
> <bulat.zigans...@gmail.com> wrote:
>> Hello yesodweb,
>> i'd rather easily converted my html files to hamlet format. the most
>> problematic thing both for conversion and probably further
>> maintenance was the handling of multiline contols - i mean than
>> something like
>> <p>text
>> text</p>
>> should be converted to
>> <p>text #
>> text
>> probably it was very motivated decision, but afair most html
>> templating systems i've learned don't require #'s, and for conversion
>> of typical, already structured html file it's the most time-consuming
>> and bug-prone part - the rest is just to remove all those </...> tags
>> and it's very fast and easy
>> so, the question is obvious - may be this decision need to be reversed?
>> --
>> Best regards,
>> Bulat mailto:Bulat.Zigans...@gmail.com
I'd prefer using backslashes, but it would be a PITA to upgrade all
templates by hand. Perhaps it would be sufficient to have a "transition
knob" which printed a warning every time Hamlet assumed a space where it
previously wouldn't (assuming that a tool to automagically upgrade would be
too expensive to build).
> There are two things I was trying to avoid in designing the current setup:
IMVHO, these rules looks like the good fit for quick&dirty proof-of-concept
implementation, but for long-running "production-grade" framework it has
the following disadvantages (repeating and extending myself):
- it's unexpected. at least, plain English, html and most templating
systems are doing opposite
- it makes (much?) harder to convert manually from html to hamlet.
automatic html2hamlet conversion tool generates unreadable hamlet
files, so i prefer to convert by hand. although now i think that it may
be solved by making smarter conversion tool
- it makes it harder to further maintain hamlet templates
so, i believe that it's the problem that's better to be solved earlier than
later, when hamlet will have larger userbase
> * A bunch of special case rules about when to add whitespace. I like
> the fact that we can explain things with one sentence: there's no
> extra whitespace added.
i think that the best thing is to copy existing rules either from html
or popular indent-based templating systems. whitespacing rules isn't
the field where users demand more diversity
> * It's possible to express anything. If whitespace is *always* added,
> it's impossible to use Hamlet tag syntax for, e.g. <i>Michael</i>'s
> car.
even without any special whitespacing rule, one can just explicitly close
the tag and continue text on the same line waiting till the next space
-- Best regards,
Bulat mailto:Bulat.Zigans...@gmail.com