pandocfilters-php icon indicating copy to clipboard operation
pandocfilters-php copied to clipboard

Error due to change in pandoc AST

Open bumper314 opened this issue 9 years ago • 3 comments

The error:

Fatal error: Cannot use object of type stdClass as array in pandocfilters-php/pandocfilters.php on line 90

At some point pandoc changed the meta part of the AST. Here's how pandocfilters (python) fixed it, but I don't know how to achieve the same result in php: https://github.com/jgm/pandocfilters/commit/039dcc65bc10a14f9038a3671c795198bd50c15a

bumper314 avatar Jan 31 '17 02:01 bumper314

I changed the call to walk to the following:

    $altered = self::walk(
        $doc,
        $action,
        $format,
        isset($doc->meta) ? $doc->meta : (isset($doc[0]) && isset($doc[0]->unMeta) ? $doc[0]->unMeta : null)
    );

It works for me now (pandoc version is 1.19.2.1).

pestaa avatar Aug 29 '17 12:08 pestaa

I fixed this issue and another issue in my fork: https://github.com/glassdimly/pandocfilters-php

Here's the branch if the repo admin wants to merge my commits in: https://github.com/glassdimly/pandocfilters-php/tree/cannot_use_object_as_array

glassdimly avatar Aug 01 '18 02:08 glassdimly

Hi, that's great - can you open a pull request? I'd be happy to accept it!

Vinai avatar Aug 01 '18 06:08 Vinai