Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2012-02-24 21:14:38
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
[textile] Automatically make links from URLs.
Dave-lew99 has suggested, here, that textile should automatically covert URL-like text (like forum.textpattern.com
) into real hyperlinks.
Would anyone else find this useful?
Speaking for myself, if this feature is of interest to several parties, I think I’d need a way of telling textile which URL-like text I either did — or did not — want to be hyperventilated, as I probably wouldn’t want every instance of textpattern.com I type in an article to become a link.
— Steve
Offline
Re: [textile] Automatically make links from URLs.
Being that now Textile provides the "$":http://example.com
trick, I’m not sure if I’d like the auto-conversion of any URL-like text.
Certainly, auto-converting any.string.of.text.separated.by.dots.com
into a link may backfire quickly.
Also, Dave-lew99 said:
The main one i’d like to see is when URLs are entered they are automatically turned into links – without any special syntax. Textile as default obviously only does this if you specify links like Google.
The example he includes is wrong, as Textile will render that, but as a relative link. That’s something I’d definitely like to see changed (although I admit I’m not considering all the implications).
So, these are my comments:
"Google":www.google.com
.
Currently: it converts to a relative (usually wrong) link.
Desired: I’d prefer Textile accepting this kind of absolute links, without the need of specifying the protocol (so, assuming http://
). My experience is that many Textile newcomers (and even experts) tend to make this mistake somewhat often.
forum.textpattern.com
Currently: it doesn’t auto-link.
Desired: definitely, I wouldn’t auto-link this kind of plain-text, dot.separated, without protocol, URL-like strings.
"$":forum.textpattern.com
Similar case than first example.
Currently: Textile converts it to a relative link.
Desired: idem than first case.
http://:forum.textpattern.com
Currently: Textile doesn’t auto-link it.
Desired: it may come in handy to auto-link this kind of plain-text URL, although I’d like a way (ie. some syntax or a global preference) to escape this behaviour. In any case, I repeat, we have the "$":http://example.com
syntax that is good enough, imho.
My 2 cents!
Offline
Re: [textile] Automatically make links from URLs.
maniqui wrote:
we have the
"$":http://example.com
syntax that is good enough, imho.
+1
Offline
Re: [textile] Automatically make links from URLs.
+2
Offline
Re: [textile] Automatically make links from URLs.
Another downvote for automatic URLs. No need. Just makes the page unnecessarily linky, especially if referring to the same URL a few times. The first is usually the only one I’d link.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [textile] Automatically make links from URLs.
+4
I am setting links on purpose :)
Example: Sometimes I replace dead links with Archive.org links plus a note “(Archive.org link)” which I definitely don’t want to be linked.
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
Re: [textile] Automatically make links from URLs.
I would accept a half automatic feature.
"www.example.com":
"user@domain.com":
<!-- allow style and title -->
Could be textiled to text with http://
and mailto:
links.
Would that make sense (add textile super power)?
Edit: Better with double colon "www.example.com"::
?
Last edited by merz1 (2012-02-25 15:01:43)
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
#8 2012-02-25 22:03:57
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [textile] Automatically make links from URLs.
Well, following some auto-linking gaffs over in github’s ‘github flavoured Markdown’ comment system, I’m now pretty firmly in the camp against auto-linking URL-like patterns.
I do, however, have a couple of little niggles with the output of the "$":url
textile 2.2 construct. Specifically, it’s always bugged me somewhat (and from Markus’ post above, I think him too) that http, mailto and https schemes get copied straight into the linked text. I therefore offer feature/48-simplelinks as an experiment (feel free to pull the branch and try it out) that I think improves the output.
Input text | v2.2 output | 48-simplelinks output |
"$":http://google.com |
http://google.com | google.com |
"$":https://google.com |
https://google.com | google.com << Comment: Link uses https |
"$":mailto://blackhole sun.comet@ |
mailto://blackhole@sun.comet | blackhole@sun.comet << Comment: Link uses mailto |
Is this an improvement on the current “$” output?
Last edited by net-carver (2012-02-25 22:07:38)
— Steve
Offline
#9 2012-02-26 10:20:47
- davelew99
- New Member
- Registered: 2012-02-10
- Posts: 2
Re: [textile] Automatically make links from URLs.
Hello all,
It seems I got my example a little screwed up (with the relative vs absolute URLs).
The background to my initial query is that I am developing an internal system which is for asset tracking, we already use Redmine which makes use of Textile to process it’s wiki markup, all of our staff are very familier with this.
Clearly Redmine’s usage of textile isn’t the same as the default since it supports markup for URI’s and /#[\d]/ and /r[\d]/ which refer to issue numbers and source code revisions respectively.
The number of URI’s it supports is limited (I believe limited to http and https).
The reason my Textile query came about is that I wanted to know why the standard version didn’t behave in the same manner as the Redmine implementation (clearly theirs is either custom or derived from the Ruby version rather than PHP).
The users of the system won’t be happy about having to remember two different ways of encoding URLs into links – often links are copy-pasted and no one wants to worry about tidying it up.
Perhaps I can propose that a method which should please most: to allow strings with certain URIs be encoded into absolute links, with this behaviour disabled by default. It may be wise to include optional behaviour disabling link formatting within code type blocks.
Leading on this from this it may be possible to include options to enable auto-linking on a per-URI type basis.
Otherwise I will have to pre- or post- process text into Textile to add links in myself and that seems a shame to have to do that additional work.
Seeing as how most of you have objected to having any dotted string turned into a link (which i agree would be problematic) having to include the URI should solve that, and again, the behaviour must be configurable. Few people type out links – they are almost always copy-pasted into the text, to quickly refer to some research or another internal web-page.
Offline
Re: [textile] Automatically make links from URLs.
Otherwise I will have to pre- or post- process text into Textile to add links in myself and that seems a shame to have to do that additional work.
In case you don’t have any luck getting Textile changed to fit, there are some jQuery methods out there that would seem to do this pretty painlessly.
Offline
#11 2012-02-26 22:24:53
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [textile] Automatically make links from URLs.
Hello & welcome to the textpattern forum davelew99,
Just exploring a few of your points a little here…
Hello all,
It seems I got my example a little screwed up (with the relative vs absolute URLs).
No matter, the intent was understood.
The users of the system won’t be happy about having to remember two different ways of encoding URLs into links – often links are copy-pasted and no one wants to worry about tidying it up.
Clearly Redmine’s usage of textile isn’t the same as the default … (clearly theirs is either custom or derived from the Ruby version rather than PHP).
Even Redcloth doesn’t autolink url-like text, so they must be using a custom version. Perhaps you could just use a copy of Redmine’s classTextile.php (or the equiv. Ruby file) for your project — providing the license allows. You can call out to other programming languages if needed via shell calls in php.
Perhaps I can propose that a method which should please most: to allow strings with certain URIs be encoded into absolute links, with this behaviour disabled by default. It may be wise to include optional behaviour disabling link formatting within code type blocks.
Sure. If autolinking does get into textile in some form, it will not be happening inside code or pre blocks. GHFMarkdown let me down badly with that yesterday.
Leading on this from this it may be possible to include options to enable auto-linking on a per-URI type basis.
Not sure what you have in mind here. Do you mean something embedded within the textile source at all — something like a compiler directive in a source file? Or perhaps another option to either the constructor or TextileThis()
/ TextileRestricted()
?
Otherwise I will have to pre- or post- process text into Textile to add links in myself and that seems a shame to have to do that additional work.
As maruchan points out, & I just mentioned regarding using Redmine’s implementation of textile, there are other options that should work for you.
Seeing as how most of you have objected to having any dotted string turned into a link (which i agree would be problematic) having to include the URI should solve that,
snip
Do you mean the ‘path’ part of the URI1 (eg google.com/some/path), or the ‘scheme’ part (like https://google.com)? I have, till now, been assuming that you wanted to autolink things that looked like the ‘authority’ + anything needed after that. Including the ‘scheme’ part — and perhaps restricting it to just http and https would limit the possible matches though.
Few people type out links – they are almost always copy-pasted into the text, to quickly refer to some research or another internal web-page.
Presumably, you mean few of your user group, not few of all the users of textile?
1 RFC-3986
— Steve
Offline
Re: [textile] Automatically make links from URLs.
Steve +1 for keeping the technical details under the hood when textiling links.
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline