Changing the order with the original filter didn't have an effect.

Trying the revised filter (which I renamed, as it is very different from the first one) resulted in the following error message:


Screenshot from 2022-07-05 13-42-57.png
Albert Krewinkel schrieb am Dienstag, 5. Juli 2022 um 12:27:43 UTC+2:

John Carter Wood <woo...@uni-mainz.de> writes:

> I have finally had a chance to try out Denis's lua filter but I don't
> seem to be able to get it to work.
> 1. I saved the filter in my .pandoc/filters folder (as
> colon-to-dot.lua, attached)
> 2. I used the test .md file Denis provided (as dot-test.md, attached)
> 3. I used the pandoc command: pandoc dot-test.md --citeproc
> --lua-filter colon-to-dot.lua -o dot-test.docx
> But what comes out looks like this: the colon is unchanged.
> Screenshot from 2022-07-05 12-00-17.png
> What am I doing wrong?

I didn't test them, but these changes could help:

1. Change the order of `--citeproc` and `--lua-filter=...` on the
command line. The order in which these are given is also the order
in which they are applied. We want the Lua filter to be applied
first.

2. Make sure that the `references` field is populated by filtering the
Pandoc element and adding
`doc.meta.references = pandoc.utils.references(doc)`

Here's the updated filter:

``` lua
function Pandoc (doc)
local meta = doc.meta
meta.references = pandoc.utils.references(doc)
meta.bibliography = nil -- prevent citeproc from parsing this again

for _, ref in ipairs (meta.references or {}) do
ref.title = ref.title:walk {
Str = function (str)
return str:gsub(':$', ',')
end
}
end

return pandoc.Pandoc(doc.blocks, meta)
end
```

HTH

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1ebf2a90-159e-4445-bf3a-b068526877cbn%40googlegroups.com.