Skip to content

Commit 398019b

Browse files
committed
restore special LaTeX chars in author names, and escape special HTML chars
1 parent 4df10a8 commit 398019b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/utils.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,11 @@ add_citation = function(x, bib, format = 'html') {
539539
}
540540

541541
# fall back to given name if family name is empty
542-
author_name = function(x) paste(x$family %|% x$given, collapse = ' ')
542+
author_name = function(x) {
543+
a = paste(x$family %|% x$given, collapse = ' ')
544+
a = gsub('\\{\\\\(.)}', '\\1', a) # un-escape special latex chars
545+
html_escape(a)
546+
}
543547

544548
# mimic natbib's author-year citation style for HTML output
545549
cite_html = function(keys, bib, bracket = TRUE) {

0 commit comments

Comments
 (0)