add template text to add editor input

main
Fabien Benureau 11 years ago
parent 2078876168
commit c4f296346a

@ -4,6 +4,8 @@ from .. import bibstruct
from .. import content
from .. import repo
from .. import paper
from .. import templates
def parser(subparsers):
parser = subparsers.add_parser('add', help='add a paper to the repository')
@ -40,13 +42,21 @@ def command(args):
if bibfile is None:
cont = True
bibstr = ''
while cont:
try:
bibstr = content.editor_input(config().edit_cmd, bibstr, suffix='.yaml')
bibdata = rp.databroker.verify(bibstr)
bibstruct.verify_bibdata(bibdata)
# REFACTOR Generate citykey
cont = False
bibstr = content.editor_input(config().edit_cmd,
templates.add_bib,
suffix='.bib')
if bibstr == templates.add_bib:
cont = ui.input_yn(
question='Bibfile not edited. Edit again ?',
default='y')
if not cont:
ui.exit(0)
else:
bibdata = rp.databroker.verify(bibstr)
bibstruct.verify_bibdata(bibdata)
# REFACTOR Generate citykey
cont = False
except ValueError:
cont = ui.input_yn(
question='Invalid bibfile. Edit again ?',

@ -0,0 +1 @@
from str_templates import *

@ -0,0 +1,18 @@
# Input the bibliographic data for your article
# Supported formats are bibtex (template below), bibyaml and bibtexml
@article{
YourCitekey,
author = "LastName1, FirstName1 and LastName2, FirstName2",
title = "",
journal = "",
number = "7",
pages = "23-31",
volume = "13",
year = "2013",
doi = "",
issn = "",
keywords = "",
abstract = ""
}

@ -0,0 +1,20 @@
add_bib = """
# Input the bibliographic data for your article
# Supported formats are bibtex (template below), bibyaml and bibtexml
@article{
YourCitekey,
author = "LastName1, FirstName1 and LastName2, FirstName2",
title = "",
journal = "",
number = "7",
pages = "23-31",
volume = "13",
year = "2013",
doi = "",
issn = "",
keywords = "",
abstract = ""
}
"""
Loading…
Cancel
Save