Skip to content

Commit

Permalink
Fix regex to handle multiple italic parts in BibLaTeX.js
Browse files Browse the repository at this point in the history
This solves zotero#1033.
  • Loading branch information
zuphilip committed Dec 15, 2019
1 parent eac96f3 commit 342b1ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BibLaTeX.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ function mapHTMLmarkup(characters) {
// converts the HTML markup allowed in Zotero for rich text to TeX
// since < and > have already been escaped, we need this rather hideous code - I couldn't see a way around it though.
// italics and bold
characters = characters.replace(/\{\\textless\}i\{\\textgreater\}(((?!\{\\textless\}\/i{\\textgreater\}).)+)\{\\textless\}\/i{\\textgreater\}/, "\\textit{$1}").replace(/\{\\textless\}b\{\\textgreater\}(((?!\{\\textless\}\/b{\\textgreater\}).)+)\{\\textless\}\/b{\\textgreater\}/g, "\\textbf{$1}");
characters = characters.replace(/\{\\textless\}i\{\\textgreater\}(((?!\{\\textless\}\/i{\\textgreater\}).)+)\{\\textless\}\/i{\\textgreater\}/g, "\\textit{$1}").replace(/\{\\textless\}b\{\\textgreater\}(((?!\{\\textless\}\/b{\\textgreater\}).)+)\{\\textless\}\/b{\\textgreater\}/g, "\\textbf{$1}");
// sub and superscript
characters = characters.replace(/\{\\textless\}sup\{\\textgreater\}(((?!\{\\textless\}\/sup\{\\textgreater\}).)+)\{\\textless\}\/sup{\\textgreater\}/g, "$^{\\textrm{$1}}$").replace(/\{\\textless\}sub\{\\textgreater\}(((?!\{\\textless\}\/sub\{\\textgreater\}).)+)\{\\textless\}\/sub\{\\textgreater\}/g, "$_{\\textrm{$1}}$");
// two variants of small caps
Expand Down

0 comments on commit 342b1ea

Please sign in to comment.