Auto links eg everytime you write wiki it results in a link

I was just wondering if its possible to integrate some kind of "autolinking" in spip.
I mean we have the keywords, wouldent it be rather easy to make som code that "autolinked" to pre defines sites..?
If you know of other ways to do it, please tell.. then I will check taht out !?
kindly
Tom

Yes this is possible :
it consits in adding a hook after the generation of the html code for
a post-processing.

Take as exemple the antispam plugin wich does something like this :

(it transforms everything that is a mail, so that it's obscursed for spam bots)

- it uses the pipeline "post_propre" to insert it's treatment (it's
specified in plugin.xml)
- you find then the corresponding function
function antispam_post_propre ($texte) {
  include_spip("inc/antispam_fonctions");
  $texte = preg_replace_callback('`(<a
href="mailto:.*?>)(.*?)(</a>)`s',"antispam_crypter",$texte);
  return $texte;
}

You can do your "autolinking" with the same mecanism

.Gilles
--
2007/7/4, Tom Dissing <tom@mir.dk>:

I was just wondering if its possible to integrate some kind of
"autolinking" in spip.
I mean we have the keywords, wouldent it be rather easy to make som
code that "autolinked" to pre defines sites..?
If you know of other ways to do it, please tell.. then I will check
taht out !?
kindly
Tom

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

This isn't going to help much, but I also remember seeing a contrib
that checks all text for potential links and uses a similar
post-processing technique to automatically turn them into real links.
I think it was in a contrib that dealt with processing CSV files and
presenting them in-stream as HTML tables.
I'm sure it's not hard to find and adapt along with Gilles' comments.

Specifying a particular keyword group as the definitive source of such
keywords to auto-linkify is a great idea ... maybe I go do the same
thing later today... let me know if you come up with any other ideas
to include....

Mark

----- Original message -----
From: "Gilles Vincent" <gilles.vincent@elycoop.fr>
Date: Wed, 4 Jul 2007 04:09:21 +0200
Subject: Re: [Spip-en] Auto links eg everytime you write wiki it results in a link
To: "Tom Dissing" <tom@mir.dk>
Cc: spip-en <spip-en@rezo.net>

Yes this is possible :
it consits in adding a hook after the generation of the html code for
a post-processing.

Take as exemple the antispam plugin wich does something like this :
Plugin antispam - SPIP-Contrib
(it transforms everything that is a mail, so that it's obscursed for spam bots)

- it uses the pipeline "post_propre" to insert it's treatment (it's
specified in plugin.xml)
- you find then the corresponding function
function antispam_post_propre ($texte) {
include_spip("inc/antispam_fonctions");
$texte = preg_replace_callback('`(<a
href="mailto:.*?>)(.*?)(</a>)`s',"antispam_crypter",$texte);
return $texte;
}

You can do your "autolinking" with the same mecanism

.Gilles
--
2007/7/4, Tom Dissing <tom@mir.dk>:

I was just wondering if its possible to integrate some kind of
"autolinking" in spip.
I mean we have the keywords, wouldent it be rather easy to make som
code that "autolinked" to pre defines sites..?
If you know of other ways to do it, please tell.. then I will check
taht out !?
kindly
Tom

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

My idea was to do it with a plugin. so it processes every page stored in cache.
However, the limit of my simple comment is that the regexp, here, is
fixed in the hook function : it can be a parameter in mes_options, but
it's not dynamically managed throught spip keywords and keywords
groups. However you can use mysql queries to get them.. It's a little
more complicated but not so much imho..

.Gilles
--
2007/7/4, Mark Baber <mark.baber@novado.ch>:

This isn't going to help much, but I also remember seeing a contrib
that checks all text for potential links and uses a similar
post-processing technique to automatically turn them into real links.
I think it was in a contrib that dealt with processing CSV files and
presenting them in-stream as HTML tables.
I'm sure it's not hard to find and adapt along with Gilles' comments.

Specifying a particular keyword group as the definitive source of such
keywords to auto-linkify is a great idea ... maybe I go do the same
thing later today... let me know if you come up with any other ideas
to include....

Mark

----- Original message -----
From: "Gilles Vincent" <gilles.vincent@elycoop.fr>
Date: Wed, 4 Jul 2007 04:09:21 +0200
Subject: Re: [Spip-en] Auto links eg everytime you write wiki it results in a link
To: "Tom Dissing" <tom@mir.dk>
Cc: spip-en <spip-en@rezo.net>

>Yes this is possible :
>it consits in adding a hook after the generation of the html code for
>a post-processing.
>
>Take as exemple the antispam plugin wich does something like this :
>Plugin antispam - SPIP-Contrib
>(it transforms everything that is a mail, so that it's obscursed for spam bots)
>
>- it uses the pipeline "post_propre" to insert it's treatment (it's
>specified in plugin.xml)
>- you find then the corresponding function
>function antispam_post_propre ($texte) {
> include_spip("inc/antispam_fonctions");
> $texte = preg_replace_callback('`(<a
>href="mailto:.*?>)(.*?)(</a>)`s',"antispam_crypter",$texte);
> return $texte;
>}
>
>You can do your "autolinking" with the same mecanism
>
>.Gilles
>--
>2007/7/4, Tom Dissing <tom@mir.dk>:
>> I was just wondering if its possible to integrate some kind of
>> "autolinking" in spip.
>> I mean we have the keywords, wouldent it be rather easy to make som
>> code that "autolinked" to pre defines sites..?
>> If you know of other ways to do it, please tell.. then I will check
>> taht out !?
>> kindly
>> Tom
>>
>> _______________________________________________
>> spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en
>>
>_______________________________________________
>spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en
>
_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en