From 507e4b6c6bf86f53f38376472166b4629227d7b9 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 15 Jun 2019 18:24:18 -0400 Subject: [PATCH] include hashtags in AP metadata --- activity.go | 7 +++++++ fun.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/activity.go b/activity.go index 7043edd..76d5869 100644 --- a/activity.go +++ b/activity.go @@ -733,6 +733,13 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { t["href"] = m.where tags = append(tags, t) } + ooo := ontologies(h.Noise) + for _, o := range ooo { + t := junk.New() + t["type"] = "Hashtag" + t["name"] = o + tags = append(tags, t) + } herd := herdofemus(h.Noise) for _, e := range herd { t := junk.New() diff --git a/fun.go b/fun.go index 32c2d16..37eabff 100644 --- a/fun.go +++ b/fun.go @@ -119,6 +119,13 @@ func xfiltrate() string { } } +var re_hashes = regexp.MustCompile(`(?:^|\W)#[[:alnum:]]+`) + +func ontologies(s string) []string { + m := re_hashes.FindAllString(s, -1) + return m +} + type Mention struct { who string where string