DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autolink2

autolink2 Plugin

Compatible with DokuWiki

2009-12-25+ 2010-11-07 2011-05-25

plugin Register anchors to a page to be (semi)automatically linked from other pages

Last updated on
2011-10-12
Provides
Syntax, Helper, Action
Repository
Source
Conflicts with
backlinks, move

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with links

Version 3.2

Description

With this plugin you can define pages the can be (semi)automatically linked to that page. This is a new improved version of my autolink plugin.

On the page you want to link to, set:

{{autolink>some name|anchors|separated by|pipe}}

On the pages you want to put the link in, set:

<autolink>
The text on the page. Blah, blah, blah...

And of course the text Some Name. Also some name is valid, as well as SOME NAME.
|The test can be in a table also| Some Name, **but** there needs to be a space after the leading\||
</autolink>

This will generate DokuWiki code

The text on the page. Blah, blah, blah...

And of course the text [[pagewhere:anchor_set|Some Name]]. Also [[pagewhere:anchor set|some name]] is valid, as well as [[pagewhere:anchor set|SOME NAME]].
|The test can be in a table also| [[pagewhere:anchor_set|Some Name]], **but** there needs to be a space after the leading\||

By setting the config option 'autoautolink' links are set automatically to every page. To prevent setting one should set ~~noautolink~~ at the start of the page. (row 1 column 1)

Changes from the old version

3.2

  • Anchors accept special characters.
  • Removing anchors should now nicely remove them from index.

3.1

  • Fixed compatibility issues with Ricewind →

3.0

  • Added action aplugin to set anchors to every page. Altso added action to remove links if page is deleted.
  • I could not download backlinks plugin to fix the reported problems with it. So I'm not sure if it works with autolink.

2.1

  • This new version tries to clear old unused anchors from the index. So that removing an anchor clears the links from pages after next time the cache is refreshed.
  • The index file should not be accidentally cleared anymore.
  • There is a admin plugin included that helps to locate pages having old autolink plugin styled anchor “setters”

Discussion

For me this is a very usable plugin. Many many thanks!
But there seems to be a little bug. If I autolink e.g. the word “Wissenschaft” in the text “Philosophie ist die Wissenschaft, die die Grundlagen aller Wissenschaften untersucht …” the text is rendered to “Philosophie ist die wissenschaft, die die Grundlagen aller wissenschaften untersucht …” In German this is not correct, because “Wissenschaft” is the right spelling. Can the author of this plugin or someone else help me.

Oh yes I get it. I think I have a solution. No I only need to code and test it :-oOtto Vainio 2007-03-08 19:21
Okay. Got it. Its fixed now. New fixed version updated to zip file — Otto Vainio 2007-03-08 19:56

Many many thanks!!! I will try it. drews [dot] frank [at] arcor [dot] de

Ouch sorry. One bug left. — Otto Vainio 2007-03-08 20:37
Ok now fixed — Otto Vainio 2007-03-08 20:42

This plugin is excellent, but it seems to put a mess in the subpart of the page. If I ask the whole page to be '<autolink>', then, if I edit a part, it doesn't give me the right part to edit, but half up and half down of this (I am not sure to be clear :p). Can you help me ?

If you get the warning
Call-time pass-by-reference has been deprecated;
If you would like to pass it by reference, modify the declaration of [runtime function name]().
etc. etc.
change in admin.php line 123
return search_regex(&$data,$base,$file,$reg,$words);
to
return search_regex($data,$base,$file,$reg,$words);

Would it be possible in the future version of the plugin to allow linking to word 'packaged' or linked in syntax symbols ? I mean, if I give as KeyWord 'TATA', and if in the text I have '(TATA is a name)', then the autolink won't works. It is the same for the formatting character/keys… Many Thanks Francois

I made a template that put the following in each file

%%<autolink>%%\\
[enter text here]\\
%%{{autolink>page_name|page name}}%%\\
%%</autolink>%%\\


It worked at first, but after opening the pages a few times all the text between the <autolink> and </autolink> tags disappeared.
Any ideas?
Brett

The format {{autolink>page_name|page name}} creates the anchor word which (if found)automatically links to this page
while
<autolink>
[enter text here]
</autolink>

should be used on pages where you want autolinking to happen. Usually not the same page.

Other Question: Is it normal, that the autolink remains, even when I deleted the Jumppoint-part? How can I remove this automatic linking?

When you remove {{autolink>page_name|page name}} your link should be removed. Remember that DokuWiki caches your pages so an update to the page my be needed. — Otto Vainio 2009/01/22 18:24

The problem remains although I've updated via F5. What do I have to do?

