How to use the pandocfilters.json.dump function in pandocfilters

To help you get started, we’ve selected a few pandocfilters examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aaren / pandoc-reference-filter / internalreferences / internalreferences.py View on Github external
empty list deletes the object.)
    """
    doc = pf.json.loads(pf.sys.stdin.read())
    if len(pf.sys.argv) > 1:
        format = pf.sys.argv[1]
    else:
        format = ""

    if type(actions) is type(toJSONFilter):
        altered = pf.walk(doc, actions, format, doc[0]['unMeta'])
    elif type(actions) is list:
        altered = doc
        for action in actions:
            altered = pf.walk(altered, action, format, doc[0]['unMeta'])

    pf.json.dump(altered, pf.sys.stdout)
github aaren / pandoc-reference-filter / internalreferences.py View on Github external
if len(pf.sys.argv) > 1:
        format = pf.sys.argv[1]
    else:
        format = ""

    metadata = doc[0]['unMeta']
    args = {k: v['c'] for k, v in metadata.items()}
    autoref = args.get('autoref', True)

    refmanager = ReferenceManager(autoref=autoref)

    altered = doc
    for action in refmanager.reference_filter:
        altered = pf.walk(altered, action, format, metadata)

    pf.json.dump(altered, pf.sys.stdout)
github BIDS / pandoc-templates / report / bin / pandocCommentFilter.py View on Github external
# required (when `` has been used).
    if (format == 'latex' or format == 'beamer') and USED_BOX:
        MetaList = elt('MetaList', 1)
        MetaInlines = elt('MetaInlines', 1)
        rawinlines = [MetaInlines([RawInline('tex',
                                             '\\RequirePackage{mdframed}')])]
        if 'header-includes' in metadata:
            headerIncludes = metadata['header-includes']
            if headerIncludes['t'] == 'MetaList':
                rawinlines += headerIncludes['c']
            else:  # headerIncludes['t'] == 'MetaInlines'
                rawinlines += [headerIncludes]
        metadata['header-includes'] = MetaList(rawinlines)
        newDocument['meta'] = metadata

    json.dump(newDocument, sys.stdout)
github aaren / pandoc-reference-filter / internalreferences.py View on Github external
empty list deletes the object.)
    """
    doc = pf.json.loads(pf.sys.stdin.read())
    if len(pf.sys.argv) > 1:
        format = pf.sys.argv[1]
    else:
        format = ""

    if type(actions) is type(toJSONFilter):
        altered = pf.walk(doc, actions, format, doc[0]['unMeta'])
    elif type(actions) is list:
        altered = doc
        for action in actions:
            altered = pf.walk(altered, action, format, doc[0]['unMeta'])

    pf.json.dump(altered, pf.sys.stdout)