Upgrade to latest version of bibtex-parser
This commit is contained in:
parent
872d93c6aa
commit
613f082471
@ -106,6 +106,7 @@ Here are some sources of inspirations for this project :
|
|||||||
A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns.
|
A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns.
|
||||||
|
|
||||||
* Open
|
* Open
|
||||||
|
* Use bibtex-parser lib to write bibtex, instead of parsed2BibTex
|
||||||
* Parameter to disable remote search
|
* Parameter to disable remote search
|
||||||
* Rebuild
|
* Rebuild
|
||||||
* Webserver interface
|
* Webserver interface
|
||||||
@ -119,5 +120,4 @@ A list of ideas and TODO. Don't hesitate to give feedback on the ones you really
|
|||||||
|
|
||||||
See upstream
|
See upstream
|
||||||
|
|
||||||
* homogeneize\_latex\_encoding => to implement again, bug with metadata upstream
|
|
||||||
* Remove the watermarks on pdf files => done, some warning in okular on generated pdf, but seems ok. Seems to be a bug in PyPDF2.
|
* Remove the watermarks on pdf files => done, some warning in okular on generated pdf, but seems ok. Seems to be a bug in PyPDF2.
|
||||||
|
11
main.py
11
main.py
@ -19,6 +19,8 @@ try:
|
|||||||
except:
|
except:
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from bibtexparser.bparser import BibTexParser
|
from bibtexparser.bparser import BibTexParser
|
||||||
|
from bibtexparser.customization import homogeneize_latex_encoding
|
||||||
|
from bibtexparser.bwriter import bibtex as bibTexWriter
|
||||||
from termios import tcflush, TCIOFLUSH
|
from termios import tcflush, TCIOFLUSH
|
||||||
import params
|
import params
|
||||||
|
|
||||||
@ -211,8 +213,7 @@ def getExtension(filename):
|
|||||||
def checkBibtex(filename, bibtex):
|
def checkBibtex(filename, bibtex):
|
||||||
print("The bibtex entry found for "+filename+" is :")
|
print("The bibtex entry found for "+filename+" is :")
|
||||||
|
|
||||||
bibtex = StringIO(bibtex)
|
bibtex = BibTexParser(bibtex, customization=homogeneize_latex_encoding)
|
||||||
bibtex = BibTexParser(bibtex)
|
|
||||||
bibtex = bibtex.get_entry_dict()
|
bibtex = bibtex.get_entry_dict()
|
||||||
if len(bibtex) > 0:
|
if len(bibtex) > 0:
|
||||||
bibtex_name = bibtex.keys()[0]
|
bibtex_name = bibtex.keys()[0]
|
||||||
@ -228,7 +229,7 @@ def checkBibtex(filename, bibtex):
|
|||||||
tmpfile.write(bibtex_string)
|
tmpfile.write(bibtex_string)
|
||||||
tmpfile.flush()
|
tmpfile.flush()
|
||||||
subprocess.call([EDITOR, tmpfile.name])
|
subprocess.call([EDITOR, tmpfile.name])
|
||||||
bibtex = BibTexParser(StringIO(tmpfile.read()+"\n"))
|
bibtex = BibTexParser(tmpfile.read()+"\n", customization=homogeneize_latex_encoding)
|
||||||
|
|
||||||
bibtex = bibtex.get_entry_dict()
|
bibtex = bibtex.get_entry_dict()
|
||||||
if len(bibtex) > 0:
|
if len(bibtex) > 0:
|
||||||
@ -341,7 +342,7 @@ def deleteId(ident):
|
|||||||
Delete a file based on its id in the bibtex file
|
Delete a file based on its id in the bibtex file
|
||||||
"""
|
"""
|
||||||
with open(params.folder+'index.bib', 'r') as fh:
|
with open(params.folder+'index.bib', 'r') as fh:
|
||||||
bibtex = BibTexParser(fh)
|
bibtex = BibTexParser(fh.read(), customization=homogeneize_latex_encoding)
|
||||||
bibtex = bibtex.get_entry_dict()
|
bibtex = bibtex.get_entry_dict()
|
||||||
|
|
||||||
if ident not in bibtex.keys():
|
if ident not in bibtex.keys():
|
||||||
@ -362,7 +363,7 @@ def deleteFile(filename):
|
|||||||
Delete a file based on its filename
|
Delete a file based on its filename
|
||||||
"""
|
"""
|
||||||
with open(params.folder+'index.bib', 'r') as fh:
|
with open(params.folder+'index.bib', 'r') as fh:
|
||||||
bibtex = BibTexParser(fh)
|
bibtex = BibTexParser(fh.read(), customization=homogeneize_latex_encoding)
|
||||||
bibtex = bibtex.get_entry_dict()
|
bibtex = bibtex.get_entry_dict()
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
|
Loading…
Reference in New Issue
Block a user