sparkup

A parser for a condensed HTML format

  • 所有者: rstacruz/sparkup
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Sparkup

Sparkup lets you write HTML code faster. Don't believe us?
See it in action!

Fixed by Zhao:
This is a fork of original version. This version support both python 2 and 3.

You can write HTML in a CSS-like syntax, and have Sparkup handle the expansion to full HTML
code. It is meant to help you write long HTML blocks in your text editor by letting you
type less characters than needed.

Sparkup is written in Python, and requires Python 2.5 or newer (2.5 is preinstalled in
Mac OS X Leopard). Sparkup also offers integration into common text editors. Support for VIM
and TextMate are currently included.

A short screencast is available here:
http://www.youtube.com/watch?v=Jw3jipcenKc

Usage and installation

You may download Sparkup from GitHub. Download the latest version here.

  • TextMate: Simply double-click on the Sparkup.tmbundle package in Finder. This
    will install it automatically. In TextMate, open an HTML file (or set the document type to
    HTML) type in something (e.g., #header > h1), then press Ctrl + E. Pressing Tab
    will cycle through empty elements.

  • VIM: See the vim/README.txt file for installation. In VIM,
    create or open an HTML file (or set the filetype to html), type in something (e.g.
    #header > h1), then press <C-E> whilst in insert mode to expand to HTML.
    Pressing <C-n> will cycle through empty elements. Variables specified in
    vim/README.txt can be used to customise key mappings, and to add normal mode mappings
    as well.

  • Others/command line use: You may put sparkup in your $PATH somewhere. You may then
    invoke it by typing echo "(input here)", sparkup, or sparkup --help for a list of commands.

Credits

Sparkup is written by Rico Sta. Cruz and is released under the MIT license.

This project is inspired by Zen Coding of
Vadim Makeev. The Zen HTML syntax is forward-compatible with Sparkup
(anything that Zen HTML can parse, Sparkup can too).

The following people have contributed code to the project:

  • Guillermo O. Freschi (Tordek @ GitHub)
    Bugfixes to the parsing system

  • Eric Van Dewoestine (ervandew @ GitHub)
    Improvements to the VIM plugin

Examples

div expands to:

<div></div>

div#header expands to:

    <div id="header"></div>

div.align-left#header expands to:

    <div id="header" class="align-left"></div>

div#header + div#footer expands to:

    <div id="header"></div>
    <div id="footer"></div>

#menu > ul expands to:

    <div id="menu">
        <ul></ul>
    </div>

#menu > h3 + ul expands to:

    <div id="menu">
        <h3></h3>
        <ul></ul>
    </div>

#header > h1{Welcome to our site} expands to:

    <div id="header">
        <h1>Welcome to our site</h1>
    </div>

a[href=index.html]{Home} expands to:

    <a href="index.html">Home</a>

ul > li*3 expands to:

    <ul>
        <li></li>
        <li></li>
        <li></li>
    </ul>

ul > li.item-$*3 expands to:

    <ul>
        <li class="item-1"></li>
        <li class="item-2"></li>
        <li class="item-3"></li>
    </ul>

ul > li.item-$*3 > strong expands to:

    <ul>
        <li class="item-1"><strong></strong></li>
        <li class="item-2"><strong></strong></li>
        <li class="item-3"><strong></strong></li>
    </ul>

table > tr*2 > td.name + td*3 expands to:

    <table>
        <tr>
            <td class="name"></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td class="name"></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </table>

#header > ul > li < p{Footer} expands to:

    <!-- The < symbol goes back up the parent; i.e., the opposite of >. -->
    <div id="header">
        <ul>
            <li></li>
        </ul>
        <p>Footer</p>
    </div>

主要指標

概覽
名稱與所有者rstacruz/sparkup
主編程語言Python
編程語言Makefile (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2009-10-13 10:20:28
推送於2024-07-26 14:13:39
最后一次提交2016-01-25 14:16:14
發布數0
用户参与
星數1.6k
關注者數37
派生數145
提交數154
已啟用問題?
問題數75
打開的問題數24
拉請求數38
打開的拉請求數10
關閉的拉請求數20
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?