Jul-24-2018, 04:30 AM
Hi everyone I am trying to troubleshoot this issue as it is not apparent to me why the filter is failing.
Many thanks if anyone can solve the issue!
Here is the source of include_markdown.py
Many thanks if anyone can solve the issue!
pandoc -f markdown --filter /tmp/creation/pandoc_filters/include_markdown.py --filter /tmp/creation/pandoc_filters/convert_link_ext.py --filter /tmp/creation/pandoc_filters/include_code.py -t html5 -s --toc --toc-depth=3 --section-divs -c ./css/notes_toc.css -H /tmp/creation/page_includes/bc.html -o publish/index.html.html source/index.html.md
Quote:pandoc: Error running filter /tmp/creation/pandoc_filters/include_markdown.py
Here is the source of include_markdown.py
import os import panflute as pf def is_include_line(elem): if len(elem.content) < 3: return False elif not all (isinstance(x, (pf.Str, pf.Space)) for x in elem.content): return False elif elem.content[0].text != '$include': return False elif type(elem.content[1]) != pf.Space: return False else: return True def get_filename(elem): fn = pf.stringify(elem, newlines=False).split(None,1)[1] print fn if not os.path.splitext(fn)[1]: fn += '.md' return fn def action(elem, doc): if isinstance(elem, pf.Para) and is_include_line(elem): fn = get_filename(elem) if not os.path.isfile(fn): return with open(fn) as f: raw = f.read() new_elems = pf.convert_text(raw) # Alternative A: return new_elems # Alternative B: # div = pf.Div(*new_elems, attributes={'source': fn}) # return div def main(doc=None): return pf.run_filter(action, doc=doc) if __name__ == '__main__': main()