Zen Coding and script languages tags (PHP, JSP, Ruby): <% %> <? ?> etc.

218 views
Skip to first unread message

mare

unread,
May 10, 2011, 4:21:58 AM5/10/11
to Zen Coding
Hello,

I know it's beyond HTML and CSS but it would be nice if ZC supported
some simple script languages tags, like:
<? ?>
<?= ?>
<% %>
<%= %>

I think this simple feature would be a great help for PHP, JSP and
Ruby programmers.
Of course it can't easly go with all the ZC functionalities, but for
now, just resolving abbreviations (and wrapping with abbreviation)
would be nice. The '?', '=' and '%' characters have no special meaning
in ZC yet, as far as I know.

What do you think?

Good luck Zen Coding!


Sergey Chikuyonok

unread,
May 10, 2011, 4:32:45 AM5/10/11
to zen-c...@googlegroups.com
You can always add custom snippets. Read SM tutorial about how to do this: http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/

___________________________________________
Сергей Чикуёнок
http://chikuyonok.ru
serg...@gmail.com

mare

unread,
May 10, 2011, 5:17:16 AM5/10/11
to Zen Coding
Thank you,

it's rather here:
http://andrewblogs.com/blog/zen-coding-php-zen-coding-custom-snippet-example/


On 10 Maj, 10:32, Sergey Chikuyonok <serge....@gmail.com> wrote:
> You can always add custom snippets. Read SM tutorial about how to do this:http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-wr...
>
> ___________________________________________
> Сергей Чикуёнокhttp://chikuyonok.ru
> serge....@gmail.com

mare

unread,
May 10, 2011, 6:40:36 AM5/10/11
to Zen Coding
Hello again,

I added some custom snippets to the zencoding.js, and:

'!' : '<!-- | -->', // this one works fine

// and none of these do:
'?' : '<? | ?>',
'%' : '<% | %>',
'?=' : '<?=|?>',
'%=' : '<%=|%>'

Should I put it in defferent key then 'html'?




On 10 Maj, 11:17, mare <mmaar...@gmail.com> wrote:
> Thank you,
>
> it's rather here:http://andrewblogs.com/blog/zen-coding-php-zen-coding-custom-snippet-...

Sergey Chikuyonok

unread,
May 10, 2011, 7:25:18 AM5/10/11
to zen-c...@googlegroups.com
'?' and '%' are illegal characters for snippet names

___________________________________________
Сергей Чикуёнок
http://chikuyonok.ru
serg...@gmail.com

mare

unread,
May 10, 2011, 8:39:19 AM5/10/11
to Zen Coding
Is it possible to allow them, though?



On 10 Maj, 13:25, Sergey Chikuyonok <serge....@gmail.com> wrote:
> '?' and '%' are illegal characters for snippet names
>
> ___________________________________________

Sergey Chikuyonok

unread,
May 10, 2011, 8:40:40 AM5/10/11
to zen-c...@googlegroups.com
Only if you create your own fork.
Otherwise it will break backward compatibility

___________________________________________
Сергей Чикуёнок
http://chikuyonok.ru
serg...@gmail.com

mare

unread,
May 10, 2011, 2:50:10 PM5/10/11
to Zen Coding
Sergey, could you suggest, what changes should be done to accomplish
this? You know the code better ;)
I made a blind try to modify some regexps adding \? and \%, but with
no success.



On 10 Maj, 14:40, Sergey Chikuyonok <serge....@gmail.com> wrote:
> Only if you create your own fork.
> Otherwise it will break backward compatibility
>
> ___________________________________________

Dérico Filho

unread,
May 10, 2011, 10:22:57 PM5/10/11
to Zen Coding
I created an all-purpose zen-coding engine for UltraEdit and Notepad+
+, the last version can encapsulate reserved characters within curly
brackets (usually to escape other zen-coding special chars). In this
version you can do,

?>f#test[$a,$b]
<?php
function test($a,$b){

}
?>

with no special effort.

https://github.com/dericofilho/Zen-Coding-for-PHP---UltraEdit

mare

unread,
May 11, 2011, 4:02:17 AM5/11/11
to Zen Coding
Great!

I'm looking forward for the Komodo Edit plugin

Sergey Chikuyonok

unread,
May 11, 2011, 4:09:13 AM5/11/11
to zen-c...@googlegroups.com
mare, basically, you need to add your characters in isAllowedChar() method:
https://github.com/sergeche/zen-coding/blob/master/javascript/zen_coding.js#L60

...and modify validator regexp:
https://github.com/sergeche/zen-coding/blob/master/javascript/zen_parser.js#L11

___________________________________________
Сергей Чикуёнок
http://chikuyonok.ru
serg...@gmail.com

mare

unread,
May 11, 2011, 5:19:32 AM5/11/11
to Zen Coding
Thank you Sergey!

Now I have all the above snippets working and the way for creating
others opened


On 11 Maj, 10:09, Sergey Chikuyonok <serge....@gmail.com> wrote:
> mare, basically, you need to add your characters in isAllowedChar() method:https://github.com/sergeche/zen-coding/blob/master/javascript/zen_cod...
>
> ...and modify validator regexp:https://github.com/sergeche/zen-coding/blob/master/javascript/zen_par...

Derek Turner

unread,
May 10, 2011, 8:56:39 AM5/10/11
to zen-c...@googlegroups.com
On 10/05/11 11:40, mare wrote:
> Hello again,
>
> I added some custom snippets to the zencoding.js, and:
>
> '!' : '<!-- | -->', // this one works fine
>
> // and none of these do:
> '?' : '<? | ?>',
> '%' : '<% | %>',
> '?=' : '<?=|?>',
> '%=' : '<%=|%>'

try

'qm' : '<? | ?>',
'pc' : '<% | %>',
'qme' : '<?=|?>',
'pce' : '<%=|%>'

Reply all
Reply to author
Forward
0 new messages