Shortcodes for my Weekly Reports

· hugo debian tor foss
This blog post is more than two years old. It is preserved here in the hope that it is useful to someone, but please be aware that links may be broken and that opinions expressed here may not reflect my current views. If this is a technical article, it may no longer reflect current best practice.

I’ve been writing weekly reports on my free software activities for over a month now, so I’m looking at ways of making these easier to write. Each review takes about an hour to write up, and I’m spending enough time formatting links to packages and bug reports that I’ve written some Hugo shortcodes to help.

For Debian:

{{ with ( .Get "bug" ) }}{{ range ( first 1 ( split . "," ) ) }}<a href="https://bugs.debian.org/{{ . }}">#{{ . }}</a>{{ end }}{{ if ( ( gt ( len ( split . "," ) )  1 ) ) }}{{ range ( after 1 ( split . "," ) ) }}, <a href="https://bugs.debian.org/{{ . }}">#{{ . }}</a>{{ end }}{{ end }}{{ end }}
{{ with ( .Get "src" ) }}{{ range ( first 1 ( split . "," ) ) }}<a href="https://packages.debian.org/source/sid/{{ . }}">{{ . }}</a>{{ end }}{{ if ( ( gt ( len ( split . "," ) )  1 ) ) }}{{ range ( after 1 ( split . "," )) }}, <a href="https://packages.debian.org/source/sid/{{ . }}">{{ . }}</a>{{ end }}{{ end }}{{ end }}
{{ with ( .Get "pkg" ) }}{{ range ( first 1 ( split . "," ) ) }}<a href="https://packages.debian.org/sid/{{ . }}">{{ . }}</a>{{ end }}{{ if ( ( gt ( len ( split . "," ) )  1 ) ) }}{{ range ( after 1 ( split . "," )) }}, <a href="https://packages.debian.org/sid/{{ . }}">{{ . }}</a>{{ end }}{{ end }}{{ end }}

For Tor Project:

{{ with ( .Get "bug" ) }}{{ range ( first 1 ( split . "," ) ) }}<a href="https://bugs.torproject.org/{{ . }}">#{{ . }}</a>{{ end }}{{ if ( ( gt ( len ( split . "," ) )  1 ) ) }}{{ range ( after 1 ( split . "," ) ) }}, <a href="https://bugs.torproject.org/{{ . }}">#{{ . }}</a>{{ end }}{{ end }}{{ end }}

So now I can write things like:

* {{< debian bug="759639" >}}
* {{< debian bug="739609,759639" >}}
* {{< debian pkg="direwolf" >}}
* {{< debian src="direwolf" >}}
* {{< tor bug="20869" >}}

and I’ll get:


If you would like to contact me with comments, please send me an email.
If you would like to support my free software work, you can support me on Patreon or donate via PayPal.


This post was syndicated on: