28 lines
583 B
Python
Executable File
28 lines
583 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
from pandocfilters import toJSONFilter, Header
|
|
import sys
|
|
|
|
|
|
def behead(key, value, format, meta):
|
|
if key == "Header" and value[0] >= 2:
|
|
return Header(
|
|
value[0],
|
|
value[1],
|
|
[
|
|
{
|
|
"t": "Link",
|
|
"c": [
|
|
["", [], []],
|
|
value[2],
|
|
["#" + value[1][0], ""],
|
|
],
|
|
}
|
|
],
|
|
)
|
|
return None
|
|
|
|
|
|
if __name__ == "__main__":
|
|
toJSONFilter(behead)
|