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 Sun 21 Dec 2014, 12:01
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 Posts_count_1  
Author Message
GustavoYz


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

PostPosted: Fri 27 Jan 2012, 06:49    Post_subject:  HOWTO Zencoding(Sparkup) in Geany
Sub_title: 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.
sparkup-0.1.3_cli.pet
Description  Only the script.
pet

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

_________________

Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count_1  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0432s ][ Queries: 12 (0.0035s) ][ GZIP on ]