Commit 21105bf7 authored by User expired's avatar User expired
Browse files

bib-format: No double curly brackets around fields

parent e58fad96
......@@ -108,6 +108,9 @@ do
# Remove trailing whitespace within fields.
sed -i 's/ *\(},\?\)$/\1/' "$tmpfile"
# Remove double curly brackets around fields.
sed -i -r 's/^( [A-Za-z]+ = *\{)\{(.*)\}(\}[^}]*)$/\1\2\3/' "$tmpfile"
# Append single blank line.
sed -i '$G' "$tmpfile"
......
......@@ -4,10 +4,10 @@
# Variables for testing.
# Functions to write example contents.
writeFileOne() { # Example for bibtex file provided by the journal.
writeFileOne() { # Example for bibtex file provided by the journal (curly brackets in title added).
echo '@Article{doi:10.1021/acs.jpca.8b08286,'
echo 'author = {Olasz, Balázs and Czakó, Gábor},'
echo 'title = {Mode-Specific Quasiclassical Dynamics of the F– + CH3I SN2 and Proton-Transfer Reactions},'
echo 'title = {{Mode-Specific Quasiclassical Dynamics of the F– + CH3I {SN2} and Proton-Transfer Reactions}},'
echo 'journal = {The Journal of Physical Chemistry A},'
echo 'volume = {122},'
echo 'number = 41,'
......@@ -32,7 +32,7 @@ writeFileOne() { # Example for bibtex file provided by the journal.
writeFileTwo() { # Same bibtex file after structural formatting.
echo '@Article{doi:10.1021/acs.jpca.8b08286,'
echo ' Author = {Olasz, Balázs and Czakó, Gábor},'
echo ' Title = {Mode-Specific Quasiclassical Dynamics of the F– + CH3I SN2 and Proton-Transfer Reactions},'
echo ' Title = {Mode-Specific Quasiclassical Dynamics of the F– + CH3I {SN2} and Proton-Transfer Reactions},'
echo ' Journal = {The Journal of Physical Chemistry A},'
echo ' Volume = {122},'
echo ' Number = {41},'
......@@ -51,7 +51,7 @@ writeFileTwo() { # Same bibtex file after structural formatting.
writeFileThree() { # Completely formatted file.
echo '@Article{doi:10.1021/acs.jpca.8b08286,'
echo " Author = {Olasz, Bal\\'{a}zs and Czak\\'{o}, G\\'{a}bor},"
echo ' Title = {Mode-Specific Quasiclassical Dynamics of the F- + CH3I SN2 and Proton-Transfer Reactions},'
echo ' Title = {Mode-Specific Quasiclassical Dynamics of the F- + CH3I {SN2} and Proton-Transfer Reactions},'
echo ' Journal = {Journal of Physical Chemistry A},'
echo ' Volume = {122},'
echo ' Number = {41},'
......@@ -157,6 +157,12 @@ testCurlyBracketsInField() {
echo ' Field = {some {More} text}' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some {More} text}' "$(cat $fileOne)"
echo ' Field = "{some {More} text}"' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some {More} text}' "$(cat $fileOne)"
echo ' Field = {{some {More} text}}' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some {More} text}' "$(cat $fileOne)"
}
testMergLines() {
......
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