#!/usr/bin/env python from pandoc import toJSONFilter import re """ Pandoc filter that causes everything between '' and '' to be ignored. The comment lines must appear on lines by themselves, with blank lines surrounding them. """ incomment = False def comment(k,v,fmt): global incomment if k == 'RawBlock': fmt, s = v if fmt == "html": if re.search("", s): incomment = True return [] elif re.search("", s): incomment = False return [] if incomment: return [] # suppress anything in a comment if __name__ == "__main__": toJSONFilter(comment)