diff options
author | F.O. <scrotadamus@insiberia.net> | 2025-02-16 17:56:08 +0100 |
---|---|---|
committer | F.O. <scrotadamus@insiberia.net> | 2025-02-16 17:56:57 +0100 |
commit | 17fb6add26291b31f7020e3551a7c8487130a747 (patch) | |
tree | d4559a7339ed181393ff921909e6ce05b7c2cf18 /document/utils.go |
genesi
Diffstat (limited to 'document/utils.go')
-rw-r--r-- | document/utils.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/document/utils.go b/document/utils.go new file mode 100644 index 0000000..c6593c4 --- /dev/null +++ b/document/utils.go @@ -0,0 +1,30 @@ +package document + +import ( + "github.com/scrotadamus/ghligh/go-poppler" + + "encoding/json" +) + +func unmarshallHighlights(jsonData string) (AnnotsMap, error) { + var annotsMap AnnotsMap + + err := json.Unmarshal([]byte(jsonData), &struct { + Highlights *AnnotsMap `json:"highlights"` + }{ + Highlights: &annotsMap, + }) + + return annotsMap, err +} + +func isInPage(a *poppler.Annot, p *poppler.Page) bool { + annots := p.GetAnnots() + for _, annot := range annots { + if popplerAnnotsMatch(a, annot) { + return true + } + } + + return false +} |