change blocks into sa

This commit is contained in:
Meng Zhuo 2013-06-20 16:21:04 +08:00
parent 317dddc096
commit ab4daaf4ce

View File

@ -48,6 +48,14 @@ def get_popular_code_type(path):
popular_type = "lua" # Don't break default popular_type = "lua" # Don't break default
return popular_type return popular_type
def complete(t, opts):
if t:
opts = [ m[len(t):] for m in opts if m.startswith(t) ]
if len(opts) == 1:
return opts[0]
return "({0})".format("|".join(opts))
endglobal endglobal
snippet part "Part" b snippet part "Part" b
@ -157,74 +165,13 @@ snippet cont "Content Block" b
$0 $0
endsnippet endsnippet
snippet tip "Tip Block" b #http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions
.. tip:: snippet sa "Specific Admonitions" b
.. $1`!p snip.rv =complete(t[1], ["attention", "caution", "danger",
"error", "hint", "important", "note",
"tip", "warning"])`::
${1:some tips} ${2:Content}
$0
endsnippet
snippet not "Note Block" b
.. note::
${1:some notes}
$0
endsnippet
snippet war "Warning Block" b
.. warning::
${1:Warning!}
$0
endsnippet
snippet imp "Important Block" b
.. important::
${1:This is important}
$0
endsnippet
snippet att "Attention " b
.. attention::
${1:Attention!}
$0
endsnippet
snippet dan "Danger" b
.. danger::
${1:Danger}
$0
endsnippet
snippet err "Error Block" b
.. error::
${1:Errors!}
$0
endsnippet
snippet cau "Cautions Block" b
.. caution::
${1:Cautions!}
$0
endsnippet
snippet top "Topic" b
.. topic:: ${1:title}
${2:contents}
$0 $0
endsnippet endsnippet