]> source.dussan.org Git - gitea.git/commitdiff
Fix over-escaped characters (#2992)
authorEthan Koenig <ethantkoenig@gmail.com>
Mon, 27 Nov 2017 05:01:13 +0000 (21:01 -0800)
committerLauris BH <lauris@nix.lv>
Mon, 27 Nov 2017 05:01:13 +0000 (07:01 +0200)
modules/templates/helper.go
templates/repo/issue/list.tmpl
templates/repo/issue/milestones.tmpl
templates/repo/issue/view_content/sidebar.tmpl
templates/repo/wiki/view.tmpl

index ae2efc25859c2e75c48140ac6c67a00643565ffd..67ef1f7b4b59216c5e351983a6d43e0c60bfc472 100644 (file)
@@ -16,16 +16,15 @@ import (
        "strings"
        "time"
 
-       "github.com/microcosm-cc/bluemonday"
-       "golang.org/x/net/html/charset"
-       "golang.org/x/text/transform"
-       "gopkg.in/editorconfig/editorconfig-core-go.v1"
-
        "code.gitea.io/gitea/models"
        "code.gitea.io/gitea/modules/base"
        "code.gitea.io/gitea/modules/log"
        "code.gitea.io/gitea/modules/markup"
        "code.gitea.io/gitea/modules/setting"
+
+       "golang.org/x/net/html/charset"
+       "golang.org/x/text/transform"
+       "gopkg.in/editorconfig/editorconfig-core-go.v1"
 )
 
 // NewFuncMap returns functions for injecting to templates
@@ -67,7 +66,6 @@ func NewFuncMap() []template.FuncMap {
                "AvatarLink":   base.AvatarLink,
                "Safe":         Safe,
                "SafeJS":       SafeJS,
-               "Sanitize":     bluemonday.UGCPolicy().Sanitize,
                "Str2html":     Str2html,
                "TimeSince":    base.TimeSince,
                "RawTimeSince": base.RawTimeSince,
index 2b756cd88ee4c8074dea669438b9a044e9d59a31..7759a2cd620c9cfd513f99ba4ca3400aa8cd7762 100644 (file)
@@ -35,7 +35,7 @@
                                        <div class="menu">
                                                <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
                                                {{range .Labels}}
-                                                       <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | Sanitize}}</a>
+                                                       <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
                                                {{end}}
                                        </div>
                                </div>
@@ -49,7 +49,7 @@
                                        <div class="menu">
                                                <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_milestone_no_select"}}</a>
                                                {{range .Milestones}}
-                                                       <a class="{{if eq $.MilestoneID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&assignee={{$.AssigneeID}}">{{.Name | Sanitize}}</a>
+                                                       <a class="{{if eq $.MilestoneID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&assignee={{$.AssigneeID}}">{{.Name}}</a>
                                                {{end}}
                                        </div>
                                </div>
                                        <div class="menu">
                                                {{range .Labels}}
                                                        <div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
-                                                               <span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | Sanitize}}
+                                                               <span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
                                                        </div>
                                                {{end}}
                                        </div>
                                                </div>
                                                {{range .Milestones}}
                                                        <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/milestone">
-                                                               {{.Name | Sanitize}}
+                                                               {{.Name}}
                                                        </div>
                                                {{end}}
                                        </div>
                                                <a class="ui label" href="{{$.RepoLink}}/src/commit/{{.Ref}}">{{.Ref}}</a>
                                        {{end}}
                                        {{range .Labels}}
-                                               <a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name | Sanitize}}</a>
+                                               <a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
                                        {{end}}
 
                                        {{if .NumComments}}
                                                {{$.i18n.Tr "repo.issues.opened_by" $timeStr .Poster.HomeLink .Poster.Name | Safe}}
                                                {{if .Milestone}}
                                                        <a class="milestone" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.Milestone.ID}}&assignee={{$.AssigneeID}}">
-                                                               <span class="octicon octicon-milestone"></span> {{.Milestone.Name | Sanitize}}
+                                                               <span class="octicon octicon-milestone"></span> {{.Milestone.Name}}
                                                        </a>
                                                {{end}}
                                                {{if .Assignee}}
index 1cce9169d7e870ad9b83ebf0b2100c2c9fa69f37..3703301e19d2729b444d327b1c340548691c82a9 100644 (file)
@@ -43,7 +43,7 @@
                <div class="milestone list">
                        {{range .Milestones}}
                                <li class="item">
-                                       <i class="octicon octicon-milestone"></i> <a href="{{$.RepoLink}}/issues?state={{$.State}}&milestone={{.ID}}">{{.Name | Sanitize}}</a>
+                                       <i class="octicon octicon-milestone"></i> <a href="{{$.RepoLink}}/issues?state={{$.State}}&milestone={{.ID}}">{{.Name}}</a>
                                        <div class="ui right green progress" data-percent="{{.Completeness}}">
                                                <div class="bar" {{if not .Completeness}}style="background-color: transparent"{{end}}>
                                                        <div class="progress"></div>
index 079c6f52ab80ae2e0b0fcbb69edff2ae8cedc25a..23fd91b0bd833ac36f35663487d48ecfe55c7f46 100644 (file)
@@ -18,7 +18,7 @@
                        <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
                        {{range .Labels}}
                                <div class="item">
-                                       <a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name | Sanitize}}</a>
+                                       <a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
                                </div>
 
                        {{end}}
@@ -40,7 +40,7 @@
                                                {{.i18n.Tr "repo.issues.new.open_milestone"}}
                                        </div>
                                        {{range .OpenMilestones}}
-                                               <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name | Sanitize}}</div>
+                                               <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
                                        {{end}}
                                {{end}}
                                {{if .ClosedMilestones}}
@@ -50,7 +50,7 @@
                                                {{.i18n.Tr "repo.issues.new.closed_milestone"}}
                                        </div>
                                        {{range .ClosedMilestones}}
-                                               <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name | Sanitize}}</a>
+                                               <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
                                        {{end}}
                                {{end}}
                        </div>
@@ -59,7 +59,7 @@
                        <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
                        <div class="selected">
                                {{if .Issue.Milestone}}
-                                       <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name | Sanitize}}</a>
+                                       <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
                                {{end}}
                        </div>
                </div>
index 8eab1ac07ba0ae57c045e0257037ad5b9cca3cf8..79f17f5de94c420ad71447b2330be4620b978b0c 100644 (file)
@@ -1,7 +1,7 @@
 {{template "base/head" .}}
 <div class="repository wiki view">
        {{template "repo/header" .}}
-       {{ $title := .title | Sanitize}}
+       {{ $title := .title}}
        <div class="ui container">
                <div class="ui grid">
                        <div class="ui ten wide column">
@@ -21,7 +21,7 @@
                                                        </div>
                                                        <div class="scrolling menu">
                                                                {{range .Pages}}
-                                                                       <div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name | Sanitize}}</div>
+                                                                       <div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</div>
                                                                {{end}}
                                                        </div>
                                                </div>