Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0 2 #126

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

V0 2 #126

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
73dcd33
Switched to optparse
Dec 6, 2009
acceb37
Fixed two errors caught by PyLint
Dec 6, 2009
50f82fa
Removed redundant `dest`s.
Dec 6, 2009
2cf02ee
Removed redundant statement
Dec 6, 2009
ac1b128
Fixed missed option. Removed unnecessary try-catch.
Dec 6, 2009
5ffcdad
Removed unnecessary try-except.
Dec 6, 2009
ddca1a0
Fixed to match the original --help output.
Dec 7, 2009
f19b2f0
Merge branch 'master' of git://github.com/rstacruz/sparkup
Dec 8, 2009
3ba97a5
Merge branch 'master' into optparse
Dec 8, 2009
43338a0
Globals should be all-upercase.
Dec 8, 2009
e029eb9
No line should be longer than 79 characters. Fixed most of the comments.
Dec 8, 2009
8b6c08d
Unneeded backslashes
Dec 8, 2009
9295a07
Unused imports
Dec 8, 2009
3426472
Unused variables.
Dec 8, 2009
1a6c79c
Renamed `str` as `string` to avoid keyword clash.
Dec 8, 2009
0acef70
Cleaned up spaces at the end of lines.
Dec 9, 2009
6d85b72
Removed unnecesary `pass`es. Simplified some regexes.
Dec 9, 2009
4245cef
All regexes should use raw strings.
Dec 9, 2009
5167ea3
Unnecessary variable. Unnecesary return.
Dec 9, 2009
a979994
Added AUTHORS file
rstacruz Dec 29, 2009
b6951ac
Merge git://github.com/Tordek/sparkup into v0.2
rstacruz Dec 29, 2009
2992c10
New directory structure and Makefile
rstacruz Dec 29, 2009
2b7817c
Makefile: made the final zip file clutter-free (no DS_Store's lying a…
rstacruz Dec 29, 2009
07e1dec
Revised unit test to account for the new directory structure
rstacruz Dec 29, 2009
64f506e
Version bump to 0.1.99
rstacruz Dec 29, 2009
f85c33d
Version bump to 0.1.99+ in preparation for 0.2
rstacruz Dec 29, 2009
e23784f
Added stub documentation (to be expounded on soon)
rstacruz Dec 29, 2009
383504e
Broke off chunks of README.md into docs/
rstacruz Dec 29, 2009
b2db4af
Changed vim install instructions; also added install helper script
rstacruz Jan 22, 2010
802f461
Added option to disable end-guide-newline; removed "parse error" mess…
rstacruz Jan 22, 2010
1ad1daa
Started SourceScribe-powered documentation effort
rstacruz Jan 22, 2010
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
.DS_Store
.project
doc
distribution/
docs
sparkup-*/
*.zip
.sourcescribe_index
*.swp
*.swo
*.pyc
cscope.out
*~

# Distribution files
# */sparkup
# */sparkup.py
16 changes: 16 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
v0.2
- New directory structure for the source tree

v0.1.3
- ..
98 changes: 69 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,79 @@
SPARKUP_PY=sparkup
VERSION=`date '+%Y%m%d'`
README=README.md
# Sparkup makefile
# ================

.PHONY: all textmate vim textmate-dist vim-dist plugins plugins-pre generic all-dist
all: plugins
# Account for incremental version numbers (e.g., 0.3.5-20091229)
VERSION = $(subst {date},${shell date +%Y%m%d},$(shell cat VERSION))
ROOT := $(PWD)

plugins-pre:
mkdir -p distribution
# Paths
PLUGINS_PATH = plugins
DOC_PATH = docs
DISTRIB_PATH = sparkup-${VERSION}
DISTRIB_PLUGINS = ${DISTRIB_PATH}/textmate ${DISTRIB_PATH}/vim ${DISTRIB_PATH}/generic ${DISTRIB_PATH}/docs
DISTRIB_FILES = ${DISTRIB_PLUGINS} ${DISTRIB_PATH}/readme.txt

plugins: plugins-pre all-dist
# Files
README = README.md
SPARKUP_PY = ${DISTRIB_PATH}/sparkup.py
FINAL_ZIP = sparkup-${VERSION}.zip

textmate-dist: textmate
cd TextMate && zip -9r ../distribution/sparkup-textmate-${VERSION}.zip . && cd ..
.PHONY: all distrib ${DISTRIB_PATH} ${DISTRIB_PLUGINS} distrib_cleanup ${SPARKUP_PY} ${DOC_PATH}
all: ${FINAL_ZIP}
@echo ------
@echo
@echo Done!
@echo
@echo . - ${FINAL_ZIP}
@echo . This is the redistributable ZIP file.
@echo .
@echo . - ${DISTRIB_PATH}/
@echo . The plugins are here, ready-to-use.

vim-dist: vim
cd vim && zip -9r ../distribution/sparkup-vim-${VERSION}.zip . && cd ..
# Final .zip
${FINAL_ZIP}: distrib
cd ${DISTRIB_PATH} && zip -9r "${ROOT}/$@" ${DISTRIB_FILES:${DISTRIB_PATH}/%=%} \
--exclude */.DS_Store --exclude */Thumbs.db --exclude */*.pyc

generic-dist: generic
cd generic && zip -9r ../distribution/sparkup-generic-${VERSION}.zip . && cd ..
# Distribution path
distrib: ${DISTRIB_PATH} ${DISTRIB_FILES} distrib_cleanup

all-dist:
zip -9r distribution/sparkup-${VERSION}.zip generic vim textmate README.md -x */sparkup-readme.txt
cp distribution/sparkup-${VERSION}.zip distribution/sparkup-latest.zip
distrib_cleanup:
rm ${SPARKUP_PY}

generic:
cat sparkup.py > generic/sparkup
chmod +x generic/sparkup
#cp ${README} generic/sparkup-readme.txt
${DISTRIB_PATH}:
mkdir -p "$@"

textmate:
mkdir -p TextMate/Sparkup.tmbundle/Support
cp ${SPARKUP_PY} TextMate/Sparkup.tmbundle/Support/sparkup.py
#cp ${README} TextMate/sparkup-readme.txt
${DISTRIB_PATH}/readme.txt: ${README}
cp ${README} "$@"

${DISTRIB_PATH}/textmate: ${SPARKUP_PY}
mkdir -p "$@"
cp -R "${PLUGINS_PATH}/textmate" "${DISTRIB_PATH}"
mkdir -p "$@/Sparkup.tmbundle"
mkdir -p "$@/Sparkup.tmbundle/Support"
cp ${SPARKUP_PY} \
"$@/Sparkup.tmbundle/Support/sparkup.py"

${DISTRIB_PATH}/vim: ${SPARKUP_PY}
mkdir -p "$@"
cp -R "${PLUGINS_PATH}/vim" "${DISTRIB_PATH}"
mkdir -p "$@/ftplugin/html"
cp ${SPARKUP_PY} "$@/ftplugin/html/sparkup.py"

${DISTRIB_PATH}/generic: ${SPARKUP_PY}
mkdir -p "$@"
cp -R "${PLUGINS_PATH}/generic" "${DISTRIB_PATH}"
cat ${SPARKUP_PY} > "$@/sparkup"
chmod +x "$@/sparkup"

${DISTRIB_PATH}/docs: ${DOC_PATH}
rm -f "$@"
cp -R ${DOC_PATH} "$@"

${DOC_PATH}:
ss

# Sources
${SPARKUP_PY}:
cat "src/sparkup/sparkup.py" | sed 's/^VERSION.*$$/VERSION = "${VERSION}"/' > $@

vim:
mkdir -p vim/ftplugin/html
cp ${SPARKUP_PY} vim/ftplugin/html/sparkup.py
#cp ${README} vim/sparkup-readme.txt
119 changes: 9 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,116 +15,15 @@ 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).
Build instructions
------------------

- **TextMate**: Simply double-click on the `Sparkup.tmbundle` package in Finder. This
will install it automatically. In TextMate, open an HTML file (orset 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 details.

- **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:
<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>
The files in the source tree are not useable straight away: you need to build the plugins
first. Simple type `make` (assuming you have GNU make installed) in the project's root.

What it will do:

- Create a directory called `sparkup-<version>/`
- Put the packaged, ready-to-use plugins there
- Inject the version number (from the file `VERSION`) to the copies of sparkup.py in that directory
- Create a redistributable ZIP file (`sparkup-<version>.zip`)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.1.99-{date}
Loading