summaryrefslogtreecommitdiffstats
path: root/templates/repo/unicode_escape_prompt.tmpl
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-01-07 01:18:52 +0000
committerGitHub <noreply@github.com>2022-01-07 02:18:52 +0100
commit21ed4fd8da4c8992518dcfb01aa7306f7406f735 (patch)
treeeb0bdaed8d06849116818f058b6120633d329d69 /templates/repo/unicode_escape_prompt.tmpl
parentee60f27aec0f75a34ae62841ed52579c0c20dcfa (diff)
downloadgitea-21ed4fd8da4c8992518dcfb01aa7306f7406f735.tar.gz
gitea-21ed4fd8da4c8992518dcfb01aa7306f7406f735.zip
Add warning for BIDI characters in page renders and in diffs (#17562)
Fix #17514 Given the comments I've adjusted this somewhat. The numbers of characters detected are increased and include things like the use of U+300 to make à instead of à and non-breaking spaces. There is a button which can be used to escape the content to show it. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Gwyneth Morgan <gwymor@tilde.club> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates/repo/unicode_escape_prompt.tmpl')
-rw-r--r--templates/repo/unicode_escape_prompt.tmpl17
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl
new file mode 100644
index 0000000000..d45df012e1
--- /dev/null
+++ b/templates/repo/unicode_escape_prompt.tmpl
@@ -0,0 +1,17 @@
+{{if .EscapeStatus.BadBIDI}}
+<div class="ui error message unicode-escape-prompt">
+ <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span>
+ <div class="header">
+ {{$.root.i18n.Tr "repo.bidi_bad_header"}}
+ </div>
+ <p>{{$.root.i18n.Tr "repo.bidi_bad_description" | Str2html}}</p>
+</div>
+{{else if .EscapeStatus.Escaped}}
+<div class="ui warning message unicode-escape-prompt">
+ <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span>
+ <div class="header">
+ {{$.root.i18n.Tr "repo.unicode_header"}}
+ </div>
+ <p>{{$.root.i18n.Tr "repo.unicode_description" | Str2html}}</p>
+</div>
+{{end}}