Also transform now doesn't do the traversing by itself but is called by panflute's walk.
10 lines
239 B
Python
10 lines
239 B
Python
from panflute import Element, Block, Inline
|
|
import re
|
|
|
|
def replaceEl(e: Element, r: Element) -> Element:
|
|
parent = e.parent
|
|
parent.content[e.index] = r
|
|
r.parent = parent
|
|
return r
|
|
def deleteEl(e: Element):
|
|
del e.parent.content[e.index]
|