Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 18 Sep 2018, 19:27
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
HOWTO Zencoding(Sparkup) in Geany
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message

Joined: 07 Jul 2010
Posts: 894
Location: .ar

PostPosted: 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:
<!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">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

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:
echo 'ul > li.item-$*5' | ./sparkup
    <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>

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:
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.
Description  Only the script.

Filename  sparkup-0.1.3_cli.pet 
Filesize  8.31 KB 
Downloaded  221 Time(s) 


Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

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
[ Time: 0.0301s ][ Queries: 12 (0.0040s) ][ GZIP on ]