Skip to content

fix: keep BibTeX quoted values that contain a braced quote - #2158

Open
jayhemnani9910 wants to merge 1 commit into
HKUDS:devfrom
jayhemnani9910:bibtex-quoted-brace-quote
Open

jayhemnani9910 wants to merge 1 commit into
HKUDS:devfrom
jayhemnani9910:bibtex-quoted-brace-quote

Conversation

@jayhemnani9910

Copy link
Copy Markdown

Description

In a quoted BibTeX value, a literal double quote is written inside braces: title = "The {"}Quoted{"} Paper". _read_quoted and the quoted state in _scan_entry end the value at the first ", even inside braces, so the title becomes The and the rest of the entry's fields are lost:

@inproceedings{q2020,
  title = "The {"}Quoted{"} Paper",
  author = "Doe, Jane",
  year = 2020
}

Before: ## 1. The with no authors or year.
After: ## 1. The "Quoted" Paper, **Authors:** Jane Doe, **Year:** 2020.

A quote now ends a quoted value only outside braces, the same rule #1622 applied at the entry's top level.

A regression test is added to tests/utils/test_bibtex_converter.py; it fails on dev and passes with this change.

Related Issues

  • None

Module(s) Affected

  • utils
  • tests

Checklist

  • This PR targets dev (not main — see the base-branch selector above).
  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues. (Ran ruff check and ruff format --check on the changed files, and pytest tests/utils: 143 passed.)

In a quoted BibTeX value a double quote is written inside braces, as in
title = "The {"}Quoted{"} Paper". The converter ended the value at the
first quote, so the title became "The" and the entry lost its remaining
fields. Only end a quoted value at a quote outside braces.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant