autolink2 Plugin

autolink2 plugin by Otto Vainio
Register anchors to a page to be (semi)automatically linked from other pages

Last updated on 2007-03-08. Provides Syntax, Helper.
Compatible with DokuWiki 2006-11-06.

Tagged with links.

    Version 2.1a ()
    Download autolink2.zip

    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\||

    Changes from the old version

    • 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 pagesw having old autolink plugin styled anchor “setters”

    Installation

    Using Plugin Manager from here

    If installing over the old autolink, then the plugin tries to import links from the old data file. Use the admin plugin included to find files still having the old format.

    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…


    Problem autolink2 <=> backlink plugin

    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”.
     
    plugin/autolink2.txt · Last modified: 2010/02/05 19:51 by 74.93.99.97
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate