pcubillos / bibmanager

A BibTeX manager for LaTeX projects
https://bibmanager.rtfd.io
MIT License
62 stars 13 forks source link

bm.loadfile() breaks on mismatched braces that are not part of an entry #79

Closed pcubillos closed 3 years ago

pcubillos commented 3 years ago

The code should ignore mismatched braces when dealing with comments.

Here's a MWE:


text = """@ARTICLE{2010A&A...518L...1P,
   author = {{Pilbratt}, G.~L. and others},
    title = "{Herschel Space Observatory. An ESA facility for far-infrared and submillimetre astronomy}",
  journal = {\aap},
archivePrefix = "arXiv",
   eprint = {1005.5331},
 primaryClass = "astro-ph.IM",
 keywords = {space vehicles, space vehicles: instruments, infrared: general, submillimetre: general},
     year = 2010,
    month = jul,
   volume = 518,
      eid = {L1},
    pages = {L1},
      doi = {10.1051/0004-6361/201014759},
   adsurl = {http://adsabs.harvard.edu/abs/2010A%26A...518L...1P},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

Any text like this one outside an entry (e.g., [at]article{...}) count as comments
{Riedinger}, J.~R. and {Passvogel}, T. and
       {Crone}, G. and {Doyle}, D. and {Gageur}, U. and {Heras}, A.~M. and
       {Jewell}, C. and {Metcalfe}, L. and {Ott}, S. and {Schmidt}, M.
       }"""

import bibmanager.bib_manager as bm
bibs = bm.loadfile(text=text)
ValueError: Mismatched braces in line 23:
'       }'