Compare commits

..

No commits in common. "master" and "issue30" have entirely different histories.

5 changed files with 9 additions and 11 deletions

View File

@ -5,9 +5,6 @@ BiblioManager is a simple script to download and store your articles. Read on if
**Note :** This script is currently a work in progress. **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) 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**) ? ## What is BiblioManager (or what it is **not**) ?

View File

@ -22,7 +22,7 @@ try:
from urllib.error import URLError from urllib.error import URLError
except ImportError: except ImportError:
# Fall back to Python 2's urllib2 # Fall back to Python 2's urllib2
from urllib2 import urlopen, Request, URLError from urllib2 import urlopen, Request
import arxiv2bib as arxiv_metadata import arxiv2bib as arxiv_metadata
import libbmc.tools as tools import libbmc.tools as tools
import bibtexparser import bibtexparser
@ -213,14 +213,15 @@ def findArticleID(src, only=["DOI", "arXiv"]):
extractfull += ' '.join([i.decode(stdout_encoding).strip() for i in totext.stdout.readlines()]) extractfull += ' '.join([i.decode(stdout_encoding).strip() for i in totext.stdout.readlines()])
# Try to extract DOI # Try to extract DOI
if "DOI" in only: if "DOI" in only:
extractlower = extractfull.lower().replace('digital object identifier', 'doi') extractID = doi_re.search(extractfull.lower().replace('Œ', '-'))
extractID = doi_re.search(extractlower.replace('Œ', '-'))
if not extractID: if not extractID:
# PNAS fix # PNAS fix
extractID = doi_pnas_re.search(extractlower.replace('pnas', '/pnas')) extractID = doi_pnas_re.search(extractfull.
lower().
replace('pnas', '/pnas'))
if not extractID: if not extractID:
# JSB fix # JSB fix
extractID = doi_jsb_re.search(extractlower) extractID = doi_jsb_re.search(extractfull.lower())
if extractID: if extractID:
extract_type = "DOI" extract_type = "DOI"
totext.terminate() totext.terminate()

View File

@ -8,5 +8,5 @@
number = {4}, number = {4},
author = {Yan-Hua Hou and Lev P. Pitaevskii and Sandro Stringari}, author = {Yan-Hua Hou and Lev P. Pitaevskii and Sandro Stringari},
title = {First and second sound in a highly elongated Fermi gas at unitarity}, title = {First and second sound in a highly elongated Fermi gas at unitarity},
journal = {Phys. Rev. A} journal = {Physical Review A}
} }

View File

@ -123,7 +123,7 @@ Lattice},
def test_getBibtex_id(self): def test_getBibtex_id(self):
bibtexAppend(self.bibtex_article) 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) self.assertEqual(got, self.bibtex_article)
def test_getBibtex_file(self): def test_getBibtex_file(self):

View File

@ -19,7 +19,7 @@ class TestTools(unittest.TestCase):
self.assertEqual(slugify(u"à&é_truc.pdf"), "ae_trucpdf") self.assertEqual(slugify(u"à&é_truc.pdf"), "ae_trucpdf")
def test_parsed2Bibtex(self): def test_parsed2Bibtex(self):
parsed = {'ENTRYTYPE': 'article', 'ID': 'test', 'field1': 'test1', parsed = {'type': 'article', 'id': 'test', 'field1': 'test1',
'field2': 'test2'} 'field2': 'test2'}
expected = ('@article{test,\n\tfield1={test1},\n' + expected = ('@article{test,\n\tfield1={test1},\n' +
'\tfield2={test2},\n}\n\n') '\tfield2={test2},\n}\n\n')