Don't push inspection profiles

summarize-items
Peter Stuifzand 4 years ago
commit ac4c596d4c

1
.gitignore vendored

@ -1 +1,2 @@
/weekly
/.idea/inspectionProfiles/

@ -1,20 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="GoUnhandledErrorResult" enabled="true" level="WARNING" enabled_by_default="true">
<methods>
<method importPath="hash" receiver="Hash" name="Write" />
<method importPath="strings" receiver="*Builder" name="Write" />
<method importPath="strings" receiver="*Builder" name="WriteByte" />
<method importPath="bytes" receiver="*Buffer" name="WriteRune" />
<method importPath="bytes" receiver="*Buffer" name="Write" />
<method importPath="bytes" receiver="*Buffer" name="WriteString" />
<method importPath="strings" receiver="*Builder" name="WriteString" />
<method importPath="bytes" receiver="*Buffer" name="WriteByte" />
<method importPath="strings" receiver="*Builder" name="WriteRune" />
<method importPath="math/rand" receiver="*Rand" name="Read" />
<method importPath="io" receiver="ReadCloser" name="Close" />
</methods>
</inspection_tool>
</profile>
</component>

@ -3,6 +3,7 @@ module p83.nl/go/weekly
go 1.12
require (
github.com/jinzhu/now v1.1.1
github.com/pkg/errors v0.8.1 // indirect
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect
p83.nl/go/ekster v0.0.0-20191119211024-4511657daa0b

@ -1,3 +1,5 @@
github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E=
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

@ -6,7 +6,10 @@ import (
"net/http"
"net/url"
"os"
"time"
"github.com/jinzhu/now"
"p83.nl/go/ekster/pkg/microsub"
"willnorris.com/go/microformats"
"p83.nl/go/ekster/pkg/jf2"
@ -31,6 +34,8 @@ func main() {
md := microformats.Parse(resp.Body, u)
items := jf2.SimplifyMicroformatDataItems(md)
items = filterEntriesAfter(items, now.With(time.Now()).Monday())
t, err := template.ParseFiles("templates/weekly.html")
if err != nil {
log.Fatal(err)
@ -41,3 +46,17 @@ func main() {
log.Fatal(err)
}
}
func filterEntriesAfter(items []microsub.Item, from time.Time) []microsub.Item {
var result []microsub.Item
for _, item := range items {
published, err := time.Parse(time.RFC3339, item.Published)
if err != nil {
continue
}
if published.After(from) {
result = append(result, item)
}
}
return result
}

@ -16,6 +16,8 @@
<div class="p-content">{{ .Content.Text }}</div>
{{ end }}
{{ end }}
<time datetime="{{ .Published }}">{{ .Published }}</time>
</div>
{{ end }}
</div>

Loading…
Cancel
Save