Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
96a85feec0 | |||
4dbc13e44c | |||
c84159068c | |||
|
330c2f2b5f | ||
|
5f8665940d | ||
|
f7bcdece5f | ||
|
1b83f01581 |
@ -5,6 +5,9 @@ BiblioManager is a simple script to download and store your articles. Read on if
|
||||
|
||||
**Note :** This script is currently a work in progress.
|
||||
|
||||
**Note: If you want to extract some functions from this repo, please consider using [libbmc](https://github.com/Phyks/libbmc/) instead, which is specifically dedicated to this (and this repo should be using it, rather than duplicating code).**
|
||||
|
||||
|
||||
Travis build status : [![Build Status](https://travis-ci.org/Phyks/BMC.svg?branch=master)](https://travis-ci.org/Phyks/BMC)
|
||||
|
||||
## What is BiblioManager (or what it is **not**) ?
|
||||
|
@ -22,7 +22,7 @@ try:
|
||||
from urllib.error import URLError
|
||||
except ImportError:
|
||||
# Fall back to Python 2's urllib2
|
||||
from urllib2 import urlopen, Request
|
||||
from urllib2 import urlopen, Request, URLError
|
||||
import arxiv2bib as arxiv_metadata
|
||||
import libbmc.tools as tools
|
||||
import bibtexparser
|
||||
@ -213,15 +213,14 @@ def findArticleID(src, only=["DOI", "arXiv"]):
|
||||
extractfull += ' '.join([i.decode(stdout_encoding).strip() for i in totext.stdout.readlines()])
|
||||
# Try to extract DOI
|
||||
if "DOI" in only:
|
||||
extractID = doi_re.search(extractfull.lower().replace('Œ', '-'))
|
||||
extractlower = extractfull.lower().replace('digital object identifier', 'doi')
|
||||
extractID = doi_re.search(extractlower.replace('Œ', '-'))
|
||||
if not extractID:
|
||||
# PNAS fix
|
||||
extractID = doi_pnas_re.search(extractfull.
|
||||
lower().
|
||||
replace('pnas', '/pnas'))
|
||||
extractID = doi_pnas_re.search(extractlower.replace('pnas', '/pnas'))
|
||||
if not extractID:
|
||||
# JSB fix
|
||||
extractID = doi_jsb_re.search(extractfull.lower())
|
||||
extractID = doi_jsb_re.search(extractlower)
|
||||
if extractID:
|
||||
extract_type = "DOI"
|
||||
totext.terminate()
|
||||
|
@ -8,5 +8,5 @@
|
||||
number = {4},
|
||||
author = {Yan-Hua Hou and Lev P. Pitaevskii and Sandro Stringari},
|
||||
title = {First and second sound in a highly elongated Fermi gas at unitarity},
|
||||
journal = {Physical Review A}
|
||||
journal = {Phys. Rev. A}
|
||||
}
|
@ -123,7 +123,7 @@ Lattice},
|
||||
|
||||
def test_getBibtex_id(self):
|
||||
bibtexAppend(self.bibtex_article)
|
||||
got = getBibtex(self.bibtex_article['ID'], file_id='ID')
|
||||
got = getBibtex(self.bibtex_article['ID'], file_id='id')
|
||||
self.assertEqual(got, self.bibtex_article)
|
||||
|
||||
def test_getBibtex_file(self):
|
||||
|
@ -19,7 +19,7 @@ class TestTools(unittest.TestCase):
|
||||
self.assertEqual(slugify(u"à&é_truc.pdf"), "ae_trucpdf")
|
||||
|
||||
def test_parsed2Bibtex(self):
|
||||
parsed = {'type': 'article', 'id': 'test', 'field1': 'test1',
|
||||
parsed = {'ENTRYTYPE': 'article', 'ID': 'test', 'field1': 'test1',
|
||||
'field2': 'test2'}
|
||||
expected = ('@article{test,\n\tfield1={test1},\n' +
|
||||
'\tfield2={test2},\n}\n\n')
|
||||
|
Loading…
Reference in New Issue
Block a user