Modified transclusions to ignore headers in files.
h3rald h3rald@h3rald.com
Sun, 12 Nov 2017 16:54:54 +0100
1 files changed,
15 insertions(+),
1 deletions(-)
jump to
M
hastyscribe.nim
→
hastyscribe.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]