public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Filters that alter document structure?
@ 2014-11-16 21:22 Mark Szepieniec
       [not found] ` <CAE4-1rWH__=cx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Szepieniec @ 2014-11-16 21:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I have a complex html document that I've read into pandoc, and I'm trying
to write filters that will isolate the content I'm after. Some examples of
this are dropping certain Divs entirely, or replacing Tables by just the
content of their rows.

I can write filters of the type Pandoc -> Pandoc which is workable for
changing the top-level structure of a document, but would become very
tedious when Blocks are nested. I could also write my functions to return Null
:: Block when removing Blocks, but that doesn't feel like the right way to
do it. Or is that perhaps precisely why Null is there in the first place?

I'd like to be able to write functions of type [Block] -> [Block] to use in
filters, but I get the error

No instance for (Text.Pandoc.Walk.Walkable [Block] Pandoc).

I tried to think about how to write that instance, but it's hard to choose
between walking lists of Blocks with applying the function to them.

So I feel I might be either missing something obvious, or going about it in
the wrong way. Is there perhaps a simple solution to what I want to do? Or
something that could be worth implementing?

-- 
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/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Filters that alter document structure?
       [not found] ` <CAE4-1rWH__=cx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-16 23:24   ` Matthew Pickering
       [not found]     ` <CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13+-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Pickering @ 2014-11-16 23:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Hi Mark,

Firstly I tend to regard the null the document model as unnecessary as most
things are stored in lists anyway. I would try to avoid it.

If you consult the documentation for the traversal functions then you can
see all the ppssible filter types.[1] For example the instance Walkable
Inline Inline means that it's possible to writer a filter with type Inline
-> Inline.

Also notice that there is an instance Walkable a b => Walkable a [b]. This
means you can also write functions with type Block -> [Block] for example.
A useful idiom is usi g the empty list to completely omit a section of the
document.

Am I misunderstanding the question? Do you wish to write a filter which
does something to a block depending on the next block for example? If you
have a specific filter you would like to write then I could give more
specific advice.

