all repos — hastyscribe @ a5c7fd9d66e65e9cf7ce1db30a6b11ea5469cf4c

A professional markdown compiler.

Fixed problem with relative paths
Fabio Cevasco h3rald@h3rald.com
Mon, 24 Feb 2014 13:35:03 +0100
commit

a5c7fd9d66e65e9cf7ce1db30a6b11ea5469cf4c

parent

e43ba31d50117ab2b90ff87d6ac3376b8d6eed90

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

jump to
M hastyscribe.nimhastyscribe.nim

@@ -61,6 +61,11 @@ echo("Warning: image '"& file &"' not found.")

return file proc embed_images(document, dir): string = + var current_dir:string + if dir.len == 0: + current_dir = "" + else: + current_dir = dir & "/" type TImgData = tuple[img: string, rep: string] TImgTagStart = array[0..0, string]

@@ -75,7 +80,7 @@ var matches:TImgTagStart

discard img.match(img_peg, matches) let imgfile = matches[0] let imgformat = imgfile.substr(imgfile.find(peg"'.' @$")+1, imgfile.len-1) - let imgcontent = encode_image(dir & "/" & imgfile, imgformat) + let imgcontent = encode_image(current_dir & imgfile, imgformat) let imgrep = img.replace("\"" & img_file & "\"", "\"" & imgcontent & "\"") imgdata.add((img: img, rep: imgrep)) for i in imgdata: