Example #1
0
def read_str(bibstr):
    from pybtex.database.input import bibtex
    from pybtex import errors
    errors.enable_strict_mode()
    from io import StringIO
    parser = bibtex.Parser()
    return parser.parse_stream(StringIO(bibstr))
Example #2
0
def read_str(bibstr):
    from pybtex.database.input import bibtex
    from pybtex import errors
    errors.enable_strict_mode()
    from io import StringIO
    parser = bibtex.Parser()
    return parser.parse_stream(StringIO(bibstr))
Example #3
0
def write(bib, filename, Replace=False):
    import os.path
    if os.path.exists(filename) and not Replace:
        raise Warning("File exists")
    from pybtex.database.output import bibtex
    from pybtex import errors
    errors.enable_strict_mode()
    writer = bibtex.Writer()
    import tempfile  # use tempfile in order to save original .bib file
    tmpfilename = tempfile.mkstemp()[1]
    writer.write_file(bib, tmpfilename)  # this may raise a exception
    import shutil
    shutil.move(tmpfilename, filename)
Example #4
0
def write(bib,filename,Replace=False):
    import os.path
    if os.path.exists(filename) and not Replace:
        raise Warning("File exists")
    from pybtex.database.output import bibtex
    from pybtex import errors
    errors.enable_strict_mode()
    writer = bibtex.Writer()
    import tempfile  # use tempfile in order to save original .bib file
    tmpfilename = tempfile.mkstemp()[1]
    writer.write_file(bib,tmpfilename) # this may raise a exception
    import shutil
    shutil.move(tmpfilename,filename)
Example #5
0
 def __init__(self):
     super(Bibtex, self).__init__()
     enable_strict_mode(True) #throw errors
Example #6
0
def _read_file(filename):
    from pybtex.database.input import bibtex
    from pybtex import errors
    errors.enable_strict_mode()
    parser = bibtex.Parser()
    return parser.parse_file(filename)
Example #7
0
 def __init__(self):
     super(Bibtex, self).__init__()
     enable_strict_mode(True) #throw errors
     self.bibtex_to_unicode = build_bibtex_to_unicode(bibtex_lookup.unicode_to_latex)
Example #8
0
 def __init__(self):
     super(Bibtex, self).__init__()
     enable_strict_mode(True)  #throw errors
     self.bibtex_to_unicode = build_bibtex_to_unicode(
         bibtex_lookup.unicode_to_latex)