[1]:
http://hackage.haskell.org/package/pandoc-types-1.12/docs/Text-Pandoc-Walk.html
On 16 Nov 2014 21:22, "Mark Szepieniec" <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> I have a complex html document that I've read into pandoc, and I'm trying
> to write filters that will isolate the content I'm after. Some examples of
> this are dropping certain Divs entirely, or replacing Tables by just the
> content of their rows.
>
> I can write filters of the type Pandoc -> Pandoc which is workable for
> changing the top-level structure of a document, but would become very
> tedious when Blocks are nested. I could also write my functions to return Null
> :: Block when removing Blocks, but that doesn't feel like the right way
> to do it. Or is that perhaps precisely why Null is there in the first
> place?
>
> I'd like to be able to write functions of type [Block] -> [Block] to use
> in filters, but I get the error
>
> No instance for (Text.Pandoc.Walk.Walkable [Block] Pandoc).
>
> I tried to think about how to write that instance, but it's hard to choose
> between walking lists of Blocks with applying the function to them.
>
> So I feel I might be either missing something obvious, or going about it
> in the wrong way. Is there perhaps a simple solution to what I want to do?
> Or something that could be worth implementing?
>
> --
> 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/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13%2B-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Filters that alter document structure?
       [not found]     ` <CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13+-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-17 17:58       ` Mark Szepieniec
       [not found]         ` <CAE4-1rXXoM5jM0fKzeusdnVoPCj5PCLxW482xB5XKW3=34vXeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Szepieniec @ 2014-11-17 17:58 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Hi Matthew,

thanks for your response. Your suggestion of writing functions of type
Block -> [Block] works, I agree it's idiomatic, and it should cover all the
functionality I'd like to write.

However, this means I was understanding the code incorrectly, so I'd like
to ask a follow-up question to understand things better.

The way I understood it, the signature of walk, (a ->a) -> b -> b, meant
that a function of type Block -> [Block] would not compile, since that
doesn't fit the a -> a bit of the signature. Also in my understanding, the
existence of "instance Walkable a b => Walkable a [b]" just describes how
`walk` behaves when confronted with a list instead of a single element to
apply (f :: a->a) to. I don't see how it's related to what happens when f
is of type a->[a].

Could you (or someone else) help me understand and tell me where I'm going
wrong?

On Mon, Nov 17, 2014 at 12:24 AM, Matthew Pickering <
matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Hi Mark,
>
> Firstly I tend to regard the null the document model as unnecessary as
> most things are stored in lists anyway. I would try to avoid it.
>
> If you consult the documentation for the traversal functions then you can
> see all the ppssible filter types.[1] For example the instance Walkable
> Inline Inline means that it's possible to writer a filter with type Inline
> -> Inline.
>
> Also notice that there is an instance Walkable a b => Walkable a [b]. This
> means you can also write functions with type Block -> [Block] for example.
> A useful idiom is usi g the empty list to completely omit a section of the
> document.
>
> Am I misunderstanding the question? Do you wish to write a filter which
> does something to a block depending on the next block for example? If you
> have a specific filter you would like to write then I could give more
> specific advice.
>
> [1]:
> http://hackage.haskell.org/package/pandoc-types-1.12/docs/Text-Pandoc-Walk.html
> On 16 Nov 2014 21:22, "Mark Szepieniec" <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> I have a complex html document that I've read into pandoc, and I'm trying
>> to write filters that will isolate the content I'm after. Some examples of
>> this are dropping certain Divs entirely, or replacing Tables by just the
>> content of their rows.
>>
>> I can write filters of the type Pandoc -> Pandoc which is workable for
>> changing the top-level structure of a document, but would become very
>> tedious when Blocks are nested. I could also write my functions to
>> return Null :: Block when removing Blocks, but that doesn't feel like
>> the right way to do it. Or is that perhaps precisely why Null is there
>> in the first place?
>>
>> I'd like to be able to write functions of type [Block] -> [Block] to use
>> in filters, but I get the error
>>
>> No instance for (Text.Pandoc.Walk.Walkable [Block] Pandoc).
>>
>> I tried to think about how to write that instance, but it's hard to
>> choose between walking lists of Blocks with applying the function to them.
>>
>> So I feel I might be either missing something obvious, or going about it
>> in the wrong way. Is there perhaps a simple solution to what I want to do?
>> Or something that could be worth implementing?
>>
>> --
>> 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/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> 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/CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13%2B-Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13%2B-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAE4-1rXXoM5jM0fKzeusdnVoPCj5PCLxW482xB5XKW3%3D34vXeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Filters that alter document structure?
       [not found]         ` <CAE4-1rXXoM5jM0fKzeusdnVoPCj5PCLxW482xB5XKW3=34vXeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-20 11:16           ` Mark Szepieniec
       [not found]             ` <CAE4-1rWu-yF0TmwXqW7YJ2HrfXvgxtE1fwdZUo2hUmfd2=fkYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Szepieniec @ 2014-11-20 11:16 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

For future reference, John gave me a good answer to a rephrasing of this
question that I posted on stackoverflow:

http://stackoverflow.com/questions/27028345/permitted-function-types-in-pandoc-filters

The key is that ToJSONFilter has an instance for functions of type (a ->
[a]), which uses functions from Data.Pandoc.Generic, and therefore
sidesteps the Walkable infrastructure.

