From 9738e1624cb9beb8b691902a5e3a5c9d16f7c0be Mon Sep 17 00:00:00 2001 From: Michael Mumford Date: Sun, 23 Nov 2025 14:02:10 +1000 Subject: [PATCH 1/2] Fix issue #37 with spacing at the front of the variable. --- R/parse_bibtex.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/parse_bibtex.R b/R/parse_bibtex.R index 1c90ea4..76854d7 100644 --- a/R/parse_bibtex.R +++ b/R/parse_bibtex.R @@ -7,11 +7,11 @@ parse_bibtex <- function(x){ # use `unglue` to parse text # 1. Matching reference to the type of reference (e.g. article) # 2. Matches each of the variables to their corresponding values - # - Allows zero or more spaces around the equals sign `=` + # - Allows zero or more spaces around the equals sign # - Comma at the end is optional raw_df <- unglue_data(x, patterns = c("@[variable]{[value],", - "[variable][=\\s*=\\s*]{[value]}[=,?]"), + "[=\\s*][variable][=\\s*=\\s*]{[value]}[=,?]"), open = "[", close = "]") From 888a233b561f95149011f22f95cd903168afd727 Mon Sep 17 00:00:00 2001 From: Michael Mumford Date: Sun, 23 Nov 2025 14:08:53 +1000 Subject: [PATCH 2/2] Added comment to explain the white space at front. --- R/parse_bibtex.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/parse_bibtex.R b/R/parse_bibtex.R index 76854d7..4081814 100644 --- a/R/parse_bibtex.R +++ b/R/parse_bibtex.R @@ -7,6 +7,7 @@ parse_bibtex <- function(x){ # use `unglue` to parse text # 1. Matching reference to the type of reference (e.g. article) # 2. Matches each of the variables to their corresponding values + # - Removes any white space out the front of the variable name # - Allows zero or more spaces around the equals sign # - Comma at the end is optional raw_df <- unglue_data(x,