Hello Mr. Krewinkel, thank you for your help. The filter works great! The export option has made no difference for me, but I might be using it wrong (as it is always with me, I am learning working with Emacs, so I am probably doing something the way I shouldnt :D). The second part is difficult for me. Could you elaborate a little more about how did you identified that those `'todo'` or `'TODO'` in the TODO-Span as classes, and not attributes? This might be silly question, I guess this is somehow inspired by HTML, but it would be really helpfull for me to know how this element is represented in pandoc AST. And the element [String "TODO"] is a one-element list in pandoc-AST, therefore it cannot be chacked as-is? Did I got the last part correctly? Regards, Tomas Dne čtvrtek 5. listopadu 2020 v 22:31:07 UTC+1 uživatel Albert Krewinkel napsal: > krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org writes: > > > I am using pandoc to convert `org-agenda` list of todos to `docx` and > `pdf` > > for my coworkers. File exported from `emacs org-agenda` can look like > that > > (simplified): > > > > `tasks.org` > > ``` > > * TODO Feed the cat > > ``` > > > > Pandoc native output of this file parsing is: > > > > ``` > > [Header 1 ("feed-the-cat",[],[]) [Span ("",["todo","TODO"],[]) [Str > > "TODO"],Space,Str "Feed",Space,Str "the",Space,Str "cat"]] > > ``` > > > > Now if I convert this to any output format, I get spurious "TODO" pandoc > > strings (that are present from `org-mode`). How can I get rid of this > > "TODO" string (preferably also with surrounding spaces)? > > Two options: > > 1. The org reader recognizes most org export options. So adding the > following line to your input file should be enough: > > #+OPTIONS: todo:nil > > See: https://orgmode.org/manual/Export-Settings.html > > 2. With a Lua filter you'll want > > function Span (span) > if span.classes:includes 'todo' then > return {} -- delete this element > end > end > > > So, how can I access, or match, `pandoc Span` elements based on their > > content? Where can I read more about this? > > _Just_ on their content is difficult for various reasons, but you can > compare AST elements using the normal `==` Lua operator. The comparison > of elements happens in Haskell, where elements don't have identity. > > So `pandoc.Span {pandoc.Str 'hi'} == pandoc.Span {pandoc.Str 'hi'}` > would be true, but `{pandoc.Str 'hi'} == {pandoc.Str 'hi'}` would be > false, as lists are note treated as AST elements. We might change that > at some point. > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/84ffd932-2be5-4900-b115-58220e691dcbn%40googlegroups.com.