chore(ui): remove ineffective class small in inline code preview (#7414)
Followup to https://codeberg.org/forgejo/forgejo/pulls/2669 Ref https://codeberg.org/forgejo/forgejo/issues/5067 Since Forgejo v9 this class is overridden here by other CSS and is ineffective. But it looks ok and gives good visibility. If it needs to be re-implemed, it can be done via CSS, like: ```css .file-preview-box .header span {font-size:0.8rem;} ``` Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7414 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
parent
979cc5cd93
commit
da62c2cac6
3 changed files with 16 additions and 16 deletions
|
@ -341,7 +341,7 @@ func (p *FilePreview) CreateHTML(locale translation.Locale) *html.Node {
|
|||
psubtitle := &html.Node{
|
||||
Type: html.ElementNode,
|
||||
Data: atom.Span.String(),
|
||||
Attr: []html.Attribute{{Key: "class", Val: "text small grey"}},
|
||||
Attr: []html.Attribute{{Key: "class", Val: "text grey"}},
|
||||
}
|
||||
psubtitle.AppendChild(&html.Node{
|
||||
Type: html.RawNode,
|
||||
|
|
|
@ -721,7 +721,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -755,7 +755,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<a href="http://localhost:3000/gogits/gogs/" rel="nofollow">gogits/gogs</a> – `+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">gogits/gogs@190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -791,7 +791,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<a href="http://localhost:3000/gogits/gogs/" rel="nofollow">gogits/gogs</a> – `+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/4c1aaf56bcb9f39dcf65f3f250726850aed13cd6/single-line.txt#L1" class="muted" rel="nofollow">single-line.txt</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Line 1 in <a href="http://localhost:3000/gogits/gogs/src/commit/4c1aaf56bcb9f39dcf65f3f250726850aed13cd6" class="text black" rel="nofollow">gogits/gogs@4c1aaf5</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -834,7 +834,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/sub/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/sub/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -865,7 +865,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/sub/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/sub/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -898,7 +898,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -923,7 +923,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -954,7 +954,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -979,7 +979,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -1004,7 +1004,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -1039,7 +1039,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/c9913120ed2c1e27c1d7752ecdb7a504dc7cf6be/path/to/file.md?display=source#L1-L2" class="muted" rel="nofollow">path/to/file.md</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 1 to 2 in <a href="http://localhost:3000/gogits/gogs/src/commit/c9913120ed2c1e27c1d7752ecdb7a504dc7cf6be" class="text black" rel="nofollow">c991312</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -1072,7 +1072,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/c9913120ed2c1e27c1d7752ecdb7a504dc7cf6be/path/to/file.md?display=source#L1-L2" class="muted" rel="nofollow">path/to/file.md</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 1 to 2 in <a href="http://localhost:3000/gogits/gogs/src/commit/c9913120ed2c1e27c1d7752ecdb7a504dc7cf6be" class="text black" rel="nofollow">c991312</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -1107,7 +1107,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20/path/to/file.go?display=source#L2-L3" class="muted" rel="nofollow">path/to/file.go</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Lines 2 to 3 in <a href="http://localhost:3000/gogits/gogs/src/commit/190d9492934af498c3f669d6a2431dc5459e5b20" class="text black" rel="nofollow">190d949</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
@ -1142,7 +1142,7 @@ func TestRender_FilePreview(t *testing.T) {
|
|||
`<div>`+
|
||||
`<a href="http://localhost:3000/gogits/gogs/src/commit/eeb243c3395e1921c5d90e73bd739827251fc99d/path/to/file%20%23.txt#L1" class="muted" rel="nofollow">path/to/file #.txt</a>`+
|
||||
`</div>`+
|
||||
`<span class="text small grey">`+
|
||||
`<span class="text grey">`+
|
||||
`Line 1 in <a href="http://localhost:3000/gogits/gogs/src/commit/eeb243c3395e1921c5d90e73bd739827251fc99d" class="text black" rel="nofollow">eeb243c</a>`+
|
||||
`</span>`+
|
||||
`</div>`+
|
||||
|
|
|
@ -122,7 +122,7 @@ func createDefaultPolicy() *bluemonday.Policy {
|
|||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^ui table$")).OnElements("div")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^header$")).OnElements("div")
|
||||
policy.AllowAttrs("data-line-number").Matching(regexp.MustCompile("^[0-9]+$")).OnElements("span")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^text small grey$")).OnElements("span")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^text grey$")).OnElements("span")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^file-preview$")).OnElements("table")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^lines-escape$")).OnElements("td")
|
||||
policy.AllowAttrs("class").Matching(regexp.MustCompile("^toggle-escape-button btn interact-bg$")).OnElements("button")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue