blob: f74c753ef2c706236c1a3c21924eb0df22390d4e (
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", w.Title)
n.Message = w.Extract
default:
err = fmt.Errorf("Summarizing wikipedia response failed")
}
return n, err
}
|