Closed GoogleCodeExporter closed 8 years ago
I would like this feature too. Here is my patch that adds this functionality.
For
example:
a[href=/]
becomes: <a href="/"></a>
img.image[src=img.gif][alt="This is the \"alternative text\""]#test
becomes: <img src="img.gif" alt="This is the "alternative text""
class="image" id="test" />
li.menu[class=active]
becomes: <li class="menu active"></li>
Note that with this patch it is also possible to use ID after classes, for
example,
div.content#content will expand properly.
Original comment by org.yi.d...@gmail.com
on 3 Dec 2009 at 2:43
Attachments:
Zen Coding isn't meant to be exhaustive for the CSS syntax. From the examples
given
it would take less key strokes to use Zen Coding in the manner it was meant. For
instance, the link example given above, if you simply use "a" as the
abbreviation and
then expand it, you'll have the anchor tag and your text cursor will be in the
href
attribute (I think TextMate supports that) where you can type "/" and be done.
That's
about 3 key strokes (a, cmd+e, /) compared to the 9 your example takes before
even
doing the expansion. Does that make sense? Your suggested way simply takes
longer.
Original comment by angelw...@gmail.com
on 21 Dec 2009 at 9:56
Yes, but some people prefer to use attribute syntax and sometimes this syntax is
faster. Take this example.
ul>li*5>a[href=#][title=]
This way you don't have to manually change the 5 href attributes by yourself
(except
your text editor has block editing or something like that). I can also start
entering
titles for my links right away without having to type the attribute names
manually.
Original comment by org.yi.d...@gmail.com
on 22 Dec 2009 at 11:02
Well you can always add the title attribute via the settings file so it's there
for
certain link abbreviations, whether you add it to the "a" abbreviation or add a
new
one "a:t." I've added a few new snippets for common code I use. I still don't
see
them taking on this syntax form either. If they were to, I believe it would
look more
like,
ul>li*5>a@href=#@title
or perhaps a query string syntax,
ul>li*5>a?href=#&title
Original comment by angelw...@gmail.com
on 22 Dec 2009 at 12:47
Yeah, I know that, but I think that it's more convenient to implement attribute
support than editing settings file manually.
Any style of syntax will do but I still prefer the CSS style so that it is the
same
when you write CSS code and abbreviation.
And if I have to choose between the two examples you gave, I would prefer the
first
one because ? and & are usually found in URLs.
Original comment by org.yi.d...@gmail.com
on 22 Dec 2009 at 1:40
Original comment by serge....@gmail.com
on 9 Feb 2010 at 10:21
Original issue reported on code.google.com by
j...@jaikdean.com
on 24 Nov 2009 at 2:50