public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Walk all blocks except inside footnotes
@ 2015-10-17 20:12 Elliott Slaughter
       [not found] ` <CAJ9X=kbfnfzLzD3J-yk0VgDCzPzep1fO2STyFnOSmmq14j+SPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Elliott Slaughter @ 2015-10-17 20:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

Hi,

I am using Text.Pandoc.Walk to transform all blocks of a certain type. This
works great, except that it recurses into blocks contained inside footnotes
and also applies the transformation there, which is not what I want.

What I would like is a way to stop the recursion at footnotes to prevent
them from being transformed, as I have (to the best of my knowledge) no way
to tell that a block is inside a footnote when I'm looking at it. However,
I am struggling to do this within the structure of Text.Pandoc.Walk because
the function provides no mechanisms to direct or abort recursion, and even
if it did, the footnotes themselves are inlines, not blocks.

I know I could write the traversal by hand in Haskell, but is time
consuming and would require much more code. Is there a better alternative?

Thanks in advance.

-- 
Elliott Slaughter

"Don't worry about what anybody else is going to do. The best way to
predict the future is to invent it." - Alan Kay

-- 
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/CAJ9X%3DkbfnfzLzD3J-yk0VgDCzPzep1fO2STyFnOSmmq14j%2BSPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 2190 bytes --]

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

* Re: Walk all blocks except inside footnotes
       [not found] ` <CAJ9X=kbfnfzLzD3J-yk0VgDCzPzep1fO2STyFnOSmmq14j+SPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-10-17 23:25   ` John MacFarlane
  0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2015-10-17 23:25 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Have you looked at regular syb generics?
Data.Generic.Schemes has some functions that look
like good candidates, such as everywhereBut.

+++ Elliott Slaughter [Oct 17 15 13:12 ]:
>   Hi,
>   I am using Text.Pandoc.Walk to transform all blocks of a certain type.
>   This works great, except that it recurses into blocks contained inside
>   footnotes and also applies the transformation there, which is not what
>   I want.
>   What I would like is a way to stop the recursion at footnotes to
>   prevent them from being transformed, as I have (to the best of my
>   knowledge) no way to tell that a block is inside a footnote when I'm
>   looking at it. However, I am struggling to do this within the structure
>   of Text.Pandoc.Walk because the function provides no mechanisms to
>   direct or abort recursion, and even if it did, the footnotes themselves
>   are inlines, not blocks.
>   I know I could write the traversal by hand in Haskell, but is time
>   consuming and would require much more code. Is there a better
>   alternative?
>   Thanks in advance.
>   --
>   Elliott Slaughter
>   "Don't worry about what anybody else is going to do. The best way to
>   predict the future is to invent it." - Alan Kay
>
>   --
>   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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/CAJ9X%3DkbfnfzLzD3J
>   -yk0VgDCzPzep1fO2STyFnOSmmq14j%2BSPQ%40mail.gmail.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/CAJ9X=kbfnfzLzD3J-yk0VgDCzPzep1fO2STyFnOSmmq14j+SPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


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

end of thread, other threads:[~2015-10-17 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-17 20:12 Walk all blocks except inside footnotes Elliott Slaughter
     [not found] ` <CAJ9X=kbfnfzLzD3J-yk0VgDCzPzep1fO2STyFnOSmmq14j+SPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-17 23:25   ` 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).