Skip to content

Commit 2293b4e

Browse files
committed
Format markdown in clarifications export correctly.
Fixes #2362.
1 parent 1f4cc32 commit 2293b4e

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

webapp/templates/jury/export/clarifications.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<tr>
9595
<td><b>Content</b></td>
9696
<td colspan="5">
97-
<pre>{{ clarification.body | wrapUnquoted(80) }}</pre>
97+
<div class="card-text">{{ clarification.body | markdown_to_html | sanitize_html('app.clarification_sanitizer') }}</div>
9898
</td>
9999
</tr>
100100
{% if clarification.replies is not empty %}
@@ -110,7 +110,7 @@
110110
</b>
111111
</td>
112112
<td colspan="5">
113-
<pre>{{ reply.body | wrapUnquoted(80) }}</pre>
113+
<div class="card-text">{{ reply.body | markdown_to_html | sanitize_html('app.clarification_sanitizer') }}</div>
114114
</td>
115115
</tr>
116116
{% endfor %}

webapp/templates/jury/export/layout.html.twig

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,30 @@
8282
padding-top: 2rem;
8383
}
8484
85+
code {
86+
font-size: .875em;
87+
color: rgb(214, 51, 132);
88+
word-wrap: break-word;
89+
}
90+
8591
pre {
92+
border-top: 1px dotted #C0C0C0;
93+
border-bottom: 1px dotted #C0C0C0;
94+
background-color: #FAFAFA;
8695
margin: 0;
87-
white-space: pre-wrap;
96+
padding: 5px;
97+
font-family: monospace;
98+
white-space: pre;
99+
}
100+
101+
pre > code {
102+
color: inherit;
103+
}
104+
105+
blockquote {
106+
border-left: darkgrey solid .2em;
107+
padding-left: .5em;
108+
color: darkgrey;
88109
}
89110
</style>
90111
</head>

webapp/tests/Unit/Controller/Jury/ImportExportControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ public function testClarificationsHtmlExport(): void
179179
self::assertSelectorExists('h1:contains("Clarifications for Demo contest")');
180180
self::assertSelectorExists('td:contains("Example teamname")');
181181
self::assertSelectorExists('td:contains("A: Hello World")');
182-
self::assertSelectorExists('pre:contains("Is it necessary to read the problem statement carefully?")');
183-
self::assertSelectorExists('pre:contains("Lunch is served")');
182+
self::assertSelectorExists('div:contains("Is it necessary to read the problem statement carefully?")');
183+
self::assertSelectorExists('div:contains("Lunch is served")');
184184
}
185185

186186
/**

0 commit comments

Comments
 (0)