ea6a7cfcacd8

Merged celdredge/hgext.markdown into default
[view raw] [browse files]
author Constantine Linnick <theaspect@gmail.com>
date Tue, 08 Oct 2013 00:31:38 +0700
parents 5a8c3dda25ee (diff) 61b435d17646 (current diff)
children 42f23a3f2f1b
branches/tags (none)
files __init__.py

Changes

diff -r 61b435d17646 -r ea6a7cfcacd8 ReadMe.markdown
--- a/ReadMe.markdown	Mon Oct 07 17:24:34 2013 +0100
+++ b/ReadMe.markdown	Tue Oct 08 00:31:38 2013 +0700
@@ -13,6 +13,14 @@
 [WikiLinks](http://packages.python.org/Markdown/extensions/wikilinks.html) extension
 to support documentation split across several pages.
 
+You can add relative links to [nested](relative/doca.md) pages, or to current [headers](#config),
+or even to images 
+_(actually at BitBucket relative links are
+[broken](https://bitbucket.org/site/master/issue/6315/relative-urls-in-readmemd-files-only-work) 
+and you don't see logo, but hgext.markdown can do it :)_
+
+![logo](relative/logo.png)
+
 ##Install##
 
 1. Install Python-Markdown (http://packages.python.org/Markdown/install.html)
diff -r 61b435d17646 -r ea6a7cfcacd8 __init__.py
--- a/__init__.py	Mon Oct 07 17:24:34 2013 +0100
+++ b/__init__.py	Tue Oct 08 00:31:38 2013 +0700
@@ -80,7 +80,6 @@
     f = req.form.get('file', [''])[0]
     parts = os.path.splitext(f)
 
-
     if 'file' not in req.form:
         return webcommands.manifest(web, req, tmpl)
 
@@ -100,8 +99,9 @@
     if util.binary(text):
         return webcommands.rawfile(web, req, tmpl)
 
-    base_url = tmpl.defaults['url'] + 'file/' + changeid + "/"
-    base_raw_url = tmpl.defaults['url'] + 'rawfile/' + changeid + "/"
+    relative_path = os.path.split(f)[0]
+    base_url = tmpl.defaults['url'] + 'file/' + changeid + "/" + relative_path
+    base_raw_url = tmpl.defaults['url'] + 'rawfile/' + changeid + "/" + relative_path
 
     def rebase(proc, e, attr):
         uri = e.get(attr, '')
diff -r 61b435d17646 -r ea6a7cfcacd8 relative/doca.md
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/relative/doca.md	Tue Oct 08 00:31:38 2013 +0700
@@ -0,0 +1,4 @@
+#Relative links demo
+
+- [Sibling page B](docb.md)
+- [Parent page](../ReadMe.markdown)
\ No newline at end of file
diff -r 61b435d17646 -r ea6a7cfcacd8 relative/docb.md
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/relative/docb.md	Tue Oct 08 00:31:38 2013 +0700
@@ -0,0 +1,4 @@
+#Relative links demo
+
+- [Sibling page A](doca.md)
+- [Parent page](../ReadMe.markdown)
\ No newline at end of file
diff -r 61b435d17646 -r ea6a7cfcacd8 relative/logo.png
Binary file relative/logo.png has changed