List for cgit developers and users
 help / color / mirror / Atom feed
From: mail at eworm.de (Christian Hesse)
Subject: [PATCH 1/1] filters: in markdown get images from their plain url
Date: Thu, 17 Apr 2014 13:42:32 +0200	[thread overview]
Message-ID: <1397734952-18882-1-git-send-email-mail@eworm.de> (raw)
In-Reply-To: <20140417130241.551fcc94@leda.localdomain>

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 = "<img src=\"$url\" alt=\"$alt_text\"";
 			if (defined $g_titles{$link_id}) {
 				my $title = $g_titles{$link_id};
@@ -977,6 +978,7 @@ sub _DoImages {
 		$title    =~ s/"/&quot;/g;
 		$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 = "<img src=\"$url\" alt=\"$alt_text\"";
 		if (defined $title) {
 			$title =~ s! \* !$g_escape_table{'*'}!gx;
-- 
1.9.2



  reply	other threads:[~2014-04-17 11:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 10:13 Images on about page list
2014-04-17 10:18 ` list
2014-04-17 10:19   ` [PATCH 1/1] filters: in markdown get images from their plain url mail
2014-04-17 10:57     ` Jason
2014-04-17 11:02       ` mail
2014-04-17 11:42         ` mail [this message]
2014-04-17 11:44           ` Jason
2014-04-17 12:14             ` list
2014-04-17 13:19               ` [PATCH 1/1] about: return images in plain mode mail
2014-04-17 13:21                 ` list
2014-04-30  8:37                   ` mail
2014-06-29 20:14                   ` list
2014-06-29 21:07                     ` Jason
2014-06-30  6:31                       ` list

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397734952-18882-1-git-send-email-mail@eworm.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).