Skip to content

Commit

Permalink
commons: replace < with &lt; in summaries to handle HTML comments…
Browse files Browse the repository at this point in the history
… and tags
  • Loading branch information
siddharthvp committed Nov 23, 2023
1 parent 8de463b commit fd10c72
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions reports/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ function formatSummary(text) {
return '';
}
return text
// Ensure HTML comments are displayed as-is, and <div> and other tags don't render
.replace(/</g, '&lt;')

.replace(/\{\{.*?\}\}/g, '<nowiki>$&</nowiki>')
.replace(/\[\[((?:Category|File|Image):.*?)\]\]/gi, '[[:$1]]')
.replace(/~{3,5}/g, '<nowiki>$&</nowiki>');
Expand Down

0 comments on commit fd10c72

Please sign in to comment.