if i want to link to an article with Textile
i type:
"test":foo

but this will become <a href="http://foo/">test</a>

but it should and would be better to become <a href="/foo">test</a> as you can see at http://textism.com/tools/textile/index.html
so it is much easier to link inside the own website

Please restore the default Textile bahavour!

Thanks

Tobias Maier

Comments

Tobias Maier’s picture

i found two solutions by now:

  1. edit Textile.php

    search for

        if (!preg_match('!^(/|\./|\.\./|#)!', $url)) {
          if (!preg_match('!^(https?|ftp|mailto|nntp|telnet)!', $url)) { $url = "http://$url"; }
        }
    

    comment it out
    means:

    //    if (!preg_match('!^(/|\./|\.\./|#)!', $url)) {
    //      if (!preg_match('!^(https?|ftp|mailto|nntp|telnet)!', $url)) { $url = "http://$url"; }
    //    }
    
  2. editing class MTLikeTextile in Textile.php

    goto function "function format_url"
    look for (line 3370):
    if (preg_match('/^(imdb|google|dict|amazon)(:(.+))?$/x', $url, $matches)) {
    replace it with
    if (preg_match('/^(imdb|google|dict|amazon|intern)(:(.+))?$/x', $url, $matches)) {
    add this inside the switch (line 3374) which comes after the code mentioned above:

            case 'intern':
              $args['url'] = $term;
              break;
    

    Now you can call intern pages with "my link":intern:use_firefox_because_its_better

what i don't understand is what

  function process($in_string) {
    return preg_replace('{(<a href=")(#[^"]*")}', '$1' . request_uri() . '$2', parent::process($in_string));
  }

does...
(you can find it in textile.module, line 514)

jhriggs’s picture

Status: Active » Closed (works as designed)

As this code is designed to behave the same as Brad Choate's MT code, I am hesitant to change this. I realize that this behavior is different from that described on textism, but it should be consistent with the MT implementation. This same link can be achieved by doing "test":./foo or "test":/foo instead.