Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scribble-lib/scriblib/bibtex.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
ip))
(match (peek-char ip)
[#\{
(string-append first-part (read-value ip) (loop))]
(string-append first-part (read-braced-value ip) (loop))]
[#\}
(read-char ip)
first-part])))
Expand Down
16 changes: 16 additions & 0 deletions scribble-test/tests/scriblib/test-braced-space.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@article{test-braced1,
title = {Advances in {ACM} Technology},
journal = {Proceedings of the {IEEE} Conference},
year = {2020}
}

@article{test-braced2,
title = {The {ACM} Framework},
year = {2021}
}

@inproceedings{test-braced3,
title = {Testing {SIGPLAN} Methods},
booktitle = {International {ACM} Conference},
year = {2022}
}
21 changes: 21 additions & 0 deletions scribble-test/tests/scriblib/test-braced-space.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#lang racket
(require scriblib/bibtex
racket/runtime-path
rackunit)

(define-runtime-path test.bib "test-braced-space.bib")

(define db (path->bibdb test.bib))
(define raw (bibdb-raw db))

;; Test that spaces after braced strings are preserved
(test-case "braced strings should preserve following spaces"
(define test1 (hash-ref raw "test-braced1"))
(define test2 (hash-ref raw "test-braced2"))
(define test3 (hash-ref raw "test-braced3"))

(check-equal? (hash-ref test1 "title") "Advances in ACM Technology")
(check-equal? (hash-ref test1 "journal") "Proceedings of the IEEE Conference")
(check-equal? (hash-ref test2 "title") "The ACM Framework")
(check-equal? (hash-ref test3 "title") "Testing SIGPLAN Methods")
(check-equal? (hash-ref test3 "booktitle") "International ACM Conference"))