Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/rstacruz/sparkup

A parser for a condensed HTML format
https://github.com/rstacruz/sparkup

Last synced: 25 days ago
JSON representation

A parser for a condensed HTML format

Lists

README

        

Sparkup
=======

**Sparkup lets you write HTML code faster.** Don't believe us?
[See it in action!](http://www.youtube.com/watch?v=Jw3jipcenKc)

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](http://www.youtube.com/watch?v=Jw3jipcenKc)

Usage and installation
----------------------
You may download Sparkup from GitHub. [Download the latest version here](http://github.com/rstacruz/sparkup/downloads).

- **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 `` whilst in **insert mode** to expand to HTML.
Pressing `` 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](http://code.google.com/p/zen-coding/) of
[Vadim Makeev](http://pepelsbey.net). 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:

```html


```

**`div#header`** expands to:

```html


```

**`div.align-left#header`** expands to:

```html


```

**`div#header + div#footer`** expands to:

```html



```

**`#menu > ul`** expands to:

```html




    ```

    **`#menu > h3 + ul`** expands to:

    ```html





      ```

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

      ```html


      Welcome to our site



      ```

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

      ```html
      Home
      ```

      **`ul > li*3`** expands to:

      ```html






      ```

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

      ```html






      ```

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

      ```html






      ```

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

      ```html














      ```

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

      ```html





      Footer



      ```