Tags:
create new tag
, view all tags
From DoWhatIMean:

I'd like TWiki to automatically suggest the singular be defined, even if I first refer to the topic in the plural. So, if I write "Review ConceptualComponents and SelectedProducts" it would ask me whether I want to create the singular versions SelectedProduct and ConceptualComponent. After all, the plural automatically links to the singular and there is little point having definitions under both.

-- MartinCleaver - 02 Oct 2001

Two years later. Sheesh. Has anyone coded this?

-- MartinCleaver - 11 Oct 2003

Someone at work mentioned this as well, and I was thinking, "hey, this couldn't be so bad". Here's what I came up with, thought I'd share it to see what other people thought of it.

  • Render.pm.patch: Keeps it simple - a single ? will create a link to the single form of the topic, ?? to the plural version...

I had a version that would do an inline javascript disclosure widget to ask you if you wanted the singular or plural version, but this seemed more pithy and didn't require javascript...

-- BenHouston - 14 Apr 2005

The main problem I have with this is the general problem with singularities; they are language specific. Many, many TWiki users write in languages other than English....

  • I was going under the assumption that if TWiki is making the Plural -> singular conversion for linking, that it would be okay to make a suggestion during topic creation... -- BenHouston - 15 Apr 2005

-- CrawfordCurrie - 15 Apr 2005

Ben - if you can code this against DevelopBranch you will note that we have a PluralsDotPm class. This is where the language dependency needs to be expressed. Don't worry about implementing other languages, just ensure that the English language dependency only gets invoked if the topic/web/wiki is an English language one.

-- MartinCleaver - 15 Apr 2005

That's an excellent solution, though it raises two obvious questions:

  1. What happens if I'm using FindElsewherePlugin
  2. How can I tell if a web "is an English language one"?
    • I think we ought make this a preference. -- MartinCleaver - 15 Apr 2005

-- CrawfordCurrie - 15 Apr 2005

This is how PluralsDotPm is currently used.

From DevelopBranch / r4015 / RenderDotPm:

# TODO: this should be overridable by plugins.
sub _renderWikiWord {
    my ($this, $theWeb, $theTopic, $theLinkText, $theAnchor, $doLinkToMissingPag
es, $doKeepWeb) = @_;
    my $store = $this->{session}->{store};
    my $topicExists = $store->topicExists( $theWeb, $theTopic );

    unless( $topicExists ) {
        # topic not found - try to singularise
        my $singular = TWiki::Plurals::singularForm($theWeb, $theTopic);
        if( $singular ) {
            $topicExists = $store->topicExists( $theWeb, $singular );
            $theTopic = $singular if $topicExists;
        }
    }

    if( $topicExists) {
        return _renderExistingWikiWord($this, $theWeb,
                                       $theTopic, $theLinkText, $theAnchor);
    }
    if( $doLinkToMissingPages ) {
        return _renderNonExistingWikiWord($this, $theWeb, $theTopic,
                                          $theLinkText, $theAnchor);
    }
    if( $doKeepWeb ) {
        return $theWeb.'.'.$theLinkText;
    }

    return $theLinkText;
}

-- MartinCleaver - 15 Apr 2005

I've checked out a recent copy of the Develop code, coded against it, and uploaded the patches (see below). Let me know what you think...

For English-only in the PluralsDotPm, it is already checking siteLang for 'en' - is there other stuff that needs to be done?

-- BenHouston - 15 Apr 2005

Thanks Ben, good work. Committed revision 4026.

Its in how you wrote it except I couldn't see the need for the pref setting so I removed it smile

-- MartinCleaver - 16 Apr 2005

Test case is at http://svn.twiki.org/~twiki4/cgi-bin/view/TestCases/TestCasePluralLinks

-- MartinCleaver - 16 Apr 2005

Nifty! Glad I could help!

-- BenHouston - 18 Apr 2005

This is not documented in Render.pm - please...

-- ArthurClemens - 24 Apr 2005

I've made a comment in 4101, that renderWikiWord uses Plurals.pm; as this happens through unpublished interfaces I was entirely sure where to write the comment or what to write. Still, see what you think.

-- MartinCleaver - 24 Apr 2005

Still I am really unhappy with the visual result. The ?[space]?? looks like an error.

If we would have one question mark, and clicking would lead to a NewTopicTemplate, we could have naming options there (as well as parent, web and template).

-- ArthurClemens - 25 Apr 2005

Ben - would you like to take this on?

-- MartinCleaver - 26 Apr 2005

right now the UI is quite un-intuative. I assumed that the ?_?? was just a rendering bug, and was clicking on any of the question marks creating topics, not even noticing that TWiki was not doing what I wanted. I only worked out that something was up when I ended up with a topic called TaskStatu (i'm working on a Tracking system, which should have a topic called TaskStatus).

could I suggest that unless you can find an intuative, non-intrusive user interface for this, that it should not be Subversion?

it is Clearly not DoWhatIMean

-- SvenDowideit - 02 May 2005

I'd prefer it if the "create topic" page offered you the option of creating the singular or the plural, with two big buttons. The triple question mark is really ugly.

I'm marking this as "Needs a Rethink" - I'm disabling the current change, and it should be reverted if a better solution is found. SVN 4245

-- CrawfordCurrie - 03 May 2005

If there was proper CreateNewTopic page/workflow with a NewTopicTemplate where you could pick the form & parent then picking the singular / plural forms could become part of that.

-- SamHasler - 03 May 2005

Dropping this from Dakar.

-- CrawfordCurrie - 20 Jun 2005

So is it removed from Develop then?

-- ArthurClemens - 20 Jun 2005

I disabled it in Develop a while ago. (3rd May)

-- CrawfordCurrie - 21 Jun 2005

I'm trying to find a discussion of pluralization and related features, but can't. So I'm planting a link here to a new topic GeneralizingFindElsewhereAndPluralHandling

-- AndyGlew - 28 Mar 2006

One thing to note about 'suggest singular' etc - unless you are really going to make it I18N-aware (meaning quite sophisticated plugins for every language), it's best to check that the language is English. This is already done for pluralisation code in TWiki core.

-- RichardDonkin - 09 Oct 2006

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch Plurals.pm.patch r1 manage 0.6 K 2005-04-15 - 18:12 BenHouston Added some more rules to the plural parser...
Unknown file formatpatch Render.pm.patch r2 r1 manage 2.7 K 2005-04-15 - 18:11 BenHouston New patch, coded against the development branch...
Edit | Attach | Watch | Print version | History: r26 < r25 < r24 < r23 < r22 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r26 - 2006-10-09 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.