From 7fdcb7965e9fc9b5e7133d72f0bcf64631af43dc Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 31 May 2010 21:19:47 -0300 Subject: [PATCH] Make using local links in posts easier A special string token (##POST_URL##) is recognized in post bodies and replaced with the path to the post (URL-wise) in the rendered HTML. This makes easier to have local resorces and makes links or use them as image sources in posts. --- blitiri.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blitiri.cgi b/blitiri.cgi index 0ffc81a..7816599 100755 --- a/blitiri.cgi +++ b/blitiri.cgi @@ -925,7 +925,10 @@ class Article (object): self.loaded = True def to_html(self): - return rst_to_html(self.raw_content) + dirname = os.path.dirname + post_url = '/'.join(dirname(full_url), data_path, dirname(self.path)) + rst = self.raw_content.replace('##POST_URL##', post_url) + return rst_to_html(rst) def to_vars(self): return { -- 2.43.0