--[[
Mitchell's html/snippets.lua
Copyright (c) 2006-2008 Mitchell Foral. All rights reserved.
SciTE-tools homepage: http://caladbolg.net/scite.php
Send email to: mitchellcaladbolgnet
Permission to use, copy, modify, and distribute this file
is granted, provided credit is given to Mitchell.
]]--
---
-- Snippets for the html module
module('modules.html.snippets', package.seeall)
local snippets = _G.snippets[SCLEX_HTML]
_G.snippets[SCLEX_HTML] = {
t = '<${1:p}>${0}${1/^\\s*(\\S+)\\s*/$1/}>',
d = '${0}
',
dc = '${0}
',
ds = '${0}
',
p = '${0}
',
pc = '${0}
',
ps = '${0}
',
s = '${0} ',
sc = '${0} ',
ss = '${0} ',
a = '${0} ',
an = '${0} ',
img = ' ',
nb = ' ',
f = '',
res = ' ',
sub = ' ',
che = ' ',
file = ' ',
hid = ' ',
pas = ' ',
rad = ' ',
tex = ' ',
['in'] = ' ',
lab = '${2:Label Text} ',
optg = '\n ${0}\n ',
opt = '${0} ',
sel = '\n ${0}\n ',
texa = '',
fs = '\n ${1:} \n ${0}\n ',
base = ' ',
lin = ' ',
met = ' ',
strict = "\n\n",
html =
[[
${1:}
${2:title}
${0}
]]
}
-- rails snippets
if props['FileExt'] == 'rhtml' then
snippets.r = "<% ${0} %>"
snippets.re = "<%= ${0} %>"
snippets.is = "=> "
snippets.mac = "add_column '${1:table}', '${2:column}', :${3:string}"
snippets.mcc = "t.column '${1:title}', :${2:string}"
snippets.mct = "create_table '${1:table}' do |t|\n ${0}\nend"
snippets.mdt = "drop_table '${1:table}'"
snippets.mrc = "remove_column '${1:table}', '${2:column}'"
snippets.rdb = "RAILS_DEFAULT_LOGGER.debuf \"${1:message}\""
snippets.bt = "belongs_to :${1:object}${2:, :class_name => '${3:ClassName}', :foreign_key => '${4:${1}_id}'}"
snippets.hbm = "has_and_belongs_to_many :${1:object}${2:, :join_table => '${3:table_name}', :foreign_key => '${4:${1}_id}'}"
snippets.hm = "has_many :${1:object}${2:, :class_name => '${3:ClassName}', :foreign_key => '${4:${1}_id}'}"
snippets.ho = "has_one :${1:object}${2:, :class_name => '${3:ClassName}', :foreign_key => '${4:${1}_id}'}"
snippets.lia = "<%= link_to '${1:link text...}', :action => '${2:index}' %>"
snippets.liai = "<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %>"
snippets.lic = "<%= link_to '${1:link text...}', :controller => '${2:items}' %>"
snippets.lica = "<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %>"
snippets.licai = "<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %>"
snippets.ldb = "logger.debug \"${1:message}\""
snippets.fla = "flash[:${1:notice}] = \"${2:Successfully created...}\""
snippets.logi = "logger.info \"${1:Current value is...}\""
snippets.par = "params[:${1:id}]"
snippets.ses = "session[:${1:user}]"
snippets.rcea = "render_component :action => '${1:index}'"
snippets.rcec = "render_component :controller => '${1:items}'"
snippets.rceca = "render_component :controller => '${1:items}', :action => '${2:index}'"
snippets.rea = "redirect_to :action => '${1:index}'"
snippets.reai = "redirect_to :action => '${1:show}', :id => ${2:@item}"
snippets.rec = "redirect_to :controller => '${1:items}'"
snippets.reca = "redirect_to :controller => '${1:items}', :action => '${2:list}'"
snippets.recai = "redirect_to :controller => '${1:items}', :action => '${2:show}', :id => ${3:@item}"
snippets.ra = "render :action => '${1:action}'"
snippets.ral = "render :action => '${1:action}', :layout => '${2:layoutname}'"
snippets.rf = "render :file => '${1:filepath}'"
snippets.rfu = "render :file => '${1:filepath}', :use_full_path => ${2:false}"
snippets.ri = "render :inline => '${1:<%= 'hello' %>}'"
snippets.ril = "render :inline => '${1:<%= 'hello' %>}', :locals => { ${2::name} => '${3:value}'$4 }"
snippets.rit = "render :inline => '${1:<%= 'hello' %>}', :type => ${2::rxml}"
snippets.rl = "render :layout => '${1:layoutname}'"
snippets.rn = "render :nothing => ${1:true}"
snippets.rns = "render :nothing => ${1:true}, :status => ${2:401}"
snippets.rp = "render :partial => '${1:item}'"
snippets.rpc = "render :partial => '${1:item}', :collection => ${2:items}"
snippets.rpl = "render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 }"
snippets.rpo = "render :partial => '${1:item}', :object => ${2:object}"
snippets.rps = "render :partial => '${1:item}', :status => ${2:500}"
snippets.rt = "render :text => \"${1:text to render...}\""
snippets.rtl = "render :text => \"${1:text to render...}\", :layout => '${2:layoutname}'"
snippets.rtlt = "render :text => \"${1:text to render...}\", :layout => ${2:true}"
snippets.rts = "render :text => \"${1:text to render...}\", :status => ${2:401}"
snippets.va = "validates_associated :${1:attribute}${2:, :on => :${3:create}}"
snippets.vaif = "validates_associated :${1:attribute}${2:, :on => :${3:create}, :if => proc { |obj| ${5:obj.condition?} }}"
snippets.vc = "validates_confirmation_of :${1:attribute}${2:, :on => :${3:create}, :message => \"${4:should match confirmation}\"}"
snippets.vcif = "validates_confirmation_of :${1:attribute}${2:, :on => :${3:create}, :message => \"${4:should match confirmation}\", :if => proc { |obj| ${5:obj.condition?} }}"
snippets.ve = "validates_exclusion_of :${1:attribute}${2:, :in => ${3:enumerable}, :on => :${4:create}, :message => \"${5:is not allowed}\"}"
snippets.veif = "validates_exclusion_of :${1:attribute}${2:, :in => ${3:enumerable}, :on => :${4:create}, :message => \"${5:is not allowed}\", :if => proc { |obj| ${6:obj.condition?} }}"
snippets.vl = "validates_length_of :${1:attribute}, :within => ${2:3..20}${3:, :on => :${4:create}, :message => \"${5:must be present}\"}"
snippets.vp = "validates_presence_of :${1:attribute}${2:, :on => :${3:create}, :message => \"${4:can't be blank}\"}"
snippets.vpif = "validates_presence_of :${1:attribute}${2:, :on => :${3:create}, :message => \"${4:can't be blank}\"}, :if => proc { |obj| ${5:obj.condition?} }}"
snippets.vu = "validates_uniqueness_of :${1:attribute}${2:, :on => :${3:create}, :message => \"${4:must be unique}\"}"
snippets.vuif = "validates_uniqueness_of :${1:attribute}${2:, :on => :${3:create}, :message => \"${4:must be unique}\", :if => proc { |obj| ${6:obj.condition?} }}"
end
-- zope dtml snippets
if props['FileExt'] == 'dtml' then
snippets['if'] = "${0} "
snippets['else'] = ""
snippets.var = ""
snippets.call = ""
snippets.let = "${0} "
snippets.com = "${0} "
end