Merge branch 'develop' of gmimosa:/gitroot/mimosa/papers into develop
This commit is contained in:
commit
7680d0f983
@ -24,12 +24,6 @@ class TexnotePlugin(PapersPlugin):
|
||||
|
||||
def __init__(self):
|
||||
self.name = TEXNOTE_SECTION
|
||||
if not files.check_directory(TEXNOTE_DIR):
|
||||
os.mkdir(TEXNOTE_DIR)
|
||||
if not files.check_file(TEXNOTE_TEMPLATE):
|
||||
shutil.copy(TEXNOTE_DEFAULT_TEMPLATE, TEXNOTE_TEMPLATE)
|
||||
if not files.check_file(TEXNOTE_STYLE):
|
||||
shutil.copy(TEXNOTE_DEFAULT_STYLE, TEXNOTE_STYLE)
|
||||
|
||||
self.texcmds = collections.OrderedDict([
|
||||
('remove', self.remove),
|
||||
@ -38,6 +32,14 @@ class TexnotePlugin(PapersPlugin):
|
||||
('edit_template', self.edit_template),
|
||||
])
|
||||
|
||||
def ensure_init(self):
|
||||
if not files.check_directory(TEXNOTE_DIR):
|
||||
os.mkdir(TEXNOTE_DIR)
|
||||
if not files.check_file(TEXNOTE_TEMPLATE):
|
||||
shutil.copy(TEXNOTE_DEFAULT_TEMPLATE, TEXNOTE_TEMPLATE)
|
||||
if not files.check_file(TEXNOTE_STYLE):
|
||||
shutil.copy(TEXNOTE_DEFAULT_STYLE, TEXNOTE_STYLE)
|
||||
|
||||
def parser(self, subparsers):
|
||||
parser = subparsers.add_parser(self.name, help='edit advance note in latex')
|
||||
sub = parser.add_subparsers(title='valid texnote commands', dest='texcmd')
|
||||
@ -56,6 +58,8 @@ class TexnotePlugin(PapersPlugin):
|
||||
return parser
|
||||
|
||||
def command(self, args):
|
||||
self.ensure_init()
|
||||
|
||||
texcmd = args.texcmd
|
||||
del args.texcmd
|
||||
self.texcmds[texcmd](**vars(args))
|
||||
|
Loading…
x
Reference in New Issue
Block a user