Skip to content

Commit 49e01d8

Browse files
committed
Handle Nicky his remark
1 parent 68c8189 commit 49e01d8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function getFilters(): array
125125
new TwigFilter('medalType', $this->awards->medalType(...)),
126126
new TwigFilter('numTableActions', $this->numTableActions(...)),
127127
new TwigFilter('extensionToMime', $this->extensionToMime(...)),
128-
new TwigFilter('domjudge_markdown_to_html', $this->domjudgeMarkdownToHTML(...), ['is_safe' => ['html']]),
128+
new TwigFilter('domjudgeMarkdownToHtml', $this->domjudgeMarkdownToHTML(...), ['is_safe' => ['html']]),
129129
];
130130
}
131131

@@ -1409,6 +1409,10 @@ public function extensionToMime(string $extension): string
14091409
return DOMJudgeService::EXTENSION_TO_MIMETYPE[$extension];
14101410
}
14111411

1412+
/**
1413+
* Extract all LaTeX code from the given string, sanitize the markdown and
1414+
* inject the original LaTeX code back so MathJax can render it.
1415+
*/
14121416
public function domjudgeMarkdownToHTML(string $markdown): string
14131417
{
14141418
$latexFound = [];

webapp/templates/jury/clarification.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
<div style="height: 100px;"></div>
2323
<div>Pure body:<br>{{ clar.body }}</div>
2424
<div>Markdown converted:<br>{{ clar.body | markdown_to_html }}</div>
25-
<div>DOMjudge Markdown converted:<br>{{ clar.body | domjudge_markdown_to_html }}</div>
25+
<div>DOMjudge Markdown converted:<br>{{ clar.body | domjudgeMarkdownToHtml }}</div>
2626
<div>Sanitized:<br>{{ clar.body | sanitize_html('app.clarification_sanitizer') }}</div>
27-
<div>All:<br>{{ clar.body | domjudge_markdown_to_html | sanitize_html('app.clarification_sanitizer') }}</div>
28-
<div>DOMjudge all:<br>{{ clar.body | domjudge_markdown_to_html | sanitize_html('app.clarification_sanitizer') }}</div>
27+
<div>All:<br>{{ clar.body | domjudgeMarkdownToHtml | sanitize_html('app.clarification_sanitizer') }}</div>
28+
<div>DOMjudge all:<br>{{ clar.body | domjudgeMarkdownToHtml | sanitize_html('app.clarification_sanitizer') }}</div>
2929
<div class="card mb-3 {% if clar.from_team is not defined %}border-primary{% endif %}">
3030
<div class="card-header">
3131
<div class="row">

0 commit comments

Comments
 (0)