Created
October 19, 2011 08:45
-
-
Save sn00011/1297755 to your computer and use it in GitHub Desktop.
for issue #37504
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git markdown.php markdown.php | |
index ed79197..0cde939 100644 | |
--- markdown.php | |
+++ markdown.php | |
@@ -761,6 +761,17 @@ class Markdown_Parser { | |
$url = $this->encodeAttribute($url); | |
+ // For some links like [xxx](/node/xxx), turn them into absolute ones | |
+ // so when they're contained in feeds, the W3C feed validator won't | |
+ // complain about the relative urls. | |
+ // @see issue #37504 | |
+ if (strpos($url, '/') === 0) { | |
+ // Remove the leading slash | |
+ $url = ltrim($url, '/'); | |
+ // Use drupal's url() to generate an absolute url | |
+ $url = url($url, array('absolute' => TRUE)); | |
+ } | |
+ | |
$result = "<a href=\"$url\""; | |
if (isset($title)) { | |
$title = $this->encodeAttribute($title); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment