This @button node saves a surprising amount of typing and futzing with 
windows.

It works somewhat like the rst3 command: it searches down the tree for @rst 
nodes, then up the tree.

Unlike the rst3 command, it only works on the first @rst node found.

import os
g.cls()
c.save()
c.rstCommands.rst3()
path = g.os_path_finalize_join(g.app.loadDir,'..','doc','html')
os.chdir(path)
os.system('make html')
for p2 in p.self_and_subtree():
    if g.match_word(p2.h,0,'@rst'):
        break
else:
    for p2 in p.parents():
        if g.match_word(p2.h,0,'@rst'):
            break
    else: p2 = None
if p2:
    fn = p2.h[4:].strip()
    base_fn = g.os_path_basename(fn)
    fn = g.os_path_finalize_join(path,'_build','html',base_fn)
    print('opening: %s' % (fn))
    if g.os_path_exists(fn):
        os.system(fn)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to