jgm/pandoc

Support `abstract-title` for Typst format

cderv opened this issue · 3 comments

cderv commented

I believe this could easily be supported like in HTML and some other formats by tweaking the template here

if abstract != none {
block(inset: 2em)[
#text(weight: "semibold")[Abstract] #h(1em) #abstract
]
}

so that Abstract is not hard coded.

Though it probably needs a Writer update to match behavior with Docx or HTML that supports this field

jgm commented

Makes sense. I think it could all be done in the templates.
Want to submit a PR?

cderv commented

I think it could all be done in the templates.

Looking at this closer, It seems Writers are currently setting some defaults and handling translation. Should translation of term works for Typst as HTML and Docx ?

abstractTitle <- case lookupMeta "abstract-title" meta of
Just (MetaBlocks bs) -> pure $ stringify bs
Just (MetaInlines ils) -> pure $ stringify ils
Just (MetaString s) -> pure s
_ -> translateTerm Abstract

abstractTitle <- translateTerm Abstract

defField "abstract-title" abstractTitle .

jgm commented

Yes, it would be good to use the translation of the Abstract term as the default value for abstract-title (which could be overridden). That's what is doen in the docx writer, as you see.