Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pandoc_include/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def skipWhitespaces(content):
return pos

def removeLeadingWhitespaces(s, num):
if not s.strip():
return s
regex = re.compile(r"[^\s]")
m = regex.search(s)
if m == None:
Expand Down Expand Up @@ -155,9 +157,14 @@ def read_file(filename, config: dict):
snippets.append(content[start:subEnd])
start = end
content = "\n".join(snippets)

if "dedent" in config:
content = "\n".join(dedent(content, config["dedent"]))

try:
if "dedent" in config:
content = "\n".join(dedent(content, config["dedent"]))
except Exception as e:
import sys
print(f"Filename {filename} config {config}", file=sys.stderr)
raise e

return content

Expand Down