Open jdutant opened 3 years ago
Did this problem crop up because of Pandoc's (several) recent changes to header include handling or has this always been a problem?
Thanks. I'm not sure; I thought I had tested it on docs with header-includes and it worked. But it's also possible I overlooked it. Especially header-includes can have three types: MetaInlines, MetaBlocks and MetaList, and I may have failed to try it with all of them. I've now tested the new version with all. I haven't included sample .md files for all cases but could do if that's helpful for the future.
Thanks for the response, and that's fair.
Actually I think including test fixtures would be quite helpful in this case.
What I usually do is to check if header-includes
is nil
, a MetaList or
something else. If it is a MetaList I just push my additions onto it as a
MetaBlocks containing a RawBlock; otherwise I replace it with a MetaList
and push the original value if any and my own …Block onto it. Has never
failed so far (unless the --include-in-header option has been used.)
Just my two worthless coins.
Den ons 7 juli 2021 17:53Julien Dutant @.***> skrev:
Thanks. I'm not sure; I thought I had tested it on docs with header-includes and it worked. But it's also possible I overlooked it. Especially header-includes can have three types: MetaInlines, MetaBlocks and MetaList, and I may have failed to try it with all of them. I've now tested the new version with all. I haven't included sample .md files for all cases but could do if that's helpful for the future.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pandoc/lua-filters/pull/185#issuecomment-875721025, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3OU2HY6R4REK5M6FZJADTWRZ5FANCNFSM47ZNDS4Q .
@bpj Thanks. That's right; this filter does the same, except that it first creates a MetaList with the desired content as MetaBlocks containing a Rawblock, then check if there's something in the original doc's Meta; if yes, then either it's a MetaList and we extend ours with it, or it's something else and we push it in ours.
@alerque I've added three sample docs covering the different types of header-includes.
The first-line-indent filter crashed when the original document had header-includes already. This is now fixed, tested for all types of header-includes (MetaInlines, MetaBlocks and MetaList).