Browse Source

Add Rakefile, eruby and html updates

- Rakefile eases installation and updates
  - eruby: refactor link_to and nav elements
  - html: refactor repeating <li> elements and nav menu <ul>
    Include html5 snippets: header, section, aside, and nav
  - Also setup html5shiv for misbehaving browsers
master
jimi 14 years ago
parent
commit
45b30538f7
  1. 22
      Rakefile
  2. 8
      ftplugin/eruby/eruby.xpt.vim
  3. 48
      ftplugin/html/html.xpt.vim

22
Rakefile

@ -0,0 +1,22 @@
HOME = ENV['HOME']
DEST = "#{HOME}/.vim/personal"
SRC = "ftplugin"
directory DEST
task :default => :install
desc "Hardlink snippets into the ~/.vim/personal directory"
task :install => DEST do
run "cp -avl #{SRC} #{DEST}/"
end
desc "Remove obsolete from and copy new snippets to ~/.vim/personal"
task :sync => :install do
run "rsync -ri --delete #{SRC} #{DEST}/"
end
def run(cmd)
puts cmd
system cmd
end

8
ftplugin/eruby/eruby.xpt.vim

@ -49,7 +49,13 @@ XSET target=Echo('')
<%= link_to `link^, `target^ %> <%= link_to `link^, `target^ %>
XPT link_to_img synonym=ltim " <%= link_to image... XPT link_to_img synonym=ltim " <%= link_to image...
`:link_to({'link' : ':it:'}):^
`:link_to({ 'link' : ':it:' }):^
XPT lta
`:li({ 'content' : ':link_to:' }):^
XPT enav synonym=nave,nav5
`:nav({ ':lia:' : ':lta:' }):^
XPT form_for synonym=ff " <% form_for @model do... XPT form_for synonym=ff " <% form_for @model do...
<% form_for `@obj^ do |`f^| -%> <% form_for `@obj^ do |`f^| -%>

48
ftplugin/html/html.xpt.vim

@ -4,7 +4,6 @@ XPTemplate priority=personal
let s:f = g:XPTfuncs() let s:f = g:XPTfuncs()
XPTvar $blank ' '
XPTvar $js_dir 'javascripts' XPTvar $js_dir 'javascripts'
XPTvar $css_dir 'stylesheets' XPTvar $css_dir 'stylesheets'
XPTvar $jq_ver '1.4.2.min' XPTvar $jq_ver '1.4.2.min'
@ -32,7 +31,7 @@ XPT doctype " <!DOCTYPE...
<!DOCTYPE html` `PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html` `PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"^> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"^>
XPT doctype5 " <!DOCTYPE html>
XPT doctype5 synonym=doc5 " <!DOCTYPE html>
<!DOCTYPE html> <!DOCTYPE html>
XPT charset " <meta charset... XPT charset " <meta charset...
@ -106,25 +105,30 @@ XSET val|post=Echo(V()=~'\V\^ id=""\$\|val' ? '' : V())
</div> </div>
<!--`val^ --> <!--`val^ -->
XPT ul abbr alias=_tagAttr " <ul att?...
XPT blockTag wrap=content hidden " <$_xSnipName >\n .. \n</$_xSnipName>
<`$_xSnipName^` `att?^>
`content^^
</`$_xSnipName^>
XPT ol abbr alias=_tagAttr " <ol att?...
XPT ul abbr alias=blockTag
XPT ol abbr alias=blockTag
XPT li abbr " <li>..</li>... XPT li abbr " <li>..</li>...
XSET content=Echo('') XSET content=Echo('')
<li>`content^</li>
<li>`content^</li>`
`...^
<li>`content^</li>`
`...^
XPT lia abbr " <li><a href=... XPT lia abbr " <li><a href=...
XSET href=# XSET href=#
`:li( { 'content' : ':a:' } ):^ `:li( { 'content' : ':a:' } ):^
XPT nav synonym=menu " <ul id='nav'...
XSET nav=$_xSnipName
<ul` id="`nav`"^>
`:lia:^`
`...^
`:lia:^`
`...^
XPT menu synonym=navigation " <ul id='menu'...
XSET id=$_xSnipName
<ul` id="`id`"^>
`:lia:^
</ul> </ul>
XPT a wrap=content " <a href... XPT a wrap=content " <a href...
@ -143,3 +147,23 @@ XSET content=Echo('')
<!--[if lt IE 9]> <!--[if lt IE 9]>
`content^ `content^
<![endif]--> <![endif]-->
"
" HTML5 Snippets
"
XPT header alias=blockTag
XPT section alias=blockTag
XPT aside alias=blockTag
XPT nav " <nav class="...
<nav` `att?^>
<ul>
`:lia:^
</ul>
</nav>
XPT html5shiv synonym=shiv,5shiv
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>