The time now is Thu 23 May 2013, 22:18
All times are UTC - 4 |
| Author |
Message |
GustavoYz

Joined: 07 Jul 2010 Posts: 867 Location: .ar
|
Posted: Fri 27 Jan 2012, 06:49 Post subject:
HOWTO Zencoding(Sparkup) in Geany Subject description: Powerful macro HTML system. |
|
If you use Geany to write HTML/CSS code, you should heard already of ZenCoding.
Zencoding is like a macro system, with his own sintax, to write repetitve parts of web languages without the pain.
For example, "html:xs" give this XHTML 1.0 header and skeleton as result:
| Code: | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title></title>
</head>
<body>
</body>
</html>
|
A nice fork of this project called 'sparkup' is waiting on github; we will use that one because its just a script, really easy to handle. [Vim workaround is straightforward, so i'll ignore that part].
This will show more of the time saving part, this time just used as a cli tool:
| Code: | echo 'ul > li.item-$*5' | ./sparkup
<ul>
<li class="item-1"></li>
<li class="item-2"></li>
<li class="item-3"></li>
<li class="item-4"></li>
<li class="item-5"></li>
</ul> |
NOTE: There is a 'new' Geany plugin for Zen coding, as I've found it very buggy, I made this workaround which works well. Check the official site for the Geany plugin and also, if you plan to use it, grab the cool pdf chatsheet from there (all in the very first link on this post).
To make it work in Geany, I just set-up a custom command that send selected text trough sparkup and replace it by the result (CTRL+Z if something went wrong).
1-Just in case, I made a pet only with the python script which will be instaled in ~/my-applications/bin. Install it, or grab all from github and place the main sparkup.py script somewhere into your path.
2-In Geany, go to 'Edit->Format->Send Selection to' (I have it in Spanish, not sure if its exactly like that) and you'll see '1:, 2: , etc". Add this to a free number:
| Code: | | sparkup 2> /dev/null |
3-Now try it up, write some sparkup valid code -like previous examples-, select it and press CTRL+1 (actually, CRTL+x, where 'x' is the new command that you've just settled in numerical order in previous step).
*Same applies to other tools, like the magnificent perl tidy.
Hope you enjoy it as I do.
Regards.
| Description |
Only the script.
|

Download |
| Filename |
sparkup-0.1.3_cli.pet |
| Filesize |
8.31 KB |
| Downloaded |
104 Time(s) |
_________________

|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|