From mboxrd@z Thu Jan 1 00:00:00 1970 From: mail at eworm.de (Christian Hesse) Date: Thu, 17 Apr 2014 13:42:32 +0200 Subject: [PATCH 1/1] filters: in markdown get images from their plain url In-Reply-To: <20140417130241.551fcc94@leda.localdomain> References: <20140417130241.551fcc94@leda.localdomain> Message-ID: <1397734952-18882-1-git-send-email-mail@eworm.de> URLs starting with two slashes or containing '://' are expected to be absolut and therefore not modified. Relative URLs are prefixed with '../plain/' to get a plain version from cgit. --- filters/html-converters/resources/markdown.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/filters/html-converters/resources/markdown.pl b/filters/html-converters/resources/markdown.pl index 34337c2..365f8b6 100755 --- a/filters/html-converters/resources/markdown.pl +++ b/filters/html-converters/resources/markdown.pl @@ -925,6 +925,7 @@ sub _DoImages { my $url = $g_urls{$link_id}; $url =~ s! \* !$g_escape_table{'*'}!gx; # We've got to encode these to avoid $url =~ s! _ !$g_escape_table{'_'}!gx; # conflicting with italics/bold. + $url = "../plain/$url" unless $url =~ m/(^|:)\/\//; $result = "