dskinner / damsel-python

Markup Language featuring html outlining via css-selectors, embedded python, and extensibility.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: HAML Style Comments

opened this issue · comments

Make the first non-whitespace character '/' at the beginning of a line indicate that the line is a comment.

At first glance, I think this would be better suited as a dmsl filter.

Referencing, http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#html_comments_

An html comment filter would just use " :cm " instead of " / " (where 'cm' is whatever you want to call it, ideally something short and simple to remember).

I may need to evaluate where filters fire in the processing of the document to test feasibility.

But to address this specific request, I wont introduce anymore arbitrary characters for document control. I'll open a separate feature request for a builtin filter (like the current js and css filters) for supporting html comments.

I disagree. A single character comment key is a must have for me, and I think for many other devs. :cm or even :c is too verbose for a templating language that aims at being concise. What you are creating here is a domain specific language. Filters should be left for things like django's template tags. Single character invoked single line comments should be core to dmsl.

Well it wouldn't be the first time I changed my mind on something. Originally I said inlining tags and python code wouldn't be supported but fact is, it makes things easier to read and write in a lot of circumstances.

If we're talking about html block comments, then this will still probably end up as a filter.

If we're talking about ignore-this-line, this is still sadly missing but trivial to implement in _pre.py

Block comments are supported as in python with triple quotes, but I think it's limited to using single quotes at the moment (something else that needs to be addressed). And a hash for commenting conflicts with an id-only tag at the start of a line.

Either way this needs some thought put into it and I'd prefer make it as pythonic as possible to keep it easy to remember for those already experienced with python.

I'm not an experienced ruby/haml developer, so I dont know how haml derived alot of its control flow, but just looking at different styles of comments, I could only hope a ruby developer would look at that and think, "ok that makes perfect sense", b/c from what I see, it looks like a mess.

before I forget, investigate use of a new directive for html comments and conditionals using an exclamation. This appeals to someone already understanding html and should make it simple to remember

The following would comment out the entire block, or optionally a single line of no children.

! %ul
    %li One
    %li Two

The following would create conditional headers and footers

![if IE 6] %p Only for IE 6

The directive would be first class and could exist on a line by itself and contain children.

The other possibility I'd consider is a hypen. Consider readability and how such could be improved with proper syntax highlighting.