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 content
from .. import repo from .. import repo
from .. import paper from .. import paper
from .. import templates
def parser(subparsers): def parser(subparsers):
parser = subparsers.add_parser('add', help='add a paper to the repository') parser = subparsers.add_parser('add', help='add a paper to the repository')
@ -40,9 +42,17 @@ def command(args):
if bibfile is None: if bibfile is None:
cont = True cont = True
bibstr = '' bibstr = ''
while cont:
try: try:
bibstr = content.editor_input(config().edit_cmd, bibstr, suffix='.yaml') 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) bibdata = rp.databroker.verify(bibstr)
bibstruct.verify_bibdata(bibdata) bibstruct.verify_bibdata(bibdata)
# REFACTOR Generate citykey # REFACTOR Generate citykey

@ -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