From c9b084cf747e1e06ca60bdefccfadf742617180b Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 14 Nov 2019 14:32:54 +0100 Subject: [PATCH] AsciiDoc-Gitea article: Updated Gitea-patch to 1.10.0. --- content/posts/using-asciidoc-with-gitea.adoc | 46 ++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/content/posts/using-asciidoc-with-gitea.adoc b/content/posts/using-asciidoc-with-gitea.adoc index 6255601..b7f5dc2 100644 --- a/content/posts/using-asciidoc-with-gitea.adoc +++ b/content/posts/using-asciidoc-with-gitea.adoc @@ -10,7 +10,7 @@ tags: In this blogpost I describe what I did to get AsciiDoc support into https://gitea.io/[Gitea]. If you want more than syntax highlighting and basic -formatting, Gitea has to be patched unfortunately(this +formatting, Gitea has to be patched unfortunately(this https://github.com/go-gitea/gitea/issues/4935[issue] has already been reported). But I think most people will only need to edit 1 configuration file and are done. @@ -67,25 +67,29 @@ and the `class` exception is only useful if you add custom CSS to use them. Apply the patch with `patch -p1 < gitea_relax-sanitizer.patch`. ---- -{{< highlight diff >}}diff -ur a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go ---- a/modules/markup/sanitizer.go 2019-01-26 16:04:56.014108339 +0100 -+++ b/modules/markup/sanitizer.go 2019-01-26 16:03:21.776401012 +0100 -@@ -38,6 +38,16 @@ +{{< highlight diff >}} +diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go +index fd6f90b2a..ae11811b6 100644 +--- a/modules/markup/sanitizer.go ++++ b/modules/markup/sanitizer.go +@@ -41,5 +41,16 @@ func NewSanitizer() { - // Custom URL-Schemes - sanitizer.policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...) -+ // Allow style on span tags -+ sanitizer.policy.AllowAttrs("style").Matching(regexp.MustCompile(`^(background-)?color:[^;]+(; ?font[^;]+)?;?$`)).OnElements("span") + // Allow keyword markup + sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^` + keywordClass + `$`)).OnElements("span") + -+ // Allow class attribute -+ sanitizer.policy.AllowAttrs("class").OnElements("code", "pre", "span", "div", "p", "table", "td") ++ // Allow style on span tags ++ sanitizer.policy.AllowAttrs("style").Matching(regexp.MustCompile(`^(background-)?color:[^;]+(; ?font[^;]+)?;?$`)).OnElements("span") + -+ // Allow table attributes -+ sanitizer.policy.AllowAttrs("width", "frame", "rules", "cellspacing", "cellpadding").OnElements("table") -+ sanitizer.policy.AllowAttrs("width").OnElements("col") -+ sanitizer.policy.AllowAttrs("align", "valign").OnElements("td") - }) - }{{< / highlight >}} ++ // Allow class attribute ++ sanitizer.policy.AllowAttrs("class").OnElements("code", "pre", "span", "div", "p", "table", "td") ++ ++ // Allow table attributes ++ sanitizer.policy.AllowAttrs("width", "frame", "rules", "cellspacing", "cellpadding").OnElements("table") ++ sanitizer.policy.AllowAttrs("width").OnElements("col") ++ sanitizer.policy.AllowAttrs("align", "valign").OnElements("td") + }) + } +{{< / highlight >}} ---- == Tables without borders @@ -109,3 +113,11 @@ In your Gitea directory, create `custom/templates/custom/header.tmpl`. } {{< / highlight >}} ---- + +== Updates + +* 2019-11-14: Updated Gitea patch for 1.10.0. + +// Local Variables: +// no-ws-cleanup: t +// End: