This is kind of based on the REUSE specification, but I find the spec
annoying in some respects so this is not entirely compatible with their
advice. I will pitch these alterations upstream at some point.
For feeds with no title, openring places a link with no clickable
text on the byline ("via ..."). Instead, we replace the empty title
with a sensible substitute (URL.Host).
Additionally, fix an unhandled error.
I noticed I get a panic when running openring with http://antirez.com/rss
The panic happened because the url.Parse returned error is not assigned
to a variable.
<antirez>
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1119fd6]
goroutine 1 [running]:
net/url.(*URL).ResolveReference(0xc0004c0bd0, 0x0, 0x0)
/usr/local/Cellar/go/1.16.5/libexec/src/net/url/url.go:1075 +0x36
main.main()
/Users/gianarb/git/openring/openring.go:152 +0x9c
There is another problem, the URL is not valid for the url.Parse
function for some reason. But this is an issue for another day.
Signed-off-by: Gianluca Arbezzano <ciao@gianarb.it>
This adds a new datef function instead of changing date function in an
effort to keep backwards compatibility.
datef is intentionally used in the example to make it clear to the user
that it is possible to set a custom date format.