public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Non-greedy regexp matching too much in pandoc-generated markdown file
@ 2019-04-16 14:14 jamiereecebowman-Re5JQEeQqe8AvxtiuMwx3w
       [not found] ` <8c88e0fd-81c8-4efa-87c9-877532220914-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: jamiereecebowman-Re5JQEeQqe8AvxtiuMwx3w @ 2019-04-16 14:14 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 780 bytes --]

I posted this earlier on Stack Overflow:

https://stackoverflow.com/questions/55710275/non-greedy-regexp-matching-too-much-in-pandoc-generated-markdown-file

If anyone could help, that'd be much appreciated.

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8c88e0fd-81c8-4efa-87c9-877532220914%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1259 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Non-greedy regexp matching too much in pandoc-generated markdown file
       [not found] ` <8c88e0fd-81c8-4efa-87c9-877532220914-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-04-16 16:22   ` John MacFarlane
  0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2019-04-16 16:22 UTC (permalink / raw)
  To: jamiereecebowman-Re5JQEeQqe8AvxtiuMwx3w, pandoc-discuss

jamiereecebowman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org writes:

> I want to run a regexp find and replace on the
> markdown file which effectively 'accepts' insertions
> and deletions but leaves the comment spans. (This is
> so when I convert back to .docx, I have a clean .docx
> file with comments only.)

You'd be better off using a pandoc filter for this.
See the lua-filters documentation:
https://pandoc.org/lua-filters.html
Something like (untested)

-- accept.lua
function Span(el)
  if el.classes:includes("deletion") then
    return {}
  end
  if el.classes:includes("insertion") then
    return el.content
  end
end

Then you can just do

    pandoc --lua-filter accept.lua input.md -o output.md


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-16 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 14:14 Non-greedy regexp matching too much in pandoc-generated markdown file jamiereecebowman-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <8c88e0fd-81c8-4efa-87c9-877532220914-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-04-16 16:22   ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).