From e0e30372ef327cd889d04e46ddd91b6e5878eaa1 Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 2 Apr 2018 15:57:24 +1200 Subject: [PATCH] add [youtube] tag support --- bbcode.go | 6 ++++++ rFormatting.go | 1 + 2 files changed, 7 insertions(+) diff --git a/bbcode.go b/bbcode.go index cb1fea1..3b26dff 100644 --- a/bbcode.go +++ b/bbcode.go @@ -61,6 +61,12 @@ func (this *BBCodeRenderer) bbcode(data string) string { nil, }, + pregReplaceRule{ + regexp.MustCompile(`(?si)\[youtube](.*?)\[/youtube\]`), + ``, + nil, + }, + pregReplaceRule{regexp.MustCompile(`(?si)\[section=(.*?)](.*?)\[/section\]`), "", func(m []string) string { return `
` + m[1] + `` + strings.TrimSpace(m[2]) + `
` }}, diff --git a/rFormatting.go b/rFormatting.go index 569fca2..2432c89 100644 --- a/rFormatting.go +++ b/rFormatting.go @@ -33,6 +33,7 @@ func (this *WikiServer) routeFormatting(w http.ResponseWriter, r *http.Request) content += `
  • [code]fixed width[/code]
  • [section=header]content[/section]
  • +
  • [youtube]id[/youtube]
  • [html]raw html[/html]
  • `