Commit 2c93b719 authored by User expired's avatar User expired
Browse files

bib-format: Fix line wrapping (iteration and commas)

* Fix jumping back to label to process more than two lines.
* Take care of trailing commas that do not end the entry.
parent 4e162988
Pipeline #50907 passed with stage
in 1 minute and 23 seconds
......@@ -69,8 +69,8 @@ function merge_lines() { # merge_lines bibfilename
s/{[\n \t]*/{/ # At left curly bracket remove newline and whitespace.
s/[ \t]*\n[ \t]*}/}/ # At right curly bracket remove whitespace and newline.
s/[ \t]*\n[ \t]*/ /g # At other places replace space+newline by single space.
/[^},]$/N # If bib field is still incomplete, append next line.
//ba # Go to label a to repeat this for multiple-line fields.
/[^},]$/{N;ba} # If bib field is incomplete, append line and jump to :a.
/^[^@]*[^}],$/{N;ba} # If bib field is incomplete, append line and jump to :a.
/ *\(},*\)$/s//\1/ # Remove whitespace before trailing curly bracket.
/}$/{N;s/\n *,/,/} # Remove newline between trailing curly bracket and comma.
' "$1"
......@@ -157,7 +157,6 @@ do
# Merge lines.
merge_lines "$tmpfile"
merge_lines "$tmpfile"
if [ "$EDITVALUES" ]
then
......
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