summaryrefslogtreecommitdiff
path: root/TWiki/FindElsewherePlugin.mdwn
blob: ff1e77f7d7037e565eebfbb069d619cef8994aff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
## <a name="Find_Elsewhere_Plugin"> Find Elsewhere Plugin </a>

This plugin will automatically link to another web(s) if a topic isn't found in the current web.

This is useful for a TWiki site that wants to implement a glossar/dictionary web where common terms are defined and stored. Without this plugin:

* Each web would need to create their own topic for a common term
* Link to or INCLUDE the topic from where it is defined
* Authors need to remember to put the Web name in front of the topic name, such as [[TWiki/WikiWord]]

Without this kind of plugin, it's likely that common terms used within an organization will be defined in multiple webs or the common terms will be unlinked wiki words (as if they didn't exist).

### <a name="Syntax_Rules"> Syntax Rules </a>

No new rules are introduced. However, new automatic [[TWiki/WikiWord]] linking will occur.

If a topic is not found in the current web, this plugin will look in the LOOKELSEWHERE web list for that topic. If and when the topic is found as it looks through the webs in their listed order, it will create a link to that page using the [[ ]] syntax.

<a name="NewFunctionalityTest"></a> New Functionality

<table border="1" cellpadding="1" cellspacing="0">
  <tr>
    <th bgcolor="#99CCCC"><strong>test case</strong></th>
    <th bgcolor="#99CCCC"><strong>input</strong></th>
    <th bgcolor="#99CCCC"><strong>output</strong></th>
    <th bgcolor="#99CCCC"><strong>expected</strong></th>
  </tr>
  <tr>
    <td> found here </td>
    <td><nop>WebHome </nop></td>
    <td>[[WebHome]]</td>
    <td><nop>WebHome </nop></td>
  </tr>
  <tr>
    <td> found singular here </td>
    <td><nop>WebHomes </nop></td>
    <td>[[WebHomes]]</td>
    <td><nop>WebHomes </nop></td>
  </tr>
  <tr>
    <td> found elsewhere </td>
    <td><nop>TWikiAdminGroup </nop></td>
    <td>[[TWikiAdminGroup]]</td>
    <td><nop>Main.TWikiAdminGroup </nop></td>
  </tr>
  <tr>
    <td> found singular elsewhere </td>
    <td><nop>TWikiAdminGroups </nop></td>
    <td>[[TWikiAdminGroups]]</td>
    <td><nop>Main.TWikiAdminGroups </nop></td>
  </tr>
</table>

Don't break other types of links...

<table border="1" cellpadding="1" cellspacing="0">
  <tr>
    <th bgcolor="#99CCCC"><strong>input</strong></th>
    <th bgcolor="#99CCCC"><strong>output</strong></th>
  </tr>
  <tr>
    <td><nop>%TOPIC%#TopicAnchor </nop></td>
    <td> %TOPIC%#NewFunctionalityTest </td>
  </tr>
  <tr>
    <td><nop>TWiki.WebHome </nop></td>
    <td>[[TWiki/WebHome]]</td>
  </tr>
  <tr>
    <td><nop>WebHome </nop></td>
    <td>[[WebHome]]</td>
  </tr>
  <tr>
    <td> [<nop>[TWiki.WebHome]] </nop></td>
    <td>[[TWiki/WebHome]]</td>
  </tr>
  <tr>
    <td> [<nop>[TWiki.WikiWord]] </nop></td>
    <td>[[TWiki/WikiWord]]</td>
  </tr>
  <tr>
    <td> [<nop>[TWiki.WikiWords]] </nop></td>
    <td>[[TWiki/WikiWords]]</td>
  </tr>
  <tr>
    <td><nop>TWiki.WikiWord </nop></td>
    <td>[[TWiki/WikiWord]]</td>
  </tr>
  <tr>
    <td><nop>TWiki.WikiWords </nop></td>
    <td>[[TWiki/WikiWords]]</td>
  </tr>
</table>

### <a name="_TOPIC_Settings"> %TOPIC% Settings </a>

* One line description, is shown in the %TWIKIWEB%.TextFormattingRules topic:
  * Set SHORTDESCRIPTION = If a topic isn't found in this web it will look in a predefined list of other webs and attempt to find it there.

* List other webs in which to look for topics that don't exist
  * Set LOOKELSEWHERE = TWiki, Main

* If the [[TWiki/WikiWord]] is plural but doesn't exist, also look for the singular word. Note this setting is for looking in **other** webs only (plural to singular is still automatically done in the current web).
  * Set PLURALTOSINGULAR = 1

* Debug plugin: (See output in `data/debug.txt`)
  * Set DEBUG = 0

### <a name="Plugin_Installation_Instructions"> Plugin Installation Instructions </a>

* Download the ZIP file from the Plugin web (see below)
* Unzip <code>**%TOPIC%.zip**</code> in your twiki installation directory. Content:

<table border="1" cellpadding="1" cellspacing="0">
  <tr>
    <th bgcolor="#99CCCC"><strong>File:</strong></th>
    <th bgcolor="#99CCCC"><strong>Description:</strong></th>
  </tr>
  <tr>
    <td><code><b>data/TWiki/%TOPIC%.txt</b></code></td>
    <td> Plugin topic </td>
  </tr>
  <tr>
    <td><code><b>data/TWiki/%TOPIC%.txt,v</b></code></td>
    <td> Plugin topic repository </td>
  </tr>
  <tr>
    <td><code><b>lib/TWiki/Plugins/%TOPIC%.pm</b></code></td>
    <td> Plugin Perl module </td>
  </tr>
</table>

* Test if the plugin is correctly installed, by viewing %TOPIC%#NewFunctionalityTest

### <a name="Plugin_Info"> Plugin Info </a>

<table border="1" cellpadding="1" cellspacing="0">
  <tr>
    <td align="right"> Plugin Author: </td>
    <td>[[Main/MikeBarton]]</td>
  </tr>
  <tr>
    <td align="right"> Plugin Version: </td>
    <td> 1 Feb 2002 </td>
  </tr>
  <tr>
    <td align="right"> Change History: </td>
    <td> 1 Feb 2002: Initial version </td>
  </tr>
  <tr>
    <td align="right"> CPAN Dependencies: </td>
    <td> none </td>
  </tr>
  <tr>
    <td align="right"> Other Dependencies: </td>
    <td> none </td>
  </tr>
  <tr>
    <td align="right"> Perl Version: </td>
    <td> 5.0 </td>
  </tr>
  <tr>
    <td align="right"> Plugin Home: </td>
    <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%</a></td>
  </tr>
  <tr>
    <td align="right"> Feedback: </td>
    <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev</a></td>
  </tr>
</table>

**_Related Topics:_** %TWIKIWEB%.TWikiPreferences, %TWIKIWEB%.TWikiPlugins, [[DefaultPlugin]]

-- [[Main/MikeBarton]] - 1 Feb 2002<br />