blob: c4a5050d02ba9e3c1997701078a617c863ed0c6c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package summarize
import (
"fmt"
"framagit.org/andinus/indus/fetch"
"framagit.org/andinus/indus/notification"
)
// Wikipedia returns struct notification.Notif with notification info
// from the wikipedia summary.
func Wikipedia(w fetch.Wiki) (notification.Notif, error) {
n := notification.Notif{}
var err error
// Continue only if the page's type is standard. TODO: Work
// with other page types to get summary.
switch w.Type {
case "standard":
n.Title = fmt.Sprintf("%s - Wikipedia", w.Title)
n.Message = w.Description
default:
err = fmt.Errorf("Summarizing wikipedia response failed")
}
return n, err
}
|