pirave / postmarkup

Automatically exported from code.google.com/p/postmarkup
0 stars 0 forks source link

Support local links #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. [link=/photos/]See photos here[/link]

What is the expected output? What do you see instead?
Expected: <a href="/photos/">See photos here</a>
I see instead: See photos here

What version of the product are you using? On what operating system?

Please provide any additional information below.

Patch in attachment

Original issue reported on code.google.com by frolvlad on 21 Jan 2012 at 6:12

Attachments:

GoogleCodeExporter commented 8 years ago
Not sure how useful that is for the general case users commenting. Generally 
you just copy the url from the address bar to the url tag. Local links also 
make the content dependant on the current domain. If you display the content on 
a mobile site, for example, it could break the links.

Thanks for the patch, but I won't be applying it. If you could make it optional 
and not the default I may reconsider...

Original comment by willmcgugan on 21 Jan 2012 at 7:12

GoogleCodeExporter commented 8 years ago
Ok, I'll make it optional and not the default.

Original comment by frolvlad on 21 Jan 2012 at 7:17

GoogleCodeExporter commented 8 years ago
BTW, I think that your example about mobile site version is strange. If links 
at desktop and mobile versions differ then you are doing something wrong. If 
mobile version developed right, then local links navigate through mobile 
version.

Original comment by frolvlad on 21 Jan 2012 at 7:29

GoogleCodeExporter commented 8 years ago
Here is patch with optional local_links.

Demonstration:

In [1]: from postmarkup.parser import create

In [14]: render_bbcode = create().render_to_html

In [15]: render_bbcode('[link=/photos/]See photos[/link]')
Out[15]: u'See photos'

In [16]: render_bbcode = create(local_links=True).render_to_html

In [17]: render_bbcode('[link=/photos/]See photos[/link]')
Out[17]: u'<a href="/photos/">See photos</a>'

Original comment by frolvlad on 21 Jan 2012 at 9:10

Attachments: