I’ve switched to a different approach now. But in principle, the problem is that I always target both LaTeX and HTML. With the latter, I don’t want to have the empty braces.
Example:
INPUT: foo\bar{}baz
AST: [Para [Str "foo",RawInline (Format "tex") "\\bar",Str "{}baz"]]
Here, I can’t use my own Lua filter to implement \bar{} for HTML, because that filter will miss the empty braces.