Bug: The ref-by feature doesn't find pluralized links.
Even though TWiki handles the
Wiki:WikiNamePluralProblem
by
linking plural
WikiWords to the singular topics, the ref-by
feature will not find those references.
Test case
- Create a singular topic
- Create a plural reference
- Click the ref-by on the singular topic's page and notice that the plural reference isn't found.
Environment
--
RobertWithrow - 18 Jan 2002
Is there any chance of getting this bug fixed? Does some knowledgable person agree that it
is a bug?
--
RobertWithrow - 26 Jul 2002
Fix record
This looks like a bug - should be quite easy to fix though, all that's needed is to suffix
[Ss]? near the end of the regular expression that does the ref-by search, to also match topics that match with 'topic name plus S'.
Since that regex is in
view.tmpl, you can try fixing it yourself and see if this works. Change the line that includes the following (search for Ref-By to find it):
search=%SPACEDTOPIC%%5B%5EA-Za-z%5D
into:
search=%SPACEDTOPIC%%5B%53%73%5D%3F%5B%5EA-Za-z%5D
The
%5B%53%73%5D%3F% is the hex-encoded version of
[Ss]? - obtained using
CygWin like so:
$ echo -n '[Ss]?'| od -c -t x1
0000000 [ S s ] ?
5b 53 73 5d 3f
Let me know if this works.
Q: Do other people regard this as a bug? Or perhaps a simple enough feature that it would be worth adding it? If so, I will put it into CVS.
--
RichardDonkin - 27 Jul 2002
The regex should basically do the reverse of this code in
TWiki.pm:
$tmp =~ s/ies$/y/; # plurals like policy / policies
$tmp =~ s/sses$/ss/; # plurals like address / addresses
$tmp =~ s/([Xx])es$/$1/; # plurals like box / boxes
$tmp =~ s/([A-Za-rt-z])s$/$1/; # others, excluding ending ss like address(es)
Not sure how this can be done with a single regex. An aproximation is probably "good enough".
--
PeterThoeny - 27 Jul 2002
I changed the template in a way similar to that
RichardDonkin suggests and it works
well enough for me. I think that using SPACEDTOPIC is broken
and it should, instead, be TOPIC. But that is perhaps a matter of
opinion. My argument is that appearences of a SPACEDTOPIC in a page
do not constitute a link and so ref-by shouldn't find them. I'm not
a regex expert so I dropped the fancy a-z stuff; I didn't really
do a good job.
My template looks like this:
;search=%TOPIC%%5B%53%73%5D%3F
Also, as a refactoring suggestion, this back referencing shows up in
a few places. Perhaps it should be factored out into a variable or
something.
Thanks for the fix!
--
RobertWithrow - 08 Aug 2002
So I've been thinking.
I don't think the right solution is to include a single regex in the
template for the search parameter for the
SearchResult page. Instead
I think one of the follwing is a better solution:
- Have a distinct SearchRefBy page that simply takes the
TOPIC value and that dynamically "does the right thing" with the TOPIC to find all valid links.
- Have a
PLURALTOPICREGEX template replacement that allows the template expander to compute the correct regex for a WikiWord.
In each case the regex is
computed from the
TOPIC. Of course, I am way to stoopid to actually provide code.
BTW, does anyone have comments on my
TOPIC versus
SPACEDTOPIC
suggestion above?
--
RobertWithrow - 13 Aug 2002
The spacedtopic is done to match Wiki links that are of the form
web home, i.e. spaced out text. Personally I think such links are a pain to get right in all cases, but it would be better to match the rest of the link syntax to avoid hits on normal text.
--
RichardDonkin - 17 Aug 2002