Merge branch 'develop' of gmimosa:/gitroot/mimosa/papers into develop
Conflicts: papers/commands/open_cmd.py
This commit is contained in:
commit
a928af2944
@ -1,7 +1,7 @@
|
|||||||
[header]
|
[header]
|
||||||
title = adding bibdata by hand
|
title = adding bibdata by hand
|
||||||
id = a3f35d0d7925baa938852ab89477ef26964edf18
|
id = a3f35d0d7925baa938852ab89477ef26964edf18
|
||||||
status = open
|
status = closed
|
||||||
type = feature
|
type = feature
|
||||||
author = Fabien Benureau
|
author = Fabien Benureau
|
||||||
mail = fabien.benureau+git@gmail.com
|
mail = fabien.benureau+git@gmail.com
|
||||||
@ -9,6 +9,7 @@ date = 2012-10-05 at 14:59 UCT
|
|||||||
|
|
||||||
[eventlog]
|
[eventlog]
|
||||||
opened[0] = opened the 2012-10-05 at 14:59 UCT by Fabien Benureau
|
opened[0] = opened the 2012-10-05 at 14:59 UCT by Fabien Benureau
|
||||||
|
closed[1] = closed the 2013-06-13 at 13:03(UCT) by Olivier Mangin
|
||||||
|
|
||||||
[discussion]
|
[discussion]
|
||||||
desc = # enter your description here
|
desc = # enter your description here
|
||||||
|
5
NOTES
5
NOTES
@ -1,3 +1,8 @@
|
|||||||
|
A paper correspond to 3 files :
|
||||||
|
name.pdf a pdf or ps file, the paper itself, whose location is arbitrary
|
||||||
|
bibdata/name.bibyaml a bibyaml file with all bibliographic data.
|
||||||
|
meta/name.meta a metadata file for internal use, notes, citekeys, status, etc.
|
||||||
|
|
||||||
+ requires config file (default repo, open command, ...)
|
+ requires config file (default repo, open command, ...)
|
||||||
- printing should include templating engine and several templates for bib types and output
|
- printing should include templating engine and several templates for bib types and output
|
||||||
* chose existing engine
|
* chose existing engine
|
||||||
|
4
README
4
README
@ -1,4 +0,0 @@
|
|||||||
A paper correspond to 3 files :
|
|
||||||
name.pdf a pdf or ps file, the paper itself, whose location is arbitrary
|
|
||||||
bibdata/name.bibyaml a bibyaml file with all bibliographic data.
|
|
||||||
meta/name.meta a metadata file for internal use, notes, citekeys, status, etc.
|
|
34
README.md
Normal file
34
README.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Papers brings your bibliography to the command line.
|
||||||
|
|
||||||
|
Papers organizes your bibliographic documents together with the bibliographic data associated to them and provides command line access to basic and advanced manipulation of your library.
|
||||||
|
|
||||||
|
Papers is built with the following principles in mind:
|
||||||
|
|
||||||
|
- all papers are referenced using unique citation keys,
|
||||||
|
- bibliographic data (i.e. pure bibtex information) is kept separated from metadata (including links to pdf or tags),
|
||||||
|
- everything is stored in plain text so it can be manually edited or version controlled.
|
||||||
|
|
||||||
|
|
||||||
|
Notice: papers is still in early development and cannot be considered as stable
|
||||||
|
|
||||||
|
|
||||||
|
Getting started
|
||||||
|
---------------
|
||||||
|
Create your library (by default, goes to '~/.papers/').
|
||||||
|
|
||||||
|
papers init
|
||||||
|
|
||||||
|
Import existing data from bibtex (papers will try to automatically copy documents defined as 'file' in bibtex):
|
||||||
|
|
||||||
|
papers import path/to/collection.bib
|
||||||
|
or for bibtex containing a single file:
|
||||||
|
|
||||||
|
papers add --bibfile article.bib --docfile article.pdf
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
-------
|
||||||
|
|
||||||
|
- Fabien Benureau
|
||||||
|
- Olivier Mangin
|
||||||
|
- Jonathan Grizou
|
@ -8,20 +8,26 @@ from .. import configs
|
|||||||
def parser(subparsers, config):
|
def parser(subparsers, config):
|
||||||
parser = subparsers.add_parser('open',
|
parser = subparsers.add_parser('open',
|
||||||
help='open the paper in a pdf viewer')
|
help='open the paper in a pdf viewer')
|
||||||
|
parser.add_argument('-w', '--with', dest='with_command', default=None,
|
||||||
|
help='command to use to open the document file')
|
||||||
parser.add_argument('citekey',
|
parser.add_argument('citekey',
|
||||||
help='the paper associated citekey')
|
help='the paper associated citekey')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def command(config, ui, citekey):
|
def command(config, ui, with_command, citekey):
|
||||||
rp = repo.Repository.from_directory(config)
|
rp = repo.Repository.from_directory(config)
|
||||||
paper = rp.paper_from_ref(citekey, fatal=True)
|
paper = rp.paper_from_ref(citekey, fatal=True)
|
||||||
|
if with_command is None:
|
||||||
|
with_command = config.get(configs.MAIN_SECTION, 'open-cmd')
|
||||||
try:
|
try:
|
||||||
filepath = paper.get_document_path()
|
filepath = paper.get_document_path()
|
||||||
subprocess.Popen([config.get(configs.MAIN_SECTION, 'open-cmd'),
|
subprocess.Popen([with_command, filepath])
|
||||||
filepath])
|
ui.print_('{} opened.'.format(color.dye(filepath, color.filepath)))
|
||||||
print('{} opened.'.format(color.dye(filepath, color.filepath)))
|
|
||||||
except NoDocumentFile:
|
except NoDocumentFile:
|
||||||
ui.error('No document associated with the entry {}.'.format(
|
ui.error('No document associated with the entry {}.'.format(
|
||||||
color.dye(citekey, color.citekey)))
|
color.dye(citekey, color.citekey)))
|
||||||
ui.exit()
|
ui.exit()
|
||||||
|
except OSError:
|
||||||
|
ui.error("Command does not exist: %s." % with_command)
|
||||||
|
ui.exit(127)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user