SuggestLinksPlugin
Automatically highlight group of words that
could become a link
Introduction
A plugin that suggests you where you are probably forgetting to add a link.
This plugin
for each topic name of this web:
- splits the topic name in words
- remove stop-words (single letters, "an", "the", "and")
- drops too long topic names (max 4 words, i.e. 24 permutations)
- tries to find plurals
- computes all permutations of the words
- looks for the above sequences of words separated by at most two words
TODO:
- re-do the
preview templates using skins and appropriate API handlers
- add a set of stopTopics ... topics we don't want to link to (Web Home, Web Preferences ...)
Syntax Rules
Usage Example
| you type |
you get |
if correctly installed |
| Example of a plugin that suggests topic links found in text |
Example of a plugin that suggests topic links found in text |
Example of a plugin that suggests topic links found in text |
Plugin Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write
%<plugin>_<setting>%, i.e.
%NEWPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Automatically highlight group of words that could become a link
- Stop-words to ignore (single letters are always ignored):
- Set STOPWORDS = an, and, the, to, for
- You can choose the way the found text should be highlighted by setting the format to be applied before (FORMAT1) and after (FORMAT2) the text found.
$topic stands for the topic name suggested, $web for the web you selected.
- Example that just uses a different highlight color:
- #Set FORMAT1 =
- #Set FORMAT2 =
- Example that just links to the found topic: (remove the # to enable)
- #Set FORMAT1 = "prima $web.$topic]["
- #Set FORMAT2 = "dopo"
Plugin Installation Instructions
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.
- Install the CPAN:List::Permutor
Perl package from http://www.cpan.org
.
- Download the ZIP file from the Plugin Home (see below)
- Unzip
SuggestLinksPlugin.zip in your twiki installation directory. Content: | File: | Description: |
data/TWiki/SuggestLinksPlugin.txt | Plugin topic |
lib/TWiki/Plugins/SuggestLinksPlugin.pm | Plugin Perl module |
- Configure the Plugin:
- Run the configure script to enable the plugin
- Change the plugin settings as needed
- When you want to see suggestions add the URL parameters:
-
suggestions=on
-
suggestionsWeb=TWiki this is the web you want to get the links from (default: the current web)
-
suggestionsLength=3 (default: patterns of no more than 4 words -- max limit = 6 i.e. 240 permutations per topic)
- The
edit.suggest.tmpl template can be used to enable suggestions during preview. To use it set COVER=suggest (or add skin=suggest to the URL)
If the installation is correct you should see the words "plugin that suggests topic links" above, highlighted and with an icon showing the
alt="Plugins.SuggestLinksPlugin" string.
Plugin Info
Related Topics: TWikiPlugins,
DeveloperDocumentationCategory,
AdminDocumentationCategory,
TWikiPreferences