mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-11 10:54:34 +02:00
Update AbstractParameter.php (#959)
* Update AbstractParameter.php Make lazy null conditionals explicit. Try to handle LaTeX special chars gracefully. Fixes #958 * Only escape the percentage sign, so that you can still use latex for units * Only escape previously unescaped percentage signs * simplify regex * Render the percentage sign correctly in units in the frontend. --------- Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
This commit is contained in:
parent
00a74ed96a
commit
2226b72d1c
3 changed files with 16 additions and 8 deletions
|
@ -85,7 +85,9 @@ export default class extends Controller
|
|||
tmp += '<span>' + katex.renderToString(data.symbol) + '</span>'
|
||||
}
|
||||
if (data.unit) {
|
||||
tmp += '<span class="ms-2">' + katex.renderToString('[' + data.unit + ']') + '</span>'
|
||||
let unit = data.unit.replace(/%/g, '\\%');
|
||||
unit = "\\mathrm{" + unit + "}";
|
||||
tmp += '<span class="ms-2">' + katex.renderToString('[' + unit + ']') + '</span>'
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue