basic HTML transforms

This commit is contained in:
Simon Martens
2025-09-19 23:21:21 +02:00
parent b39a7fa7ee
commit 5dcda918f0
3 changed files with 95 additions and 1 deletions

View File

@@ -29,6 +29,14 @@ type Citation struct {
Inner
}
// HTML returns the HTML-transformed version of the citation
func (c Citation) HTML() string {
if c.Inner.InnerXML != "" {
return transformToHTML(c.Inner.InnerXML)
}
return c.Value.Chardata
}
func (w Work) References() xmlprovider.ResolvingMap[Work] {
refs := make(xmlprovider.ResolvingMap[Work])
@@ -57,12 +65,18 @@ func (w Work) Readable(lib *Library) map[string]interface{} {
"Title": w.Citation.Title,
"Year": w.Citation.Year,
"CitationTitle": w.Citation.Title,
"CitationHTML": w.Citation.HTML(),
}
for k, v := range w.AnnotationNote.Readable() {
ret[k] = v
}
// Add HTML versions
for k, v := range w.AnnotationNote.ReadableHTML() {
ret[k] = v
}
agents := make([]map[string]interface{}, len(w.AgentRefs))
for k, v := range w.AgentRefs {
agents[k] = v.Readable(lib)