$username
, $wikiname
() and $wikiusername
. This small enhancement makes formatted search consistent with the TWikiVariables USERNAME
, WIKINAME
and WIKIUSERNAME
, respectively. Example: jsmith
, JohnSmith
, Main.JohnSmith
, respectively.
$wikiusername
shows me: Main.ArthurClemens. (somehow [ [$wikiusername] ] is rendered as Main.ArthurClemens, unlike the signature )
$username
shows me: arthurclemens
But I just want to have the Wiki name without Main. and without link, like: ArthurClemens
So I wrote this small patch that does that. It uses the variable $name
:
| *Most recent changes* | %SEARCH{ ".*" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" limit="10" format="| [[$topic]] <br />$date<br />$name |" }%-- ArthurClemens - 05 Sep 2003 That's interesting. I can't think of a way to do what you've done within the confines of the current code; maybe it does require a patch. If it does, why don't you use $wikiname instead of $name. This goes along better with the TWiki variables %USERNAME%, %WIKIUSERNAME%, and %WIKINAME%. -- TedPavlic - 06 Sep 2003 Why not just write
$wikiusername
without the [[...]]
? It's the square brackets that are causing the display of the web name.
-- RichardDonkin - 06 Sep 2003
The problem is the format is making the wikiword not link - no patch is required, per se.
format="| [[$topic]] <br />$date<br />$name |" }%Should be:
format="| [[$topic]] <br />$date<br /> $wikiusername |" }%TWikiGuest
format="| [[$topic]] <br />$date<br /> $wikiusername |" }%... will work fine:
WebStatistics 2024-02-07 - 08:00 TWikiAdminGroup |
TWikiOrgStatistics 2024-02-01 - 08:36 PeterThoeny |
PrinceXML 2023-09-09 - 00:35 JamesPaden |
| *Most recent changes* | %SEARCH{ ".*" regex="on" nosearch="on" nototal="on" order="modified" reverse="on" limit="10" format="| [[$topic]] <br />$date<br />$wikiname |" }%-- ArthurClemens - 06 Sep 2003 FormattedSearch understands now
$username
, $wikiname
() and $wikiusername
. This small enhancement makes formatted search consistent with the TWikiVariables USERNAME
, WIKINAME
and WIKIUSERNAME
, respectively.
A slightly modified version (better performance) is now in TWikiAlphaRelease and at TWiki.org, to be released in CairoRelease. Documentation at FormattedSearch is updated as well.
Use the FormattedSearchFormTesting to test drive this feature. Note that $username
and $wikiname
are identical at TWiki.org.
Index: Search.pm =================================================================== RCS file: /cvsroot/twiki/twiki/lib/TWiki/Search.pm,v retrieving revision 1.49 diff -c -r1.49 Search.pm *** Search.pm 10 Aug 2003 19:52:39 -0000 1.49 --- Search.pm 8 Sep 2003 05:09:30 -0000 *************** *** 519,524 **** --- 519,525 ---- $tempVal =~ s/\$isodate/&TWiki::revDate2ISO($revDate)/geos; $tempVal =~ s/\$rev/1.$revNum/gos; $tempVal =~ s/\$wikiusername/$revUser/gos; + $tempVal =~ s/\$wikiname/wikiName($revUser)/geos; $tempVal =~ s/\$username/&TWiki::wikiToUserName($revUser)/geos; if( $tempVal =~ m/\$text/ ) { # expand topic text *************** *** 771,776 **** --- 772,786 ---- $theText = "" unless( $theText =~ s/$thePattern/$1/is ); return $theText; + } + + #========================= + sub wikiName + { + my( $theWikiUserName ) = @_; + + $theWikiUserName =~ s/^.*\.//o; + return $theWikiUserName; } #=========================-- PeterThoeny - 08 Sep 2003 Category: TWikiPatches
WebForm | |
---|---|
TopicClassification | FeatureDone |
TopicSummary | New $wikiname variable in format parameter of formatted search |
InterestedParties | |
AssignedTo | |
AssignedToCore | ArthurClemens |
ScheduledFor | CairoRelease |
RelatedTopics | |
SpecProgress | 100% |
ImplProgress | 100% |
DocProgress | 100% |
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
diff | simpleUserNameFromSearch.diff | r1 | manage | 0.7 K | 2003-09-05 - 22:26 | UnknownUser | Patch file to get a short name from a search |
diff | simpleUserNameFromSearch_wikiname.diff | r1 | manage | 0.7 K | 2003-09-06 - 19:26 | UnknownUser | same patch but uses $wikiname |