Fortune Plugin
This plugin uses the Unix/Linux
fortune command to insert a random fortune into a topic. On windows environments, or if
fortune is not installed, it uses the CPAN
Fortune implementation.
Usage
The following macros are implemented:
-
%FORTUNE{"database" LENGTH="S"}% Insert a random fortune into the topic from the named "database".
- LENGTH parameter (optional) can be set to S or SHORT to select short fortunes, and L or LONG for long fortunes. This option only works if the unix
fortune-mod program is used.
-
%FORTUNE_LIST{"database"}% List the contents of the named database
-
%FORTUNE_DB_LIST{}% List the available database files in the fortune directory.
- Set TINYMCEPLUGIN_DISABLE = 1
Examples
Example: %FORTUNE{"foswiki" LENGTH="S"}%
If installed, a random fortune from the foswiki database will appear here:
Today there are a variety of wikis, one of them being the wiki you are presently looking at.
Example: %FORTUNE_LIST{"foswiki"}%
If installed, the list of fortunes in the foswiki database
- Today there are a variety of wikis, one of them being the wiki you are presently looking at.
- Foswiki can be extended with hundreds of plugins
- In the WYSIWYG Editor, click the pick-axe symbol to switch to the raw editor
- Subscribing to WebNotify will enable Foswiki to send you details of changes made on topics.
- The breadcrumb displayed with a particular Foswiki topic is constructed with a topic's Parent.
Use the "More Topic Actions" link if you want to change the topic parent.
- You can disable automatic linking of WikiWords by surrounding the text with <noautolink> and </noautolink>
- The breadcrumb of a topic shows you page hierarchy. It is constructed using a topic's parent setting, following the parents up to the web level.
- To encourage collaboration, instead of restricting edit, allow anyone to edit topics, and use WebNotify and revision controls to deal with undesired changes.
- If you need a list of topics, considering using the %SEARCH macro to automatically populate the list.
- To disable the WYSIWYG editor on a topic, add the setting TINYMCEPLUGIN_DISABLE = 1 to the topic.
- You can customize Foswiki by overriding settings in your UserName? topic. For example, if you want to disable the WYSIWYG editor for all of your edits, set TINYMCEPLUGIN_DISABLE = 1 in your user topic.
Example: %FORTUNE_DB_LIST{}%
If installed, the list of fortune databases is shown. Note that two different format results are possible. The Unix
fortune-mod program reports the percentage of fortunes supplied by each file. The Perl
Fortune module shows a simple fortune count.
100.00% /usr/share/fortune
3.09% art
0.07% ascii-art
6.88% computers
7.64% cookie
7.96% definitions
1.40% drugs
1.36% education
1.09% ethnic
1.33% food
2.89% fortunes
0.36% goedel
1.32% humorists
1.01% kids
1.35% law
0.70% linuxcookie
1.75% literature
1.01% love
0.20% magic
0.50% medicine
3.90% men-women
4.35% miscellaneous
0.36% news
8.34% people
0.34% pets
3.35% platitudes
4.70% politics
0.89% riddles
4.19% science
4.83% songs-poems
0.99% sports
1.52% startrek
0.08% translate-me
2.82% wisdom
4.23% work
2.64% linux
1.83% perl
3.72% knghtbrd
0.48% paradoxum
3.68% zippy
0.11% debian
0.69% aviation
0.07% foswiki
Plugin Preferences
There are no perferences that can be set for this plugin. All configuration parameters are set in
LocalSite.cfg using the
bin/configure interface.
Installation
- Install FortunePlugin using the
bin/configure interface
- If
fortune_mod is installed on a *nix system
- Set the
{Plugins}{FortunePlugin}{FortuneDBPath} to point to the directory containing the fortune files. Typically this is in /usr/share/fortune/. Trailing slash must be included.
- Set the
{Plugins}{FortunePlugin}{FortuneProgram} to point to the fortune program. Typically /usr/bin/fortune.
- On a windows system, or if
fortune is not installed:
- Install the Fortune module using CPAN
- leave
{Plugins}{FortunePlugin}{FortuneProgram} unset.
- leave
{Plugins}{FortunePlugin}{FortuneDBPath} unset. The plugin will use fortune files attached to this topic. Or if other fortune files are available, point to the directory containing the fortune files. Typically this is in /usr/share/fortune/. Trailing slash must be included.
Creating new fortune files
Fortune files must be created by using the
strfile command that is installed on Linux with the
fortune-mod package. On Windows environments this can be installed using cygwin. This is beyond the scope of this document.
Create the fortune text file
Using your favorite editor, build a simple text file consisting of each quote, followed by a single line containing a percent-sign (
% ) For example, file
foswiki contains:
Today there are a variety of wikis, one of them being the wiki you are presently looking at.
%
Foswiki can be extended with hundreds of plugins
%
Build the fortune database
"Compile" the file into a
.dat file using
strfile
> ~ $ strfile foswiki
"foswiki.dat" created
There were 2 strings
Longest string: 93 bytes
Shortest string: 49 bytes
The original
foswiki file and the related
foswiki.dat file must be placed in the fortune database directory.
Plugin Info