Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-25 19:26:09 +01:00
forgejo/templates
zeripath 6e22605793
Ensure that plain files are rendered correctly even when containing ambiguous characters (#22017)
As recognised in #21841 the rendering of plain text files is somewhat
incorrect when there are ambiguous characters as the html code is double
escaped. In fact there are several more problems here.

We have a residual isRenderedHTML which is actually simply escaping the
file - not rendering it. This is badly named and gives the wrong
impression.

There is also unusual behaviour whether the file is called a Readme or
not and there is no way to get to the source code if the file is called
README.

In reality what should happen is different depending on whether the file
is being rendered a README at the bottom of the directory view or not.

1. If it is rendered as a README on a directory - it should simply be
escaped and rendered as `<pre>` text.
2. If it is rendered as a file then it should be rendered as source
code.

This PR therefore does:
1. Rename IsRenderedHTML to IsPlainText
2. Readme files rendered at the bottom of the directory are rendered
without line numbers
3. Otherwise plain text files are rendered as source code.

Replace #21841

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-12-17 22:22:25 +02:00
..
admin Fix sorting admin user list by last login (#22081) 2022-12-11 18:00:17 -06:00
api/packages/pypi Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00
base Optimize html templates (#22080) 2022-12-09 21:34:51 +08:00
code Run make fmt (#21437) 2022-10-13 21:33:54 -04:00
custom Add footer extra links template (#9576) 2020-01-03 20:41:56 +02:00
explore Optimize html templates (#22080) 2022-12-09 21:34:51 +08:00
mail Add team member invite by email (#20307) 2022-10-19 14:40:28 +02:00
org Rename almost all Ctx functions (#22071) 2022-12-10 10:46:31 +08:00
package Add package registry cleanup rules (#21658) 2022-11-20 16:08:38 +02:00
repo Ensure that plain files are rendered correctly even when containing ambiguous characters (#22017) 2022-12-17 22:22:25 +02:00
shared Timeline and color tweaks (#21799) 2022-11-19 12:02:30 +08:00
status Remove fomantic image module (#21145) 2022-09-12 17:08:46 +08:00
swagger Add API management for issue/pull and comment attachments (#21783) 2022-12-09 14:35:56 +08:00
user Fix margin and alignment in dashboard repolist (#22120) 2022-12-17 09:58:57 +08:00
home.tmpl fix(web): add alt for logo in home page (#21887) 2022-11-21 15:09:55 -05:00
install.tmpl Clean up formatting on install page (#21668) 2022-11-03 20:41:01 +00:00
post-install.tmpl Rename StaticUrlPrefix to AssetUrlPrefix (#15779) 2021-05-08 16:27:25 +02:00