diff options
author | Wim <wim@42.be> | 2018-02-25 23:54:20 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-02-27 23:22:10 +0100 |
commit | ad6440b603a8df6be8b221c3c91ede68d16c8105 (patch) | |
tree | 981d41bb21d7e54de794af94a255a9db2d64992a /bridge/telegram/html.go | |
parent | 064b6a915fa551f4def8903a87feaa392eab5d20 (diff) | |
download | matterbridge-msglm-ad6440b603a8df6be8b221c3c91ede68d16c8105.tar.gz matterbridge-msglm-ad6440b603a8df6be8b221c3c91ede68d16c8105.tar.bz2 matterbridge-msglm-ad6440b603a8df6be8b221c3c91ede68d16c8105.zip |
Refactor telegram
Diffstat (limited to 'bridge/telegram/html.go')
-rw-r--r-- | bridge/telegram/html.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bridge/telegram/html.go b/bridge/telegram/html.go index 3eb84bab..5e7bdc72 100644 --- a/bridge/telegram/html.go +++ b/bridge/telegram/html.go @@ -6,11 +6,11 @@ import ( "html" ) -type customHtml struct { +type customHTML struct { blackfriday.Renderer } -func (options *customHtml) Paragraph(out *bytes.Buffer, text func() bool) { +func (options *customHTML) Paragraph(out *bytes.Buffer, text func() bool) { marker := out.Len() if !text() { @@ -20,32 +20,32 @@ func (options *customHtml) Paragraph(out *bytes.Buffer, text func() bool) { out.WriteString("\n") } -func (options *customHtml) BlockCode(out *bytes.Buffer, text []byte, lang string) { +func (options *customHTML) BlockCode(out *bytes.Buffer, text []byte, lang string) { out.WriteString("<pre>") out.WriteString(html.EscapeString(string(text))) out.WriteString("</pre>\n") } -func (options *customHtml) Header(out *bytes.Buffer, text func() bool, level int, id string) { +func (options *customHTML) Header(out *bytes.Buffer, text func() bool, level int, id string) { options.Paragraph(out, text) } -func (options *customHtml) HRule(out *bytes.Buffer) { +func (options *customHTML) HRule(out *bytes.Buffer) { out.WriteByte('\n') } -func (options *customHtml) BlockQuote(out *bytes.Buffer, text []byte) { +func (options *customHTML) BlockQuote(out *bytes.Buffer, text []byte) { out.WriteString("> ") out.Write(text) out.WriteByte('\n') } -func (options *customHtml) List(out *bytes.Buffer, text func() bool, flags int) { +func (options *customHTML) List(out *bytes.Buffer, text func() bool, flags int) { options.Paragraph(out, text) } -func (options *customHtml) ListItem(out *bytes.Buffer, text []byte, flags int) { +func (options *customHTML) ListItem(out *bytes.Buffer, text []byte, flags int) { out.WriteString("- ") out.Write(text) out.WriteByte('\n') @@ -53,7 +53,7 @@ func (options *customHtml) ListItem(out *bytes.Buffer, text []byte, flags int) { func makeHTML(input string) string { return string(blackfriday.Markdown([]byte(input), - &customHtml{blackfriday.HtmlRenderer(blackfriday.HTML_USE_XHTML|blackfriday.HTML_SKIP_IMAGES, "", "")}, + &customHTML{blackfriday.HtmlRenderer(blackfriday.HTML_USE_XHTML|blackfriday.HTML_SKIP_IMAGES, "", "")}, blackfriday.EXTENSION_NO_INTRA_EMPHASIS| blackfriday.EXTENSION_FENCED_CODE| blackfriday.EXTENSION_AUTOLINK| |