mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Added checks for functions/commands existence
Added implementation for ABBR tag
This commit is contained in:
@@ -6,8 +6,15 @@ setlocal smartindent
|
|||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal formatoptions=tcq "set VIms default
|
setlocal formatoptions=tcq "set VIms default
|
||||||
|
|
||||||
|
if exists("b:did_rst_plugin")
|
||||||
|
finish " only load once
|
||||||
|
else
|
||||||
|
let b:did_rst_plugin = 1
|
||||||
|
endif
|
||||||
|
|
||||||
map <F5> :call <SID>Rst2Blogger()<cr>
|
map <F5> :call <SID>Rst2Blogger()<cr>
|
||||||
|
|
||||||
|
if !exists('*s:Rst2Blogger')
|
||||||
" Simple function, that translates reSt text into html with specified format,
|
" Simple function, that translates reSt text into html with specified format,
|
||||||
" suitable to copy and paste into blogger post.
|
" suitable to copy and paste into blogger post.
|
||||||
fun <SID>Rst2Blogger()
|
fun <SID>Rst2Blogger()
|
||||||
@@ -60,6 +67,20 @@ class NoHeaderHTMLTranslator(HTMLTranslator):
|
|||||||
else:
|
else:
|
||||||
self.body.append(self.starttag(node, 'acronym', ''))
|
self.body.append(self.starttag(node, 'acronym', ''))
|
||||||
|
|
||||||
|
def visit_abbreviation(self, node):
|
||||||
|
node_text = node.children[0].astext()
|
||||||
|
node_text = node_text.replace('\n', ' ')
|
||||||
|
patt = re.compile(r'^(.+)\s<(.+)>')
|
||||||
|
|
||||||
|
if patt.match(node_text):
|
||||||
|
node.children[0] = nodes.Text(patt.match(node_text).groups()[0])
|
||||||
|
self.body.append(\
|
||||||
|
self.starttag(node, 'abbr',
|
||||||
|
'', title=patt.match(node_text).groups()[1]))
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.body.append(self.starttag(node, 'abbr', ''))
|
||||||
|
|
||||||
|
|
||||||
_w = Writer()
|
_w = Writer()
|
||||||
_w.translator_class = NoHeaderHTMLTranslator
|
_w.translator_class = NoHeaderHTMLTranslator
|
||||||
@@ -80,7 +101,7 @@ if name.lower().endswith(".rst"):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
vim.command(r'silent! %s/<!-- more -->/\r<!-- more -->\r\r/g')
|
vim.command(r'silent! %s/<!-- more -->/\r<!-- more -->\r/g')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
vim.command('w %s' % name)
|
vim.command('w %s' % name)
|
||||||
@@ -90,7 +111,9 @@ else:
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
endfun
|
endfun
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('*s:Restify')
|
||||||
" This is similar to that above, but creates full html document
|
" This is similar to that above, but creates full html document
|
||||||
fun <SID>Restify()
|
fun <SID>Restify()
|
||||||
python << EOF
|
python << EOF
|
||||||
@@ -120,3 +143,4 @@ else:
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
endfun
|
endfun
|
||||||
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user