all repos — hastyscribe @ 55d44815ab6023307fe2b5ed1df7b8166660d6dc

A professional markdown compiler.

Modified transclusions to ignore headers in files.
h3rald h3rald@h3rald.com
Sun, 12 Nov 2017 16:54:54 +0100
commit

55d44815ab6023307fe2b5ed1df7b8166660d6dc

parent

c38427363cbb90c87e0ff57a12ca8aa689659b79

1 files changed, 15 insertions(+), 1 deletions(-)

jump to
M hastyscribe.nimhastyscribe.nim

@@ -178,7 +178,21 @@ let value = matches[1].strip

let offset = value.split("||")[0].parseInt() + offset if path.fileExists(): let fileInfo = path.splitFile() - let contents = path.readFile() + var contents, s = "" + var delimiter = 0 + var f:File + discard f.open(path) + # Ignore headers + try: + while f.readLine(s): + if delimiter >= 2: + contents &= s&"\n" + else: + if s.startsWith("----"): + delimiter.inc + except: + discard + f.close() result = result.replace(transclusion, hs.parse_transclusions(contents, fileInfo.dir, offset)) else: warn "File '$1' not found" % [path]