Skip to content

Instantly share code, notes, and snippets.

@Sixeight
Created December 3, 2010 20:50
Show Gist options
  • Save Sixeight/727531 to your computer and use it in GitHub Desktop.
Save Sixeight/727531 to your computer and use it in GitHub Desktop.
発表用、あとでちゃんと作る
" list kind {{{
let s:kind_list = {
\ 'name' : 'list',
\ 'default_action' : 'list',
\ 'action_table': {},
\}
let s:kind_list.action_table.list = {
\ 'description' : 'list with selected key',
\ }
function! s:kind_list.action_table.list.func(candidate)
let l:list = get(a:candidate.action__list, 0, {})
let l:key = get(a:candidate.action__list, 1, '')
call unite#start([insert(get(l:list, l:key, []), 'list')])
endfunction
call unite#define_kind(s:kind_list)
" }}}
" unite-list {{{
let s:unite_list = {'name': 'list'}
function! s:unite_list.gather_candidates(args, context)
return map(a:args, '{
\ "word": get(split(v:val, " "), 0),
\ "abbr": v:val,
\ "source": "list",
\ "kind": "word",
\ }')
endfunction
call unite#define_source(s:unite_list)
" }}}
" unite-html5 {{{
let s:html5_list = {
\ "metadata": [ "base", "command", "link", "meta", "noscript", "script", "style", "title" ],
\ "flow": ["a", "abbr", "address", "area (if it is a descendant of a map element)", "article", "aside", "audio", "b", "bdo", "blockquote", "br", "button", "canvas", "cite", "code", "command", "datalist", "del", "details", "dfn", "div", "dl", "em", "embed", "fieldset", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "map", "mark", "math", "menu", "meter", "nav", "noscript", "object", "ol", "output", "p", "pre", "progress", "q", "ruby", "s", "samp", "script", "section", "select", "small", "span", "strong", "style (if the scoped attribute is present)", "sub", "sup", "svg", "table", "textarea", "time", "ul", "var", "video", "wbr", "text"],
\ "sectioning": [ "article", "aside", "nav", "section" ],
\ "heading": [ "h1", "h2", "h3", "h4", "h5", "h6", "hgroup" ],
\ "phrasing": ["a (if it contains only phrasing content)", "abbr", "area (if it is a descendant of a map element)", "audio", "b", "bdo", "br", "button", "canvas", "cite", "code", "command", "datalist", "del (if it contains only phrasing content)", "dfn", "em", "embed", "i", "iframe", "img", "input", "ins (if it contains only phrasing content)", "kbd", "keygen", "label", "map (if it contains only phrasing content)", "mark", "math", "meter", "noscript", "object", "output", "progress", "q", "ruby", "s", "samp", "script", "select", "small", "span", "strong", "sub", "sup", "svg", "textarea", "time", "var", "video", "wbr", "text"],
\ "embedded": [ "audio", "canvas", "embed", "iframe", "img", "math", "object", "svg", "video" ],
\ "interactive": ["a", "audio (if the controls attribute is present)", "button", "details", "embed", "iframe", "img (if the usemap attribute is present)", "input (if the type attribute is not in the hidden state)", "keygen", "label", "menu (if the type attribute is in the toolbar state)", "object (if the usemap attribute is present)", "select", "textarea", "video (if the controls attribute is present)"],
\ }
let s:unite_html = {'name': 'html5/category'}
function! s:unite_html.gather_candidates(args, context)
let l:categories = [
\ ["metadata", "メタデータ"],
\ ["flow", "フロー"],
\ ["sectioning", "セクショニング"],
\ ["heading", "ヘッディング"],
\ ["phrasing", "フレージング"],
\ ["embedded", "エンベデッド"],
\ ["interactive", "インタラクティブ"],
\ ]
return map(l:categories, '{
\ "word": v:val[1] . "・コンテンツ",
\ "source": "html5/category",
\ "kind": "list",
\ "action__list": [s:html5_list, v:val[0]],
\ }')
endfunction
call unite#define_source(s:unite_html)
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment