DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autolink4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:autolink4 [2019-09-12 21:07] – http://github to https://github Aleksandrplugin:autolink4 [2024-03-03 12:32] (current) – [Discussion] 43.239.85.173
Line 1: Line 1:
 ====== AutoLink 4 Plugin ====== ====== AutoLink 4 Plugin ======
 + 
 ---- plugin ---- ---- plugin ----
 description: Automatically link text in your wiki to pages description: Automatically link text in your wiki to pages
Line 6: Line 6:
 email      : elifenton@this_is_not_a_real_email.fake  email      : elifenton@this_is_not_a_real_email.fake 
 type       : syntax type       : syntax
-lastupdate : 2019-09-02 +lastupdate : 2024-02-10 
-compatible : Greebo+compatible : Greebo, Hogfather, Igor, Jack Jackrum, Kaos
 depends    :  depends    : 
 conflicts  conflicts 
Line 15: Line 15:
 downloadurl: https://github.com/zioth/dokuwiki-autolink4/zipball/master downloadurl: https://github.com/zioth/dokuwiki-autolink4/zipball/master
 bugtracker : https://github.com/zioth/dokuwiki-autolink4/issues bugtracker : https://github.com/zioth/dokuwiki-autolink4/issues
-sourcerepo : https://github.com/zioth/dokuwiki-autolink4/+sourcerepo : https://github.com/zioth/dokuwiki-autolink4
 donationurl:  donationurl: 
  
Line 24: Line 24:
   * It's easy to configure.   * It's easy to configure.
   * It's up to date, and works with the latest version of DokuWiki.   * It's up to date, and works with the latest version of DokuWiki.
-  * It doesn't modify the original copies of the pagelinks are created on demand. This makes it easy to undo changes+  * It doesn't modify the original copies of the page, so if you uninstall the plugin, the links are gone
-  * It works with [[autotooltip]] to add tooltips to its links.+  * It integrates with [[autotooltip]] to automatically generate tooltips for each link.
  
 More information: [[plugin:autolink4:differences|Choosing an autolink plugin]]. More information: [[plugin:autolink4:differences|Choosing an autolink plugin]].
Line 34: Line 34:
 Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually. Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.
  
-===== Examples/Usage =====+ 
 +===== Examples / Usage =====
  
 This plugin is configured with a list of links in the DokuWiki admin interface. Each line of the configuration consist of three fields separated by commas: This plugin is configured with a list of links in the DokuWiki admin interface. Each line of the configuration consist of three fields separated by commas:
-  * Text to find. This can include certain regular expression characters, like square brackets and question marks. Pipe (|) and parentheses are not allowed. This plugin always links whole words and phrases. It will never link just part of a word.+  * Text to find. This can include certain regular expression characters, like square brackets and question marks. Pipe (|) and parentheses are not allowed. This plugin always links whole words and phrases. It will never link just part of a word. See note below on non-English language support.
   * The link for the text.   * The link for the text.
   * The namespace where the replacement is done. Omit this field to replace everywhere.   * The namespace where the replacement is done. Omit this field to replace everywhere.
   * Flags. These can include:   * Flags. These can include:
     * tt: If the [[plugin:autotooltip|Auto-Tooltip plugin]] is installed, the link will be displayed with a tooltip, including the page title and abstract.     * tt: If the [[plugin:autotooltip|Auto-Tooltip plugin]] is installed, the link will be displayed with a tooltip, including the page title and abstract.
-    * once: Only link the first occurrence of this tooltip.+    * once: Only link the first occurrence of this tooltip on a page. 
 +    * inword: Replace partial words. DokuWiki defines a word as characters surrounded by spaces or punctuation, so this is required for languages that do not require space between words. 
 + 
 + 
 +== Simple examples ==
  
-== Simple example == 
   Things, mywiki:thing   Things, mywiki:thing
 +
 This links the word "Things" to mywiki:thing, everywhere on your wiki. It only links it when capitalized. This links the word "Things" to mywiki:thing, everywhere on your wiki. It only links it when capitalized.
 +
 +  Things, mywiki:thing#heading
 +
 +This links to the section of the mywiki:thing page with the section header "heading."
 +
  
 == Limiting replacement to a namespace == == Limiting replacement to a namespace ==
 +
   Things, mywiki:thing, mywiki   Things, mywiki:thing, mywiki
 +
 The word "Things" will only be replaced inside the "mywiki" namespace. The word "Things" will only be replaced inside the "mywiki" namespace.
 +
  
 == Tooltips == == Tooltips ==
 +
   Things, mywiki:thing, , tt   Things, mywiki:thing, , tt
-The link will include a tooltip, which is drawn from the title and abstract of mywiki:thing. 
  
-== Tooltipand link first match ==+The link will include a tooltip, which is drawn from the title and abstract of mywiki:thing. This feature requires [[autotooltip]]. 
 + 
 +Links to specific sections will base the tooltip on the page, not the section. This is due to a limitation of DokuWiki and autotooltip (the tooltip comes from the abstract, and sections do not have abstracts). 
 + 
 + 
 +== Search inside of words == 
 + 
 +  Thingsmywiki:thing, , inword 
 + 
 + 
 +== Combining flags == 
   Things, mywiki:thing, , once|tt   Things, mywiki:thing, , once|tt
 +
 The link will include a tooltip, and only the first occurrence of this match will be linked. The link will include a tooltip, and only the first occurrence of this match will be linked.
 +
  
 == Regular expressions == == Regular expressions ==
 +
   [Tt]hings?, mywiki:thing   [Tt]hings?, mywiki:thing
-This links the words "Thing," "thing," "Things" and "things" to mywiki:thing. Remember that some regular expression characters are not allowed.+ 
 +This links the words "Thing," "thing," "Things" and "things" to mywiki:thing. Some of the more useful regular expression tools include: 
 +  * Square brackets([]): Matches every character between the brackets. 
 +  * Question mark (?): The previous character is optional. 
 +  * Period (.): Match any character. 
 +  * Asterisk (*): Match zero or more of the previous character. 
 +  * Plus (+): Match one or more of the previous character. 
 +  * \s: Match a space. 
 +  * \S: Match a non-space. 
 +  * \b: Match the start or end of a word. 
 + 
 +Not supported: 
 +  * DokuWiki forbids the use of pipe (|) or parentheses. Using these will fail, and break other plugins. 
  
 == Proper ordering == == Proper ordering ==
 +
   Incredible Things, mywiki:thing   Incredible Things, mywiki:thing
   Things, mywiki:thing   Things, mywiki:thing
      
-Replacements are made in the order in which they occur in the configuration. So if you have a short replacement which is contained within a longer one, list the longer one first:+Replacements are made in the order in which they occur in the configuration. So if you have a short replacement which is contained within a longer one, list the longer one first.
  
 +
 +===== Non-English language support =====
 +
 +Due to [[issue>856|limited non-Latin support in DokuWiki]], this plugin cannot work with certain characters in regular expressions. To fix it, you will have to edit some core DokuWiki code. Open ''/inc/Parsing/Lexer/ParallelRegex.php'', and change the ''getPerlMatchingFlags'' function to:
 +  protected function getPerlMatchingFlags()
 +  {
 +    return ($this->case ? "umsS" : "umsSi");
 +  }
  
 ===== Development ===== ===== Development =====
  
 === Performance === === Performance ===
 +
 I tested with 500 regular expression matches, with no noticeable impact on performance. If you scale to several thousand, I recommend limiting the number of regular expression links. I tested with 500 regular expression matches, with no noticeable impact on performance. If you scale to several thousand, I recommend limiting the number of regular expression links.
  
 ==Nerd speak== ==Nerd speak==
-The algorithmic complexity of this plugin is O(r*u + s), where r is the total number of configured links with regular expression characters, s is the number of configured links without regular expression characters, and u is the number of unique matched text strings on the page.+ 
 +The asymptotic complexity of this plugin is O(r*u + s), where r is the total number of configured links with regular expression characters, s is the number of configured links without regular expression characters, and u is the number of unique matched text strings on the page. This means that performance is only minimally impacted by non-regex entries, and becomes worse the more regex entries you have, and the more times those entries appear on the page.
  
  
Line 83: Line 134:
  
 {{rss>https://github.com/zioth/dokuwiki-autolink4/commits/master.atom date}} {{rss>https://github.com/zioth/dokuwiki-autolink4/commits/master.atom date}}
 +
  
 === ToDo/Wish List === === ToDo/Wish List ===
Line 91: Line 143:
 ===== Discussion ===== ===== Discussion =====
  
 +**[APPLAUSE]** This implementation for auto-linking is handy to use. I may not be a heavy user since I haven't come up so many strings to be auto-linked to relative pages, but this plugin indeed suits my need in a most elegant way. --- [[user>MilchFlasche|milchflasche]] //2020-10-26 02:56//
 +
 +howto: eg. #number, http://www.example.com/number   - rick.
plugin/autolink4.1568315268.txt.gz · Last modified: 2019-09-12 21:07 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki