mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-29 10:54:02 -05:00
Merge pull request '[GITEA]: Render status of list items for Org mode' (#1071) from Gusted/forgejo:org-mode-li-status into forgejo-dependency
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1071
This commit is contained in:
commit
ec9b2c47db
3 changed files with 31 additions and 0 deletions
|
@ -87,6 +87,9 @@ func createDefaultPolicy() *bluemonday.Policy {
|
||||||
// Allow classes for task lists
|
// Allow classes for task lists
|
||||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list-item`)).OnElements("li")
|
policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list-item`)).OnElements("li")
|
||||||
|
|
||||||
|
// Allow classes for org mode list item status.
|
||||||
|
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^(unchecked|checked|indeterminate)$`)).OnElements("li")
|
||||||
|
|
||||||
// Allow icons
|
// Allow icons
|
||||||
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i")
|
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i")
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,11 @@ func Test_Sanitizer(t *testing.T) {
|
||||||
`<p style="bad-color: red">Hello World</p>`, `<p>Hello World</p>`,
|
`<p style="bad-color: red">Hello World</p>`, `<p>Hello World</p>`,
|
||||||
`<code style="bad-color: red">Hello World</code>`, `<code>Hello World</code>`,
|
`<code style="bad-color: red">Hello World</code>`, `<code>Hello World</code>`,
|
||||||
|
|
||||||
|
// Org mode status of list items.
|
||||||
|
`<li class="checked"></li>`, `<li class="checked"></li>`,
|
||||||
|
`<li class="unchecked"></li>`, `<li class="unchecked"></li>`,
|
||||||
|
`<li class="indeterminate"></li>`, `<li class="indeterminate"></li>`,
|
||||||
|
|
||||||
// URLs
|
// URLs
|
||||||
`[my custom URL scheme](cbthunderlink://somebase64string)`, `[my custom URL scheme](cbthunderlink://somebase64string)`,
|
`[my custom URL scheme](cbthunderlink://somebase64string)`, `[my custom URL scheme](cbthunderlink://somebase64string)`,
|
||||||
`[my custom URL scheme](matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join)`, `[my custom URL scheme](matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join)`,
|
`[my custom URL scheme](matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join)`, `[my custom URL scheme](matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join)`,
|
||||||
|
|
|
@ -556,3 +556,26 @@
|
||||||
border-top-left-radius: 0 !important;
|
border-top-left-radius: 0 !important;
|
||||||
border-top-right-radius: 0 !important;
|
border-top-right-radius: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.file-view.markup.orgmode li.unchecked::before {
|
||||||
|
content: '[ ] ';
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-view.markup.orgmode li.checked::before {
|
||||||
|
content: '[x] ';
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-view.markup.orgmode li.indeterminate::before {
|
||||||
|
content: '[-] ';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is only needed for <p> because they are literally acting as paragraphs,
|
||||||
|
* and thus having an ::before on the same line would force the paragraph to
|
||||||
|
* move to the next line. This can be avoided by an inline-block display that
|
||||||
|
* avoids that property while still having the other properties of the block
|
||||||
|
* display. */
|
||||||
|
.file-view.markup.orgmode li.unchecked > p,
|
||||||
|
.file-view.markup.orgmode li.checked > p,
|
||||||
|
.file-view.markup.orgmode li.indeterminate > p {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue