Pathogen and new bundles
git-svn-id: http://photonzero.com/dotfiles/trunk@65 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
9b767aed56
commit
96a93bce9e
78 changed files with 10717 additions and 0 deletions
14
.vim/bundle/sparkup/.gitignore
vendored
Normal file
14
.vim/bundle/sparkup/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
.DS_Store
|
||||
.project
|
||||
doc
|
||||
distribution/
|
||||
.sourcescribe_index
|
||||
*.swp
|
||||
*.swo
|
||||
*.pyc
|
||||
cscope.out
|
||||
*~
|
||||
|
||||
# Distribution files
|
||||
# */sparkup
|
||||
# */sparkup.py
|
||||
39
.vim/bundle/sparkup/Makefile
Normal file
39
.vim/bundle/sparkup/Makefile
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
SPARKUP_PY=sparkup
|
||||
VERSION=`date '+%Y%m%d'`
|
||||
README=README.md
|
||||
|
||||
.PHONY: all textmate vim textmate-dist vim-dist plugins plugins-pre generic all-dist
|
||||
all: plugins
|
||||
|
||||
plugins-pre:
|
||||
mkdir -p distribution
|
||||
|
||||
plugins: plugins-pre all-dist
|
||||
|
||||
textmate-dist: textmate
|
||||
cd TextMate && zip -9r ../distribution/sparkup-textmate-${VERSION}.zip . && cd ..
|
||||
|
||||
vim-dist: vim
|
||||
cd vim && zip -9r ../distribution/sparkup-vim-${VERSION}.zip . && cd ..
|
||||
|
||||
generic-dist: generic
|
||||
cd generic && zip -9r ../distribution/sparkup-generic-${VERSION}.zip . && cd ..
|
||||
|
||||
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
|
||||
|
||||
generic:
|
||||
cat sparkup.py > generic/sparkup
|
||||
chmod +x generic/sparkup
|
||||
#cp ${README} generic/sparkup-readme.txt
|
||||
|
||||
textmate:
|
||||
mkdir -p TextMate/Sparkup.tmbundle/Support
|
||||
cp ${SPARKUP_PY} TextMate/Sparkup.tmbundle/Support/sparkup.py
|
||||
#cp ${README} TextMate/sparkup-readme.txt
|
||||
|
||||
vim:
|
||||
mkdir -p vim/ftplugin/html
|
||||
cp ${SPARKUP_PY} vim/ftplugin/html/sparkup.py
|
||||
#cp ${README} vim/sparkup-readme.txt
|
||||
130
.vim/bundle/sparkup/README.md
Normal file
130
.vim/bundle/sparkup/README.md
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
Sparkup
|
||||
=======
|
||||
|
||||
**Sparkup lets you write HTML code faster.** Don't believe us?
|
||||
[See it in action!](http://www.youtube.com/watch?v=Jw3jipcenKc)
|
||||
|
||||
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 intregration 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 (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>
|
||||
|
||||
|
||||
1087
.vim/bundle/sparkup/ftplugin/html/sparkup.py
Executable file
1087
.vim/bundle/sparkup/ftplugin/html/sparkup.py
Executable file
File diff suppressed because it is too large
Load diff
74
.vim/bundle/sparkup/ftplugin/html/sparkup.vim
Normal file
74
.vim/bundle/sparkup/ftplugin/html/sparkup.vim
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
" Sparkup
|
||||
" Installation:
|
||||
" Copy the contents of vim/ftplugin/ to your ~/.vim/ftplugin directory.
|
||||
"
|
||||
" $ cp -R vim/ftplugin ~/.vim/ftplugin/
|
||||
"
|
||||
" Configuration:
|
||||
" g:sparkup (Default: 'sparkup') -
|
||||
" Location of the sparkup executable. You shouldn't need to change this
|
||||
" setting if you used the install option above.
|
||||
"
|
||||
" g:sparkupArgs (Default: '--no-last-newline') -
|
||||
" Additional args passed to sparkup.
|
||||
"
|
||||
" g:sparkupExecuteMapping (Default: '<c-e>') -
|
||||
" Mapping used to execute sparkup.
|
||||
"
|
||||
" g:sparkupNextMapping (Default: '<c-n>') -
|
||||
" Mapping used to jump to the next empty tag/attribute.
|
||||
|
||||
if !exists('g:sparkupExecuteMapping')
|
||||
let g:sparkupExecuteMapping = '<c-e>'
|
||||
endif
|
||||
|
||||
if !exists('g:sparkupNextMapping')
|
||||
let g:sparkupNextMapping = '<c-n>'
|
||||
endif
|
||||
|
||||
exec 'nmap <buffer> ' . g:sparkupExecuteMapping . ' :call <SID>Sparkup()<cr>'
|
||||
exec 'imap <buffer> ' . g:sparkupExecuteMapping . ' <c-g>u<Esc>:call <SID>Sparkup()<cr>'
|
||||
exec 'nmap <buffer> ' . g:sparkupNextMapping . ' :call <SID>SparkupNext()<cr>'
|
||||
exec 'imap <buffer> ' . g:sparkupNextMapping . ' <c-g>u<Esc>:call <SID>SparkupNext()<cr>'
|
||||
|
||||
if exists('*s:Sparkup')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:Sparkup()
|
||||
if !exists('s:sparkup')
|
||||
let s:sparkup = exists('g:sparkup') ? g:sparkup : 'sparkup'
|
||||
let s:sparkupArgs = exists('g:sparkupArgs') ? g:sparkupArgs : '--no-last-newline'
|
||||
" check the user's path first. if not found then search relative to
|
||||
" sparkup.vim in the runtimepath.
|
||||
if !executable(s:sparkup)
|
||||
let paths = substitute(escape(&runtimepath, ' '), '\(,\|$\)', '/**\1', 'g')
|
||||
let s:sparkup = findfile('sparkup.py', paths)
|
||||
|
||||
if !filereadable(s:sparkup)
|
||||
echohl WarningMsg
|
||||
echom 'Warning: could not find sparkup on your path or in your vim runtime path.'
|
||||
echohl None
|
||||
finish
|
||||
endif
|
||||
endif
|
||||
let s:sparkup = '"' . s:sparkup . '"'
|
||||
let s:sparkup .= printf(' %s --indent-spaces=%s', s:sparkupArgs, &shiftwidth)
|
||||
if has('win32') || has('win64')
|
||||
let s:sparkup = 'python ' . s:sparkup
|
||||
endif
|
||||
endif
|
||||
exec '.!' . s:sparkup
|
||||
call s:SparkupNext()
|
||||
endfunction
|
||||
|
||||
function! s:SparkupNext()
|
||||
" 1: empty tag, 2: empty attribute, 3: empty line
|
||||
let n = search('><\/\|\(""\)\|^\s*$', 'Wp')
|
||||
if n == 3
|
||||
startinsert!
|
||||
else
|
||||
execute 'normal l'
|
||||
startinsert
|
||||
endif
|
||||
endfunction
|
||||
22
.vim/bundle/sparkup/mit-license.txt
Normal file
22
.vim/bundle/sparkup/mit-license.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2009, Rico Sta. Cruz.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
1087
.vim/bundle/sparkup/sparkup
Executable file
1087
.vim/bundle/sparkup/sparkup
Executable file
File diff suppressed because it is too large
Load diff
138
.vim/bundle/sparkup/sparkup-unittest.py
Executable file
138
.vim/bundle/sparkup/sparkup-unittest.py
Executable file
|
|
@ -0,0 +1,138 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import sparkup
|
||||
|
||||
class SparkupTest:
|
||||
options = {
|
||||
'textmate': True,
|
||||
'no-last-newline': True,
|
||||
'post-tag-guides': True,
|
||||
}
|
||||
options = {
|
||||
'default': {'textmate': True, 'no-last-newline': True, 'post-tag-guides': True},
|
||||
'guides': {'textmate': True, 'no-last-newline': True, 'post-tag-guides': True, 'start-guide-format': 'Begin %s'}
|
||||
}
|
||||
cases = {
|
||||
'Simple test': {
|
||||
'options': 'default',
|
||||
'input': 'div',
|
||||
'output': '<div>$1</div>$0'
|
||||
},
|
||||
'Class test': {
|
||||
'input': 'div.lol',
|
||||
'output': '<div class="lol">$1</div><!-- /.lol -->$0'
|
||||
},
|
||||
'ID and class test': {
|
||||
'input': 'div.class#id',
|
||||
'output': '<div class="class" id="id">$1</div><!-- /#id -->$0'
|
||||
},
|
||||
'ID and class test 2': {
|
||||
'input': 'div#id.class',
|
||||
'output': '<div class="class" id="id">$1</div><!-- /#id -->$0'
|
||||
},
|
||||
'Attributes test': {
|
||||
'input': 'div#id.class[style=color:blue]',
|
||||
'output': '<div style="color:blue" class="class" id="id">$1</div><!-- /#id -->$0'
|
||||
},
|
||||
'Multiple attributes test': {
|
||||
'input': 'div[align=center][style=color:blue][rel=none]',
|
||||
'output': '<div align="center" style="color:blue" rel="none">$1</div>$0'
|
||||
},
|
||||
'Multiple class test': {
|
||||
'input': 'div.c1.c2.c3',
|
||||
'output': '<div class="c1 c2 c3">$1</div><!-- /.c1.c2.c3 -->$0'
|
||||
},
|
||||
'Shortcut test': {
|
||||
'input': 'input:button',
|
||||
'output': '<input type="button" class="button" value="$1" name="$2" />$0'
|
||||
},
|
||||
'Shortcut synonym test': {
|
||||
'input': 'button',
|
||||
'output': '<input type="button" class="button" value="$1" name="$2" />$0'
|
||||
},
|
||||
'Child test': {
|
||||
'input': 'div>ul>li',
|
||||
'output': "<div>\n <ul>\n <li>$1</li>\n </ul>\n</div>$0"
|
||||
},
|
||||
'Sibling test': {
|
||||
'input': 'div#x + ul+ h3.class',
|
||||
'output': '<div id="x">$1</div><!-- /#x -->\n<ul>$2</ul>\n<h3 class="class">$3</h3>$0'
|
||||
},
|
||||
'Child + sibling test': {
|
||||
'input': 'div > ul > li + span',
|
||||
'output': '<div>\n <ul>\n <li>$1</li>\n <span>$2</span>\n </ul>\n</div>$0'
|
||||
},
|
||||
'Multiplier test 1': {
|
||||
'input': 'ul > li*3',
|
||||
'output': '<ul>\n <li>$1</li>\n <li>$2</li>\n <li>$3</li>\n</ul>$0'
|
||||
},
|
||||
'Multiplier test 2': {
|
||||
'input': 'ul > li.item-$*3',
|
||||
'output': '<ul>\n <li class="item-1">$1</li>\n <li class="item-2">$2</li>\n <li class="item-3">$3</li>\n</ul>$0'
|
||||
},
|
||||
'Multiplier test 3': {
|
||||
'input': 'ul > li.item-$*3 > a',
|
||||
'output': '<ul>\n <li class="item-1">\n <a href="$1">$2</a>\n </li>\n <li class="item-2">\n <a href="$3">$4</a>\n </li>\n <li class="item-3">\n <a href="$5">$6</a>\n </li>\n</ul>$0'
|
||||
},
|
||||
'Ampersand test': {
|
||||
'input': 'td > tr.row-$*3 > td.cell-&*2',
|
||||
'output': '<td>\n <tr class="row-1">\n <td class="cell-1">$1</td>\n <td class="cell-2">$2</td>\n </tr>\n <tr class="row-2">\n <td class="cell-3">$3</td>\n <td class="cell-4">$4</td>\n </tr>\n <tr class="row-3">\n <td class="cell-5">$5</td>\n <td class="cell-6">$6</td>\n </tr>\n</td>$0'
|
||||
},
|
||||
'Menu test': {
|
||||
'input': 'ul#menu > li*3 > a > span',
|
||||
'output': '<ul id="menu">\n <li>\n <a href="$1">\n <span>$2</span>\n </a>\n </li>\n <li>\n <a href="$3">\n <span>$4</span>\n </a>\n </li>\n <li>\n <a href="$5">\n <span>$6</span>\n </a>\n </li>\n</ul>$0'
|
||||
},
|
||||
'Back test': {
|
||||
'input': 'ul#menu > li*3 > a < < div',
|
||||
'output': '<ul id="menu">\n <li>\n <a href="$1">$2</a>\n </li>\n <li>\n <a href="$3">$4</a>\n </li>\n <li>\n <a href="$5">$6</a>\n </li>\n</ul>\n<div>$7</div>$0'
|
||||
},
|
||||
'Expand test': {
|
||||
'input': 'p#menu > table+ + ul',
|
||||
'output': '<p id="menu">\n <table cellspacing="0">\n <tr>\n <td>$1</td>\n </tr>\n </table>\n <ul>$2</ul>\n</p>$0'
|
||||
},
|
||||
'Text with dot test': {
|
||||
'input': 'p { text.com }',
|
||||
'output': '<p> text.com </p>$0'
|
||||
},
|
||||
'Attribute with dot test': {
|
||||
'input': 'p [attrib=text.com]',
|
||||
'output': '<p attrib="text.com">$1</p>$0'
|
||||
},
|
||||
# Add: text test, broken test, multi-attribute tests, indentation test, start and end comments test
|
||||
}
|
||||
def run(self):
|
||||
"""Run Forrest run!"""
|
||||
|
||||
print "Test results:"
|
||||
for name, case in self.cases.iteritems():
|
||||
try: options_key = case['options']
|
||||
except: options_key = 'default'
|
||||
|
||||
try: options = self.options[options_key]
|
||||
except: options = self.options['default']
|
||||
|
||||
# Output buffer
|
||||
r = sparkup.Router()
|
||||
input = case['input']
|
||||
output = r.start(options=options, str=input, ret=True)
|
||||
del r
|
||||
|
||||
# Did it work?
|
||||
result = output == case['output']
|
||||
if result: result_str = " OK "
|
||||
else: result_str = "FAIL"
|
||||
|
||||
print " - %-30s [%s]" % (name, result_str)
|
||||
if not result:
|
||||
print "= %s" % input.replace("\n", "\n= ")
|
||||
print "Actual output (condensed):"
|
||||
print " | '%s'" % output.replace("\n", r"\n").replace('"', '\"')
|
||||
print "Actual output:"
|
||||
print " | %s" % output.replace("\n", "\n | ")
|
||||
print "Expected:"
|
||||
print " | %s" % case['output'].replace("\n", "\ n| ")
|
||||
|
||||
if __name__ == '__main__':
|
||||
s = SparkupTest()
|
||||
s.run()
|
||||
1
.vim/bundle/sparkup/sparkup.py
Symbolic link
1
.vim/bundle/sparkup/sparkup.py
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
sparkup
|
||||
23
.vim/bundle/sparkup/vim/README.txt
Normal file
23
.vim/bundle/sparkup/vim/README.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Installation
|
||||
------------
|
||||
|
||||
Copy the contents of vim/ftplugin/ to your ~/.vim/ftplugin directory.
|
||||
|
||||
(Assuming your current dir is sparkup/vim/)
|
||||
$ cp -R ftplugin ~/.vim/
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
g:sparkup (Default: 'sparkup') -
|
||||
Location of the sparkup executable. You shouldn't need to change this
|
||||
setting if you used the install option above.
|
||||
|
||||
g:sparkupArgs (Default: '--no-last-newline') -
|
||||
Additional args passed to sparkup.
|
||||
|
||||
g:sparkupExecuteMapping (Default: '<c-e>') -
|
||||
Mapping used to execute sparkup.
|
||||
|
||||
g:sparkupNextMapping (Default: '<c-n>') -
|
||||
Mapping used to jump to the next empty tag/attribute.
|
||||
Loading…
Add table
Add a link
Reference in a new issue