Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ionen-angewandte-physik
AG-Wester
bibtools
Commits
13c7cfd4
Commit
13c7cfd4
authored
Jan 13, 2021
by
User expired
Browse files
Multi line tests and fix for '{' at end of line
parent
8e84bf91
Pipeline
#40141
failed with stage
in 54 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
bin/bib-format
bin/bib-format
+2
-1
test/bib-format_test
test/bib-format_test
+28
-1
No files found.
bin/bib-format
View file @
13c7cfd4
...
...
@@ -37,8 +37,9 @@ done
# Function to merge lines.
function
merge_lines
()
{
# merge_lines bibfilename
sed
-i
':a # Label with name a.
/{$/s//& / # Blank to match opening bracket at line end in the next row.
/^ [A-Z][a-z]* = {.*[^},]$/N # If bib field is incomplete, append next line.
s/{\n
[
\t]*/{/ # At left curly bracket remove newline and whitespace.
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.
...
...
test/bib-format_test
View file @
13c7cfd4
...
...
@@ -229,11 +229,38 @@ testCurlyBracketsInField() {
assertEquals
' Field = {start text {end}}'
"
$(
cat
$fileOne
)
"
}
testMergLines
()
{
testMergeLinesWithBraces
()
{
# Simple one
echo
' Field = {some
text}'
>
$fileOne
bib-format
$fileOne
assertEquals
' Field = {some text}'
"
$(
cat
$fileOne
)
"
# Brackets with own line
echo
' Field = {
some text
},'
>
$fileOne
bib-format
$fileOne
assertEquals
' Field = {some text},'
"
$(
cat
$fileOne
)
"
# Only first line without content
echo
' Field = {
some text},'
>
$fileOne
bib-format
$fileOne
assertEquals
' Field = {some text},'
"
$(
cat
$fileOne
)
"
# Over three lines
echo
' Field = {some
text over
three lines }'
>
$fileOne
bib-format
$fileOne
assertEquals
' Field = {some text over three lines}'
"
$(
cat
$fileOne
)
"
# Within a record
echo
'@Article{,
Field = {some
text}
}'
>
$fileOne
bib-format
$fileOne
assertEquals
'@Article{,
Field = {some text}
}'
"
$(
cat
$fileOne
)
"
}
testUnchangedUrls
()
{
...
...
User expired
@c7441202
mentioned in commit
6ea8d2bb
·
Jan 13, 2021
mentioned in commit
6ea8d2bb
mentioned in commit 6ea8d2bbba478a8ad43dea93f26972c6cfda87e6
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment