Tags:
create new tag
view all tags

Question

  • TWiki version: 01 Feb 2003
  • Perl version: 5.00503
  • Web server & version: Apache 1.3.27
  • Server OS: FreeBSD
  • Web browser & version: Phoenix
  • Client OS: WinXP

Hope someone can help.

I'd like to use %TOC% across several topics, not over just a single topic, but I'm not sure how to wildcard the topic.

The specification says that the topic, if not given, defaults to the current topic. I've tried %TOC{".*"}% and %TOC{"*"}%...anyone know how to wildcard this?

-Ken

A little bit more information...

I found the 'parent' functionality, and made the correct assignments.

Now, I can do a METASEARCH based on these parent/child relationships to get a list...unfortunately, I'm having trouble formatting it: METASEARCH doesn't seem to have a formatting command to modify each item, so I get several space-separated anchor tags, but I can't see how to put something between them.

-- TWikiGuest - 07 Feb 2003

Answer

Hey! WooHoo!

I took a look at ~www/twiki/lib/Twiki.pm, and noticed the handleMetaSearch function...and immediately below it the handleSearchWeb. At their hearts, both called &TWiki::Search::searchWeb, just with different parameters.

So, shooting in the dark, I added two paramters to metasearch (I love an obvious API!):

sub handleMetaSearch
{
    my( $attributes ) = @_;

    my $attrWeb           = extractNameValuePair( $attributes, "web" );
    my $attrTopic         = extractNameValuePair( $attributes, "topic" );
    my $attrType          = extractNameValuePair( $attributes, "type" );
    my $attrTitle         = extractNameValuePair( $attributes, "title" );
    my $attrHeader        = extractNameValuePair( $attributes, "header" );
    my $attrFormat        = extractNameValuePair( $attributes, "format" );

    my $searchVal = "XXX";
   
    if( ! $attrType ) {
       $attrType = "";
    }


    my $searchWeb = "all";

    if( $attrType eq "topicmoved" ) {
       $searchVal = "%META:TOPICMOVED\{.*from=\\\"$attrWeb\.$attrTopic\\\".*\}%";
    } elsif ( $attrType eq "parent" ) {
       $searchWeb = $attrWeb;
       $searchVal = "%META:TOPICPARENT\{.*name=\\\"($attrWeb\\.)?$attrTopic\\\".*\}%";
    }

    my $text = &TWiki::Search::searchWeb( "1", $searchWeb, $searchVal, "",
       "", "on", "", "",
       "", "on", "on",
       "on", "on", "", "",
       "", "on", "searchmeta", $attrHeader, $attrFormat
    );

    if( $text !~ /^\s*$/ ) {
       $text = "$attrTitle$text";
    }

    return $text;
}

And now I can format the output of metasearch and order the children any way I need to.

-Ken

-- TWikiGuest - 07 Feb 2003

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2003-02-08 - 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.