-
- Notifications
You must be signed in to change notification settings - Fork 6.2k
Render plain text README.txt monospaced #2721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
32f3d8c acaf4b3 5aca5a8 d5c9771 5bb8520 5532db8 fe00f80 030ae40 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -195,6 +195,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st | |
| ctx.Data["ReadmeExist"] = readmeExist | ||
| if markup.Type(blob.Name()) != "" { | ||
| ctx.Data["IsRenderedHTML"] = true | ||
| ctx.Data["IsMarkup"] = true | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please look for other places with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done | ||
| ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas())) | ||
| } else if readmeExist { | ||
| ctx.Data["IsRenderedHTML"] = true | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -38,7 +38,11 @@ | |
| <div class="ui attached table segment"> | ||
| <div class="file-view {{if .IsRenderedHTML}}markdown{{else if .IsTextFile}}code-view{{end}} has-emoji"> | ||
| ||
| {{if .IsRenderedHTML}} | ||
| {{if .FileContent}}{{.FileContent | Str2html}}{{end}} | ||
| {{if .IsMarkup}} | ||
| {{if .FileContent}}{{.FileContent | Str2html}}{{end}} | ||
| {{else}} | ||
| <pre>{{if .FileContent}}{{.FileContent | Str2html}}{{end}}</pre> | ||
| ||
| {{end}} | ||
| {{else if not .IsTextFile}} | ||
| <div class="view-raw ui center"> | ||
| {{if .IsImageFile}} | ||
| | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.Data["IsRenderedHTML"] = truecan be removed (check other places, same asmarkup.Type) ifctx.Data["IsMarkup"] = trueis set, then you can remove nestediffrom template and useelse if.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where should I remove the
ifin template? (Could you provide a Line?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/go-gitea/gitea/pull/2721/files#diff-2ec327528ed2be8dd3c2201ef8e6a42cR40