plugin:autolink4
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:autolink4 [2019-09-02 16:03] – zioth | plugin: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: | + | description: |
author | author | ||
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 13: | Line 13: | ||
tags : links | tags : links | ||
- | downloadurl: | + | downloadurl: |
- | bugtracker : http:// | + | bugtracker : https:// |
- | sourcerepo : http:// | + | sourcerepo : https:// |
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' | + | * It doesn' |
- | * It works with [[autotooltip]] to add tooltips | + | * It integrates |
More information: | More information: | ||
Line 34: | Line 34: | ||
Install the plugin using the [[plugin: | Install the plugin using the [[plugin: | ||
- | ===== Examples/ | + | |
+ | ===== 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: | * tt: If the [[plugin: | ||
- | * once: Only link the first occurrence of this tooltip. | + | * once: Only link the first occurrence of this tooltip |
+ | * inword: Replace partial words. DokuWiki defines a word as characters surrounded by spaces or punctuation, | ||
+ | |||
+ | |||
+ | == Simple examples == | ||
- | == Simple example == | ||
Things, mywiki: | Things, mywiki: | ||
+ | |||
This links the word " | This links the word " | ||
+ | |||
+ | Things, mywiki: | ||
+ | |||
+ | This links to the section of the mywiki: | ||
+ | |||
== Limiting replacement to a namespace == | == Limiting replacement to a namespace == | ||
+ | |||
Things, mywiki: | Things, mywiki: | ||
+ | |||
The word " | The word " | ||
+ | |||
== Tooltips == | == Tooltips == | ||
+ | |||
Things, mywiki: | Things, mywiki: | ||
- | The link will include a tooltip, which is drawn from the title and abstract of mywiki: | ||
- | == Tooltip, and link first match == | + | The link will include a tooltip, which is drawn from the title and abstract of mywiki: |
+ | |||
+ | 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 == | ||
+ | |||
+ | Things, mywiki: | ||
+ | |||
+ | |||
+ | == Combining flags == | ||
Things, mywiki: | Things, mywiki: | ||
+ | |||
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: | [Tt]hings?, mywiki: | ||
- | This links the words " | + | |
+ | This links the words " | ||
+ | * Square 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: | Incredible Things, mywiki: | ||
Things, mywiki: | Things, mywiki: | ||
| | ||
- | 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> | ||
+ | protected function getPerlMatchingFlags() | ||
+ | { | ||
+ | return ($this-> | ||
+ | } | ||
===== 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 | + | |
+ | The asymptotic | ||
Line 83: | Line 134: | ||
{{rss> | {{rss> | ||
+ | |||
=== ToDo/Wish List === | === ToDo/Wish List === | ||
- | * Instead of the link opening up the page, open a pop-up containing the abstract. From there, the user can click to the page. | ||
* If you have more than 500 or so configured links, you reach the maximum number of hooks DokuWiki can handle. This can be fixed by turning this into an action plugin, or by modifying DokuWiki' | * If you have more than 500 or so configured links, you reach the maximum number of hooks DokuWiki can handle. This can be fixed by turning this into an action plugin, or by modifying DokuWiki' | ||
Line 92: | Line 143: | ||
===== Discussion ===== | ===== Discussion ===== | ||
+ | **[APPLAUSE]** This implementation for auto-linking is handy to use. I may not be a heavy user since I haven' | ||
+ | |||
+ | howto: eg. #number, http:// |
plugin/autolink4.1567433035.txt.gz · Last modified: 2019-09-02 16:03 by zioth