Menu

#27 Link plurals to singulars

closed-accepted
teedog
None
8
2003-08-15
2003-04-30
No

This patch implements a new feature called
feature_wiki_plurals. When enabled, if a Wiki Word is
specified in plural, and the page as written does not
exist, it will try to find a page with the name in
singular, and link to that. If the page as written
exists, the link is to that page as usual.

For example, if a page contains "WikiWords", and a page
called "WikiWords" does not exist but one called
"WikiWord" does, "WikiWords" will be made into a link
to "WikiWord".

The conversion only happens if the site language is set
to English, independent of the user preference. This is
under the assumption that whatever language is set in
the general preferences is the main language for the
site, and in which most of the pages will be written.
It might be interesting to make this into a more
modular feature so that it integrates with the
translations...

I added the new feature in the Wiki section of the
admin screen, under "Wiki features".

I stole the idea for this feature from TWiki, and also
the regular expressions used. The current
implementation recognizes the following forms of plurals:

ies -> y (like policies -> policy)
sses -> ss (like addresses -> address)
xes -> x (like boxes -> box)
..s -> ... (except for ss ending, like address)

This patch is against 1.6CVS, branch tauceti-bugfixes
(sorry).

Discussion

  • Diego Zamboni

    Diego Zamboni - 2003-04-30

    Patch to add "plurals to singulars" feature.

     
  • teedog

    teedog - 2003-08-13
    • priority: 5 --> 8
     
  • teedog

    teedog - 2003-08-15

    Logged In: YES
    user_id=807810

    This has been checked into CVS HEAD.

     
  • teedog

    teedog - 2003-08-15
    • assigned_to: nobody --> teedog
    • status: open --> closed-accepted
     
  • Oliver Hertel

    Oliver Hertel - 2003-08-21

    Logged In: YES
    user_id=21633

    You know this is only working for english named pages?
    Maybe there should be a table for like lang/xx/plurals.php
    and the default language of the site should be used load
    loading the correct plurals.php file.

     

Log in to post a comment.

MongoDB Logo MongoDB