mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-28 18:35:49 +00:00
24 lines
513 B
Python
Executable File
24 lines
513 B
Python
Executable File
#!/usr/bin/env python
|
|
from pandoc import toJSONFilter
|
|
import re
|
|
|
|
incomment = False
|
|
|
|
def comment(k,v,format=""):
|
|
global incomment
|
|
if k == 'RawBlock':
|
|
f, s = v
|
|
fmt = f['unFormat']
|
|
if fmt == "html":
|
|
if re.search("<!-- BEGIN COMMENT -->", s):
|
|
incomment = True
|
|
return []
|
|
elif re.search("<!-- END COMMENT -->", s):
|
|
incomment = False
|
|
return []
|
|
if incomment:
|
|
return [] # suppress anything in a comment
|
|
|
|
if __name__ == "__main__":
|
|
toJSONFilter(comment)
|