Start notes filter
This commit is contained in:
parent
4a7bfff7e4
commit
73cbe8e371
38
notes.py
Normal file
38
notes.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# file notes.py
|
||||||
|
# author Florent Guiotte <florent.guiotte@uhb.fr>
|
||||||
|
# version 0.0
|
||||||
|
# date 27 mai 2019
|
||||||
|
"""Abstract
|
||||||
|
|
||||||
|
doc.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import panflute as pf
|
||||||
|
import re
|
||||||
|
|
||||||
|
f = None
|
||||||
|
|
||||||
|
def prepare(doc):
|
||||||
|
global f
|
||||||
|
doc.ignore = False
|
||||||
|
f = open('test.pdfpc', 'w')
|
||||||
|
|
||||||
|
def comment(el, doc):
|
||||||
|
global f
|
||||||
|
is_relevant = (type(el) == pf.RawBlock)# and (el.format == 'html')
|
||||||
|
if is_relevant and re.search("::notes", el.text):
|
||||||
|
doc.ignore = True
|
||||||
|
if doc.ignore:
|
||||||
|
if is_relevant and re.search("::", el.text):
|
||||||
|
doc.ignore = False
|
||||||
|
f.write('{}\n'.format(el.text))
|
||||||
|
return []
|
||||||
|
|
||||||
|
def finalize(doc):
|
||||||
|
global f
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
pf.toJSONFilter(comment, prepare=prepare, finalize=finalize)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user