jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.55k stars 3.38k forks source link

Support `abstract-title` for Typst format #9724

Open cderv opened 6 months ago

cderv commented 6 months ago

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

https://github.com/jgm/pandoc/blob/0f29d8195eeb526c4aa14d5f56818f905d5badb5/data/templates/template.typst#L62-L66

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 6 months ago

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

cderv commented 6 months ago

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 ?

https://github.com/jgm/pandoc/blob/ddc66cad0b0e170c48e7fdc01fbecf57f329add4/src/Text/Pandoc/Writers/Docx.hs#L916-L920 https://github.com/jgm/pandoc/blob/ddc66cad0b0e170c48e7fdc01fbecf57f329add4/src/Text/Pandoc/Writers/HTML.hs#L291 https://github.com/jgm/pandoc/blob/ddc66cad0b0e170c48e7fdc01fbecf57f329add4/src/Text/Pandoc/Writers/HTML.hs#L371

jgm commented 6 months ago

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.