On Mon, Nov 17, 2014 at 6:58 PM, Mark Szepieniec <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Hi Matthew,
>
> thanks for your response. Your suggestion of writing functions of type
> Block -> [Block] works, I agree it's idiomatic, and it should cover all the
> functionality I'd like to write.
>
> However, this means I was understanding the code incorrectly, so I'd like
> to ask a follow-up question to understand things better.
>
> The way I understood it, the signature of walk, (a ->a) -> b -> b, meant
> that a function of type Block -> [Block] would not compile, since that
> doesn't fit the a -> a bit of the signature. Also in my understanding, the
> existence of "instance Walkable a b => Walkable a [b]" just describes how
> `walk` behaves when confronted with a list instead of a single element to
> apply (f :: a->a) to. I don't see how it's related to what happens when f
> is of type a->[a].
>
> Could you (or someone else) help me understand and tell me where I'm going
> wrong?
>
> On Mon, Nov 17, 2014 at 12:24 AM, Matthew Pickering <
> matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Hi Mark,
>>
>> Firstly I tend to regard the null the document model as unnecessary as
>> most things are stored in lists anyway. I would try to avoid it.
>>
>> If you consult the documentation for the traversal functions then you can
>> see all the ppssible filter types.[1] For example the instance Walkable
>> Inline Inline means that it's possible to writer a filter with type Inline
>> -> Inline.
>>
>> Also notice that there is an instance Walkable a b => Walkable a [b].
>> This means you can also write functions with type Block -> [Block] for
>> example. A useful idiom is usi g the empty list to completely omit a
>> section of the document.
>>
>> Am I misunderstanding the question? Do you wish to write a filter which
>> does something to a block depending on the next block for example? If you
>> have a specific filter you would like to write then I could give more
>> specific advice.
>>
>> [1]:
>> http://hackage.haskell.org/package/pandoc-types-1.12/docs/Text-Pandoc-Walk.html
>> On 16 Nov 2014 21:22, "Mark Szepieniec" <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> I have a complex html document that I've read into pandoc, and I'm
>>> trying to write filters that will isolate the content I'm after. Some
>>> examples of this are dropping certain Divs entirely, or replacing Tables by
>>> just the content of their rows.
>>>
>>> I can write filters of the type Pandoc -> Pandoc which is workable for
>>> changing the top-level structure of a document, but would become very
>>> tedious when Blocks are nested. I could also write my functions to
>>> return Null :: Block when removing Blocks, but that doesn't feel like
>>> the right way to do it. Or is that perhaps precisely why Null is there
>>> in the first place?
>>>
>>> I'd like to be able to write functions of type [Block] -> [Block] to
>>> use in filters, but I get the error
>>>
>>> No instance for (Text.Pandoc.Walk.Walkable [Block] Pandoc).
>>>
>>> I tried to think about how to write that instance, but it's hard to
>>> choose between walking lists of Blocks with applying the function to them.
>>>
>>> So I feel I might be either missing something obvious, or going about it
>>> in the wrong way. Is there perhaps a simple solution to what I want to do?
>>> Or something that could be worth implementing?
>>>
>>> --
>>> 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/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> 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/CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13%2B-Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13%2B-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/CAE4-1rWu-yF0TmwXqW7YJ2HrfXvgxtE1fwdZUo2hUmfd2%3DfkYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Filters that alter document structure?
       [not found]             ` <CAE4-1rWu-yF0TmwXqW7YJ2HrfXvgxtE1fwdZUo2hUmfd2=fkYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-20 11:51               ` Matthew Pickering
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Pickering @ 2014-11-20 11:51 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Sorry for the misinformation Mark! Looking back at the definitions,
you are right that it does not make sense.

On Thu, Nov 20, 2014 at 11:16 AM, Mark Szepieniec <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> For future reference, John gave me a good answer to a rephrasing of this
> question that I posted on stackoverflow:
>
> http://stackoverflow.com/questions/27028345/permitted-function-types-in-pandoc-filters
>
> The key is that ToJSONFilter has an instance for functions of type (a ->
> [a]), which uses functions from Data.Pandoc.Generic, and therefore sidesteps
> the Walkable infrastructure.
>
> On Mon, Nov 17, 2014 at 6:58 PM, Mark Szepieniec <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>> Hi Matthew,
>>
>> thanks for your response. Your suggestion of writing functions of type
>> Block -> [Block] works, I agree it's idiomatic, and it should cover all the
>> functionality I'd like to write.
>>
>> However, this means I was understanding the code incorrectly, so I'd like
>> to ask a follow-up question to understand things better.
>>
>> The way I understood it, the signature of walk, (a ->a) -> b -> b, meant
>> that a function of type Block -> [Block] would not compile, since that
>> doesn't fit the a -> a bit of the signature. Also in my understanding, the
>> existence of "instance Walkable a b => Walkable a [b]" just describes how
>> `walk` behaves when confronted with a list instead of a single element to
>> apply (f :: a->a) to. I don't see how it's related to what happens when f is
>> of type a->[a].
>>
>> Could you (or someone else) help me understand and tell me where I'm going
>> wrong?
>>
>> On Mon, Nov 17, 2014 at 12:24 AM, Matthew Pickering
>> <matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>
>>> Hi Mark,
>>>
>>> Firstly I tend to regard the null the document model as unnecessary as
>>> most things are stored in lists anyway. I would try to avoid it.
>>>
>>> If you consult the documentation for the traversal functions then you can
>>> see all the ppssible filter types.[1] For example the instance Walkable
>>> Inline Inline means that it's possible to writer a filter with type Inline
>>> -> Inline.
>>>
>>> Also notice that there is an instance Walkable a b => Walkable a [b].
>>> This means you can also write functions with type Block -> [Block] for
>>> example. A useful idiom is usi g the empty list to completely omit a section
>>> of the document.
>>>
>>> Am I misunderstanding the question? Do you wish to write a filter which
>>> does something to a block depending on the next block for example? If you
>>> have a specific filter you would like to write then I could give more
>>> specific advice.
>>>
>>> [1]:
>>> http://hackage.haskell.org/package/pandoc-types-1.12/docs/Text-Pandoc-Walk.html
>>>
>>> On 16 Nov 2014 21:22, "Mark Szepieniec" <mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>>
>>>> I have a complex html document that I've read into pandoc, and I'm
>>>> trying to write filters that will isolate the content I'm after. Some
>>>> examples of this are dropping certain Divs entirely, or replacing Tables by
>>>> just the content of their rows.
>>>>
>>>> I can write filters of the type Pandoc -> Pandoc which is workable for
>>>> changing the top-level structure of a document, but would become very
>>>> tedious when Blocks are nested. I could also write my functions to return
>>>> Null :: Block when removing Blocks, but that doesn't feel like the right way
>>>> to do it. Or is that perhaps precisely why Null is there in the first place?
>>>>
>>>> I'd like to be able to write functions of type [Block] -> [Block] to use
>>>> in filters, but I get the error
>>>>
>>>> No instance for (Text.Pandoc.Walk.Walkable [Block] Pandoc).
>>>>
>>>> I tried to think about how to write that instance, but it's hard to
>>>> choose between walking lists of Blocks with applying the function to them.
>>>>
>>>> So I feel I might be either missing something obvious, or going about it
>>>> in the wrong way. Is there perhaps a simple solution to what I want to do?
>>>> Or something that could be worth implementing?
>>>>
>>>> --
>>>> 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/CAE4-1rWH__%3Dcx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw%40mail.gmail.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> 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/CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13%2B-Q%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> 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/CAE4-1rWu-yF0TmwXqW7YJ2HrfXvgxtE1fwdZUo2hUmfd2%3DfkYQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.


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

end of thread, other threads:[~2014-11-20 11:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-16 21:22 Filters that alter document structure? Mark Szepieniec
     [not found] ` <CAE4-1rWH__=cx1yrY9P85GVjwfenckzEg6UjMTdGQ4HQVCmriw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-16 23:24   ` Matthew Pickering
     [not found]     ` <CALuQ0m9f2MC-OnKKagOqDnwGkY-c6ug6TCoJrehdhMfyb13+-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-17 17:58       ` Mark Szepieniec
     [not found]         ` <CAE4-1rXXoM5jM0fKzeusdnVoPCj5PCLxW482xB5XKW3=34vXeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-20 11:16           ` Mark Szepieniec
     [not found]             ` <CAE4-1rWu-yF0TmwXqW7YJ2HrfXvgxtE1fwdZUo2hUmfd2=fkYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-20 11:51               ` Matthew Pickering

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).