format="" of FormattedSearch already has a $summary that returns the first 162 characters of a topic in plain text, stripped of all markup. It supports now a $summary(options); the options are comma separated tokens: 16 ... 512 indicates the number of characters shown in the summary
showvarnames shows the variables as VARIABLE and VARIABLE{...}; they are removed by default
noheader suppresses the headings at the beginning
$summary(showvarnames, noheader, 50) shows a summary of 50 characters with stripped heading on top and stripped variables
Interactive Example:
%SEARCH{ ".*" regex="on" order="modified" reverse="on" limit="10" nosearch="on" header="|*Topic: $summary*|*$summary()*|" format="|$topic:%BR% $summary|%BR%$summary()|" }%
| Topic: $summary | $summary() |
|---|---|
| WebStatistics: Statistics for Codev Web See also: TWikiOrgStatistics, TWikiDownloadStatistics Month: Topic Views: Topic Saves: Attachment Uploads: Most ... |
Statistics for Codev Web See also: TWikiOrgStatistics, TWikiDownloadStatistics Month: Topic Views: Topic Saves: Attachment Uploads: Most ... |
| RepositoryForSiteAndWebMetadata: Feature Proposal: Repository for site metadata, web metadata, and more %TOC% Motivation If you have hundreds or thousands of webs on a TWiki site, web metadata ... |
Feature Proposal: Repository for site metadata, web metadata, and more %TOC% Motivation If you have hundreds or thousands of webs on a TWiki site, web metadata ... |
| SolarisInstallCookbookPerlModules: Building CPAN Perl modules on Solaris 10 (and 11) %TOC% Why Solaris is different than Linux in this respect Building CPAN modules on Solaris might be a bit different ... |
Building CPAN Perl modules on Solaris 10 (and 11) %TOC% Why Solaris is different than Linux in this respect Building CPAN modules on Solaris might be a bit different ... |
| Solaris11InstallCookbook: Installing TWiki 5.x on Solaris 11 %TOC% Introduction This guide is for Solaris 11 and derivatives (i.e. distros based off OpenSolaris). This is basically a re write ... |
Installing TWiki 5.x on Solaris 11 %TOC% Introduction This guide is for Solaris 11 and derivatives (i.e. distros based off OpenSolaris). This is basically a re write ... |
| TWikiRelease05x01x00: Download TWiki Release 5.1.0 %YELLOWBG% %X% NOTE: This is an outdated release please download the latest TWiki release. %ENDBG% TWiki is open source software ... |
Download TWiki Release 5.1.0 %YELLOWBG% %X% NOTE: This is an outdated release please download the latest TWiki release. %ENDBG% TWiki is open source software ... |
| KnownIssuesOfTWiki05x01: Known Issues of TWiki 5.1.x Production Releases These are known issues of TWiki 5.1.0, code named istanbulRelease. The latest TWiki release is available at DownloadTWiki ... |
Known Issues of TWiki 5.1.x Production Releases These are known issues of TWiki 5.1.0, code named istanbulRelease. The latest TWiki release is available at DownloadTWiki ... |
| REST: REST REST (REpresentative State Transfer) is a technique for implementing WebServices using XML documents plus standard HTTP, using its well known operations (PUT ... |
REST REST (REpresentative State Transfer) is a technique for implementing WebServices using XML documents plus standard HTTP, using its well known operations (PUT ... |
| InformationSystemDesignUsingTWiki: Information System Design Using TWiki Book by PhilGochenour, XML Press, ISBN:978 0982219171, Apr 2012. Combining real world experience with a veteran teacher’s ability ... |
Information System Design Using TWiki Book by PhilGochenour, XML Press, ISBN:978 0982219171, Apr 2012. Combining real world experience with a veteran teacher’s ability ... |
| WikisForDummiesBook: Wikis for Dummies Book by DanWoods and PeterThoeny, ISBN:0470043997 Description: Corporations have finally realized the value of collaboration tools for knowledge ... |
Wikis for Dummies Book by DanWoods and PeterThoeny, ISBN:0470043997 Description: Corporations have finally realized the value of collaboration tools for knowledge ... |
| TopicDisplayName: Feature Proposal: Topic display name Create the possibility for a display name (the way a topic is shown as link) for every topic. %TOC% Motivation Display (topic ... |
Feature Proposal: Topic display name Create the possibility for a display name (the way a topic is shown as link) for every topic. %TOC% Motivation Display (topic ... |
$summary(noheader) funtionality.
While we are at it, should we change the default summary shown in search? Possibly with the variables stripped by default? Or should that also be a TWikiPreferences setting?
-- PeterThoeny - 25 Sep 2004
I would vote to strip the variables. "TOC PUBURL / TWIKIWEB" is not useful when reading a summary. I wonder if it would ever be, perhaps someone can think of borderline cases.
-- ArthurClemens - 25 Sep 2004
It looks like it is better to remove the vars by default. That means, we should change the novariables option to showvariablenames. Opinions?
-- PeterThoeny - 25 Sep 2004
I vote for stripping them (or would if there was a vote button).
Actually, a simple improvement would be to show me something interesting in the summary - how about the text of the last diff?
-- MartinCleaver - 26 Sep 2004
Text of last diff: This is out of scope of this feature here; it has been discussed in AllowDesignationOfSummary
OK, the novariables option should change to showvariablenames.
-- PeterThoeny - 28 Sep 2004
SVN and TWiki.org are updated with the spec change: Reversed logic and renamed novariables to showvarnames.
-- PeterThoeny - 28 Sep 2004
Hmm, I am preaching compatibility for existing content but this enhancement broke one TWikiApplication at work that has nested searches. One outer search introduces newlines; the $n got evaluated one level too early. This code fixes the issue:
--- Search.pm (revision 1762)
+++ Search.pm (working copy)
@@ -965,10 +965,6 @@
$tempVal =~ s/\$formfield\(\s*([^\)]*)\s*\)/getMetaFormField( $meta, $1 )/geos;
$tempVal =~ s/\$formname/_getMetaFormName( $meta )/geos;
$tempVal =~ s/\$pattern\((.*?\s*\.\*)\)/getTextPattern( $text, $1 )/geos;
- $tempVal =~ s/\$nop(\(\))?//gos; # remove filler, useful for nested search
- $tempVal =~ s/\$quot(\(\))?/\"/gos; # expand double quote
- $tempVal =~ s/\$percnt(\(\))?/\%/gos; # expand percent
- $tempVal =~ s/\$dollar(\(\))?/\$/gos; # expand dollar
$tempVal =~ s/\r?\n/$newLine/gos if( $newLine );
if( $theSeparator ) {
$tempVal .= $theSeparator;
@@ -977,6 +973,10 @@
}
$tempVal =~ s/\$n\(\)/\n/gos; # expand "$n()" to new line
$tempVal =~ s/\$n([^$mixedAlpha]|$)/\n$1/gos; # expand "$n" to new line
+ $tempVal =~ s/\$nop(\(\))?//gos; # remove filler, useful for nested search
+ $tempVal =~ s/\$quot(\(\))?/\"/gos; # expand double quote
+ $tempVal =~ s/\$percnt(\(\))?/\%/gos; # expand percent
+ $tempVal =~ s/\$dollar(\(\))?/\$/gos; # expand dollar
} elsif( $noSummary ) {
$tempVal =~ s/%TEXTHEAD%//go;
This change is now in SVN.
-- PeterThoeny - 19 Oct 2004
Small follow-up in MainBranch to remove leading and trailing spaces, needed to get correct text alignment for summaries in table cells.
-- PeterThoeny - 09 Nov 2004
| ChangeProposalForm | |
|---|---|
| TopicClassification | FeatureRequest |
| TopicSummary | Formatted Search with $summary(50, noheader, showvarnames) |
| CurrentState | MergedToCore |
| OutstandingIssues | |
| RelatedTopics | |
| InterestedParties | |
| ProposedFor | DakarRelease |
| TWikiContributors | PeterThoeny |