Try to delete the cache manually in the directory data/cache/

Is it possible to set for example 2 or 3 autolinking terms. For example to link if You write where are You from and we are happy? This would be very useful because if you use DokuWiki in a business, you often have the complete term or word as well as shortys.

Yes, it should work when you write it like this {{autolink>where are You from|we are happy}} — SteRe 2009/02/09 01:58

Hi, I found a problem with the backlink function of DokuWiki with this plugin. The links are set, but if I look for backlink on a page (build-in function and backlink plugin) the links set by this plugin are not shown. — SteRe 2009/02/09 02:01

Just another question. Is there a special index page, where I can see which “autolinks” I've definied and ideally on which side? — SteRe 2009/02/09 02:31

Hi, it seem there is a problem with the ODT Plugin. On Pages, where I use this plugin the ODT export doesn't work. — SteRe 2009/02/15 21:31

I'd like to thank you so much for your plugin; the reason I'm writing to you is that I came to a situation that I don't know how to solve by myself…

Suppose I've got 3 different (but closely related) pagenames that were instantiated in each corresponding page…

red_horse.txt specifies Red Horse

red_horse_company.txt Red Horse Company

red_horse_racing.txt Red Horse Racing

BUT when appears in a page the string “red horse racing” that might be refered to red_horse_racing, it deems that it refers just to red_horse …

Am I doing something wrong? — JP 2009/03/17 22:33

I think, this is a marvelous plugin. Thanks to the author for that. However, there seem some problems with the 2009-02-14 version of DokuWiki.
First of all a lot of warnings come up when previewing a page where I made a reference to a defined anchor (each of the following several times):
Warning: Invalid argument supplied for foreach() in /var/www/lib/plugins/columns/action.php on line 265 (maybe a problem of columns - but beside this it works absolutely fine in my installation…)
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /var/www/inc/parserutils.php on line 565
Furthermore the plugin seems to ignore multiwords as anchor, i.e. 'some name' …won't work! It just accepts single words despite the multiword anchor is enlisted correctly in /data/index/autolink.idx, where autolink obviously stores its references.
Disregarding the nasty warnings autolink2 works still fine at least for single-word-references.

I'm going to try to resolve that problems on my own - nevertheless - perhaps somebody has an idea or tuned something already… josch 2009/05/02 amendment: as far as I see… there are some problems due to utilizing global variables in this plug-in… what isn't supported any more in php5…


Hi Otto, first of all thank you for this plugin. Unfortunately it seems to generate problems for the backlink plugin. Backlink-plugin works fine if autolink is disabled, if autolink is enabled no backlinks are found.
Code of the page to which a second page has a link:

<autolink>
====== Backlink_Test ======

</autolink>
{{backlinks>.}}

Result if autolink is enabled:

Plugin Backlinks: Nichts gefunden.

Result if autolink is disabled:
a link to the page “Test” is displayed as backlink. (Page Test has a link to this page.)

So it seems, that “autolink” does something which prevents backlink to function properly.
Do you have any idea how to solve this problem? Many thanks 2010-01-13 joachim

List of incompatibilities with other plugins

unfortunately there are lots of problems for other plugins if autolink plugin is used.
I like this plugin but it conflicts with so much other plugins that it is not really usable. 2010-02-03 joachim

  1. include plugin
    if the page or section which should be included is wrapped with <autolink> …. </autolink>
    include plugin will always include the whole page
  2. backlink plugin
    if page “one” which has a link to another page “two” is wrapped with <autolink> …. </autolink>
    backlink plugin will not show this link in page “two”.

error

on each page i have

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 95 in /homez.93/tanguean/www/lib/plugins/autolink2/action.php on line 42

and my orignals articles are moodified… (plugin add \r\n into my original text}}

You may have an broken tag on some of your pages. check data/index/autolink.idx file. — oiv 2010/06/11 16:44

Work with anteater?

Does this work the anteater release? It's the only plugin I have installed but keep getting the error:

Warning: preg_replace() [function.preg-replace]: Empty regular expression in /home/wikistor/public_html/lib/plugins/autolink2/syntax/show.php on line 76

I'm using the tags per the instructions in this article. It would be really nice to get this working but I'm SOL so far :(

UPDATE Nevermind, there is an autolink3 plugin available which wasn't revealed in my googling. plugin:autolink3

Section editing corrupt

When autolink2 is installed, the section editing is corrupt. 2011-06-16 joachim
Same as described here: http://forum.dokuwiki.org/thread/6233

plugin/autolink2.txt · Last modified: 2016-01-13 14:39 by Aleksandr