Commit 278e238c authored by User expired's avatar User expired
Browse files

Fix to check if " closes the entry or a substring

parent 58a9ffa5
Pipeline #40160 passed with stage
in 1 minute and 24 seconds
......@@ -40,7 +40,14 @@ function replace_quotes() { # replace_quotes bibfile
s/^ ([A-Za-z][A-Za-z_-]*) = "/ \1 = {/ # Replace opening quote by {.
T # End here if there was no replacement.
:a # Label with name a.
h # Keep a copy of the line (hold space).
s/"[^"]*"//g # Remove all quote pairs to get the modulo 2.
tb;:b # Go to label b to disregard previous substitution.
s/"// # In case of odd number of quotes, remove the last.
g # Restore the line from copy (hold space).
Tc # In case of even number go to label c.
s/" *(,?)$/}\1/ # Replace closing quote by }.
:c # Label with name c to skip previous line.
t # End here if replacement was successful.
N # Append next line to search closing quote.
ba # Go to label a to repeat search.
......
......@@ -206,11 +206,10 @@ line text
and no comma",' > $fileOne
bib-format $fileOne
assertEquals ' Field = {Two lines and no comma},' "$(cat $fileOne)"
# FIXME: Multiple " quoted lines with inner quote at end of line are broken.
# echo ' Field = "remaining "problem"
# here",' > $fileOne
# bib-format $fileOne
# assertEquals ' Field = {remaining "problem" here},' "$(cat $fileOne)"
echo ' Field = "inner "quotes"
here",' > $fileOne
bib-format $fileOne
assertEquals ' Field = {inner "quotes" here},' "$(cat $fileOne)"
}
testCurlyBracketsInField() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment