Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The line is not ending the record. " Strange behavior with quotes and a bib item with only one field #178

Closed
devmessias opened this issue Aug 10, 2017 · 4 comments

Comments

@devmessias
Copy link

Using

@misc{SM,
    note="Supplemental Material reference"
 }

don't work

Using

@misc{SM,
    note="Supplemental Material reference",
 }

work

Using

@misc{SM,
    note={"Supplemental Material reference"}
 }

work

The source code

import logging
import logging.config
from bibtexparser.bparser import BibTexParser

logger = logging.getLogger(__name__)

logging.config.dictConfig({
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'standard': {
            'format': '%(asctime)s [%(levelname)s] %(name)s %(funcName)s:%(lineno)d: %(message)s'
        },
    },
    'handlers': {
        'default': {
            'level':'DEBUG',
            'formatter': 'standard',
            'class':'logging.StreamHandler',
        },
    },
    'loggers': {
        '': {
            'handlers': ['default'],
            'level': 'DEBUG',
            'formatter': 'standard',
            'propagate': True
        }
    }
})


if __name__ == '__main__':
    bibtex = """@misc{SM,
    note="Supplemental Material reference"
    }
    """

    with open('/tmp/bibtex.bib', 'w') as bibfile:
        bibfile.write(bibtex)


    with open('/tmp/bibtex.bib', 'r') as bibfile:
        bp = BibTexParser(bibfile.read())
        print(bp.get_entry_list())
@devmessias
Copy link
Author

the output

2017-08-10 12:59:12,260 [DEBUG] bibtexparser.bparser _parse_records:157: Inspect line 0
2017-08-10 12:59:12,260 [DEBUG] bibtexparser.bparser _parse_records:161: Line starts with @
2017-08-10 12:59:12,260 [DEBUG] bibtexparser.bparser _add_parsed_record:151: The record is empty
2017-08-10 12:59:12,260 [DEBUG] bibtexparser.bparser _parse_records:165: The record is set to empty
2017-08-10 12:59:12,260 [DEBUG] bibtexparser.bparser _parse_records:157: Inspect line 1
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_records:157: Inspect line 2
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_records:157: Inspect line 3
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _add_parsed_record:143: The record is not empty. Let's parse it.
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:216: }\n detected in the record. Clean up.
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:238: Split the record of its lines and treat them
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:243: Inspect: @misc{SM
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:247: Line starts with @ and the key is not stored yet.
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:251: bibtype = misc
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:252: id = SM
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:243: Inspect: note="Supplemental Material reference"
}
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:271: Line contains a key-pair value and the key is not stored yet.
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _string_subst_partial:384: Substitute string definitions inside larger expressions
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:277: The line is not ending the record.
2017-08-10 12:59:12,261 [DEBUG] bibtexparser.bparser _parse_record:296: All lines have been treated
2017-08-10 12:59:12,262 [DEBUG] bibtexparser.bparser _parse_record:298: The dict is empty, return it.
2017-08-10 12:59:12,262 [DEBUG] bibtexparser.bparser _add_parsed_record:149: Nothing returned from the parsed record!
2017-08-10 12:59:12,262 [DEBUG] bibtexparser.bparser _parse_records:172: Set the list of entries
[]


@Phyks
Copy link
Collaborator

Phyks commented Aug 11, 2017

Looks like a duplicate of #176.

Could you try and confirm with master branch please?

Thanks

@devmessias
Copy link
Author

The source code from master branch worked. :)

@Phyks
Copy link
Collaborator

Phyks commented Aug 11, 2017

Nice! A new pip releases should come out soon! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants