Skip to content

Support an action that takes an asynchronous callback #7

@shreevatsa

Description

@shreevatsa

I don't know enough about JavaScript to know whether this is the same issue as #1 (though I suspect it is), but let me describe it anyway :-)

All the examples end with pandoc.stdio(action) where action is a function like:

function action(type, value, format, meta) {
    // ...
    return something;
}

In my case, inside action I need to call a function that takes a callback (as is typical for Node):

function action(type, value, format, meta) {
    // ...
   doAsync(value, function () { ... });
}

So I won't have something to return from inside action.

I am right now trying to hack it out by copying and editing much of the internals of pandoc-filter.
(Specifically, stdio which is an alias for toJSONFilter calls filter which calls walk and it appears I need to hack a copy of that function: https://github.com/mvhenderson/pandoc-filter-node/blob/be9d69ac/index.js#L47,L79 .)

But I imagine this is a common use case, and it would be better if pandoc-filter supported this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions