Fix bug in export.
Not using ui.print_ was causing encoding error.
This commit is contained in:
parent
b71b602a50
commit
0274f2640a
@ -1,18 +1,16 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
|
|
||||||
from .. import repo
|
from .. import repo
|
||||||
from ..configs import config
|
from ..configs import config
|
||||||
from ..uis import get_ui
|
from ..uis import get_ui
|
||||||
from .. import endecoder
|
from .. import endecoder
|
||||||
|
|
||||||
|
|
||||||
def parser(subparsers):
|
def parser(subparsers):
|
||||||
parser = subparsers.add_parser('export',
|
parser = subparsers.add_parser('export', help='export bibliography')
|
||||||
help='export bibliography')
|
|
||||||
# parser.add_argument('-f', '--bib-format', default='bibtex',
|
# parser.add_argument('-f', '--bib-format', default='bibtex',
|
||||||
# help='export format')
|
# help='export format')
|
||||||
parser.add_argument('citekeys', nargs='*',
|
parser.add_argument('citekeys', nargs='*', help='one or several citekeys')
|
||||||
help='one or several citekeys')
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +25,7 @@ def command(args):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
papers = [rp.pull_paper(c) for c in args.citekeys]
|
papers = [rp.pull_paper(c) for c in args.citekeys]
|
||||||
except repo.InvalidReference, v:
|
except repo.InvalidReference as v:
|
||||||
ui.error(v)
|
ui.error(v)
|
||||||
ui.exit(1)
|
ui.exit(1)
|
||||||
|
|
||||||
@ -36,9 +34,6 @@ def command(args):
|
|||||||
bib = {}
|
bib = {}
|
||||||
for p in papers:
|
for p in papers:
|
||||||
bib[p.citekey] = p.bibentry
|
bib[p.citekey] = p.bibentry
|
||||||
try:
|
exporter = endecoder.EnDecoder()
|
||||||
exporter = endecoder.EnDecoder()
|
bibdata_raw = exporter.encode_bibdata(bib)
|
||||||
bibdata_raw = exporter.encode_bibdata(bib)
|
ui.print_(bibdata_raw)
|
||||||
print(bibdata_raw, end='')
|
|
||||||
except KeyError:
|
|
||||||
ui.error("Invalid output format: %s." % bib_format)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user