diff options
| -rw-r--r-- | .clog.toml | 9 | ||||
| -rw-r--r-- | NEWS | 9 | ||||
| -rw-r--r-- | go.mod | 4 | ||||
| -rw-r--r-- | go.sum | 6 | ||||
| -rw-r--r-- | template/code.qtpl.go | 81 | ||||
| -rw-r--r-- | template/layout.qtpl.go | 70 |
6 files changed, 111 insertions, 68 deletions
diff --git a/.clog.toml b/.clog.toml deleted file mode 100644 index 9278e27..0000000 --- a/.clog.toml +++ /dev/null @@ -1,9 +0,0 @@ -[clog] -repository = "https://github.com/5paceToast/brpaste" -subtitle = "Burning Rubber Paste" - -changelog = "CHANGELOG.md" -from-latest-tag = true - -[sections] -Ecosystem = ["eco"] @@ -0,0 +1,9 @@ + 2.1.0 (2019-12-19) + +Chloe Kudryavtsev <toast@toast.cafe> +. init.d script is valid again +. there is now an in-memory storage engine (use in production not recommended) +. consumers of brpaste as a library can now override the default templates + +Haelwenn Monnier <contact@hacktivis.me> +. default template backgrounds default to white @@ -6,10 +6,10 @@ require ( github.com/fasthttp/router v0.5.2 github.com/go-redis/redis/v7 v7.0.0-beta.4 github.com/golang/protobuf v1.3.1 // indirect - github.com/klauspost/compress v1.9.2 // indirect + github.com/klauspost/compress v1.9.4 // indirect github.com/stretchr/testify v1.4.0 github.com/twmb/murmur3 v1.0.0 - github.com/valyala/fasthttp v1.6.0 + github.com/valyala/fasthttp v1.7.0 github.com/valyala/quicktemplate v1.4.1 golang.org/x/text v0.3.2 // indirect ) @@ -16,8 +16,8 @@ github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.2 h1:LfVyl+ZlLlLDeQ/d2AqfGIIH4qEDu0Ed2S5GyhCWIWY= -github.com/klauspost/compress v1.9.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.9.4 h1:xhvAeUPQ2drNUhKtrGdTGNvV9nNafHMUkRyLkzxJoB4= +github.com/klauspost/compress v1.9.4/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= @@ -41,6 +41,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= github.com/valyala/fasthttp v1.6.0 h1:uWF8lgKmeaIewWVPwi4GRq2P6+R46IgYZdxWtM+GtEY= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasthttp v1.7.0 h1:r0Z/fzm2Euss3K0hhkPtt41TigAr9bXueavuXgrThi4= +github.com/valyala/fasthttp v1.7.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/quicktemplate v1.4.1 h1:tEtkSN6mTCJlYVT7As5x4wjtkk2hj2thsb0M+AcAVeM= github.com/valyala/quicktemplate v1.4.1/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= diff --git a/template/code.qtpl.go b/template/code.qtpl.go index 2fa1401..3f4e19b 100644 --- a/template/code.qtpl.go +++ b/template/code.qtpl.go @@ -25,7 +25,7 @@ func StreamCode(qw422016 *qt422016.Writer, lang, data string) { qw422016.N().S(` `) //line template/code.qtpl:3 - streamlayout(qw422016, " ", code_scripts(lang), "", code_contents(lang, data), code_bodyscripts(lang)) + streamlayout(qw422016, code_css(), code_scripts(lang), "", code_contents(lang, data), code_bodyscripts(lang)) //line template/code.qtpl:3 qw422016.N().S(` `) @@ -161,47 +161,88 @@ func code_bodyscripts(lang string) string { //line template/code.qtpl:23 } -// The code contents. +// The code css. //line template/code.qtpl:26 -func streamcode_contents(qw422016 *qt422016.Writer, lang, data string) { +func streamcode_css(qw422016 *qt422016.Writer) { //line template/code.qtpl:26 qw422016.N().S(` + <style> + pre[class*="language-"] code[class*="language-"] { + white-space: pre-wrap; + } + </style> +`) +//line template/code.qtpl:32 +} + +//line template/code.qtpl:32 +func writecode_css(qq422016 qtio422016.Writer) { +//line template/code.qtpl:32 + qw422016 := qt422016.AcquireWriter(qq422016) +//line template/code.qtpl:32 + streamcode_css(qw422016) +//line template/code.qtpl:32 + qt422016.ReleaseWriter(qw422016) +//line template/code.qtpl:32 +} + +//line template/code.qtpl:32 +func code_css() string { +//line template/code.qtpl:32 + qb422016 := qt422016.AcquireByteBuffer() +//line template/code.qtpl:32 + writecode_css(qb422016) +//line template/code.qtpl:32 + qs422016 := string(qb422016.B) +//line template/code.qtpl:32 + qt422016.ReleaseByteBuffer(qb422016) +//line template/code.qtpl:32 + return qs422016 +//line template/code.qtpl:32 +} + +// The code contents. + +//line template/code.qtpl:35 +func streamcode_contents(qw422016 *qt422016.Writer, lang, data string) { +//line template/code.qtpl:35 + qw422016.N().S(` <pre><code class='language-`) -//line template/code.qtpl:27 +//line template/code.qtpl:36 qw422016.E().S(lang) -//line template/code.qtpl:27 +//line template/code.qtpl:36 qw422016.N().S(`'>`) -//line template/code.qtpl:27 +//line template/code.qtpl:36 qw422016.E().S(data) -//line template/code.qtpl:27 +//line template/code.qtpl:36 qw422016.N().S(`</code></pre> `) -//line template/code.qtpl:28 +//line template/code.qtpl:37 } -//line template/code.qtpl:28 +//line template/code.qtpl:37 func writecode_contents(qq422016 qtio422016.Writer, lang, data string) { -//line template/code.qtpl:28 +//line template/code.qtpl:37 qw422016 := qt422016.AcquireWriter(qq422016) -//line template/code.qtpl:28 +//line template/code.qtpl:37 streamcode_contents(qw422016, lang, data) -//line template/code.qtpl:28 +//line template/code.qtpl:37 qt422016.ReleaseWriter(qw422016) -//line template/code.qtpl:28 +//line template/code.qtpl:37 } -//line template/code.qtpl:28 +//line template/code.qtpl:37 func code_contents(lang, data string) string { -//line template/code.qtpl:28 +//line template/code.qtpl:37 qb422016 := qt422016.AcquireByteBuffer() -//line template/code.qtpl:28 +//line template/code.qtpl:37 writecode_contents(qb422016, lang, data) -//line template/code.qtpl:28 +//line template/code.qtpl:37 qs422016 := string(qb422016.B) -//line template/code.qtpl:28 +//line template/code.qtpl:37 qt422016.ReleaseByteBuffer(qb422016) -//line template/code.qtpl:28 +//line template/code.qtpl:37 return qs422016 -//line template/code.qtpl:28 +//line template/code.qtpl:37 } diff --git a/template/layout.qtpl.go b/template/layout.qtpl.go index dc5e5d8..8f039ae 100644 --- a/template/layout.qtpl.go +++ b/template/layout.qtpl.go @@ -30,75 +30,75 @@ func streamlayout(qw422016 *qt422016.Writer, css, scripts, title, contents, body //line template/layout.qtpl:10 if len(css) == 0 { //line template/layout.qtpl:10 - qw422016.N().S(`<style>body {margin: 40px auto;max-width: 650px;line-height: 1.6;font-size: 18px;color: #444;padding: 0 10px;}h1, h2, h3 { line-length: 1.2; }td { text-align: left; }</style>`) -//line template/layout.qtpl:23 - } else { + qw422016.N().S(`<style>body {margin: 40px auto;max-width: 650px;line-height: 1.6;font-size: 18px;background: #fff;color: #444;padding: 0 10px;}h1, h2, h3 { line-length: 1.2; }td { text-align: left; }</style>`) //line template/layout.qtpl:24 - qw422016.N().S(css) + } else { //line template/layout.qtpl:25 + qw422016.N().S(css) +//line template/layout.qtpl:26 } -//line template/layout.qtpl:27 - if len(scripts) != 0 { //line template/layout.qtpl:28 - qw422016.N().S(scripts) + if len(scripts) != 0 { //line template/layout.qtpl:29 + qw422016.N().S(scripts) +//line template/layout.qtpl:30 } -//line template/layout.qtpl:31 +//line template/layout.qtpl:32 if len(title) == 0 { -//line template/layout.qtpl:31 +//line template/layout.qtpl:32 qw422016.N().S(`<title>Burning Rubber Paste</title>`) -//line template/layout.qtpl:33 - } else { //line template/layout.qtpl:34 - qw422016.N().S(title) + } else { //line template/layout.qtpl:35 + qw422016.N().S(title) +//line template/layout.qtpl:36 } -//line template/layout.qtpl:35 +//line template/layout.qtpl:36 qw422016.N().S(`</head><body><div id='main'>`) -//line template/layout.qtpl:39 - if len(contents) != 0 { //line template/layout.qtpl:40 - qw422016.N().S(contents) + if len(contents) != 0 { //line template/layout.qtpl:41 + qw422016.N().S(contents) +//line template/layout.qtpl:42 } -//line template/layout.qtpl:41 +//line template/layout.qtpl:42 qw422016.N().S(`</div>`) -//line template/layout.qtpl:43 - if len(bodyscripts) != 0 { //line template/layout.qtpl:44 - qw422016.N().S(bodyscripts) + if len(bodyscripts) != 0 { //line template/layout.qtpl:45 + qw422016.N().S(bodyscripts) +//line template/layout.qtpl:46 } -//line template/layout.qtpl:45 +//line template/layout.qtpl:46 qw422016.N().S(`</body></html>`) -//line template/layout.qtpl:48 +//line template/layout.qtpl:49 qw422016.N().S(` `) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 } -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 func writelayout(qq422016 qtio422016.Writer, css, scripts, title, contents, bodyscripts string) { -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 qw422016 := qt422016.AcquireWriter(qq422016) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 streamlayout(qw422016, css, scripts, title, contents, bodyscripts) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 qt422016.ReleaseWriter(qw422016) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 } -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 func layout(css, scripts, title, contents, bodyscripts string) string { -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 qb422016 := qt422016.AcquireByteBuffer() -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 writelayout(qb422016, css, scripts, title, contents, bodyscripts) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 qs422016 := string(qb422016.B) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 qt422016.ReleaseByteBuffer(qb422016) -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 return qs422016 -//line template/layout.qtpl:49 +//line template/layout.qtpl:50 } |
