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... |
| TWikiOrgStatistics: Monthly TWiki.org Statistics These are overall statistics across all webs. The latest numbers are also shown on the TWiki.org home page. See also SiteStatistics, OneYearSiteStatistic... |
Monthly TWiki.org Statistics These are overall statistics across all webs. The latest numbers are also shown on the TWiki.org home page. See also SiteStatistics, OneYearSiteStatistic... |
| UnregisteredUsersShouldBeTWikiGuests: Feature Proposal: Retaining REMOTE USER has too many problems Motivation In my company`s TWiki installation, we`re going to be always authenticated by an external... |
Feature Proposal: Retaining REMOTE USER has too many problems Motivation In my company`s TWiki installation, we`re going to be always authenticated by an external... |
| PrinceXML: Prince XML http://princexml.com/ Prince is a computer program that converts XML and HTML into PDF documents. Prince can read many XML formats, including XHTML... |
Prince XML http://princexml.com/ Prince is a computer program that converts XML and HTML into PDF documents. Prince can read many XML formats, including XHTML... |
| WebService: WebServices is going to be very important: http://www.webbasedservices.co.uk/ Web Services in general: Good overview of UDDI and WebServices here:... |
WebServices is going to be very important: http://www.webbasedservices.co.uk/ Web Services in general: Good overview of UDDI and WebServices here:... |
| EscapeHtmlInTWikiRegistration: Motivation To guard against exploits, HTML tags and HTML entities need to be escaped in the user registration, as well when updating TWiki user topics. Credit to Jesper... |
Motivation To guard against exploits, HTML tags and HTML entities need to be escaped in the user registration, as well when updating TWiki user topics. Credit to Jesper... |
| KnownIssuesOfTWiki06x01: Known Issues of TWiki 6.1.x Production Releases These are known issues of TWiki 6.1.0, code named KampalaRelease. The latest TWiki release is available at DownloadTWiki... |
Known Issues of TWiki 6.1.x Production Releases These are known issues of TWiki 6.1.0, code named KampalaRelease. The latest TWiki release is available at DownloadTWiki... |
| KnownIssuesOfTWiki06x00: Known Issues of TWiki 6.0.x Production Releases These are known issues of TWiki 6.0.0 TWiki 6.0.1, code named JerusalemRelease. The latest TWiki release is available... |
Known Issues of TWiki 6.0.x Production Releases These are known issues of TWiki 6.0.0 TWiki 6.0.1, code named JerusalemRelease. The latest TWiki release is available... |
| DownloadTWikiVM: Download Install TWiki VM 6.0.2 1 OVF Virtual Machine (VMware, Oracle VM...) Easy installation on Windows! ...and other platforms VMware, VirtualBox and Oracle... |
Download Install TWiki VM 6.0.2 1 OVF Virtual Machine (VMware, Oracle VM...) Easy installation on Windows! ...and other platforms VMware, VirtualBox and Oracle... |
| TWikiConsultants: Contact Peter Thoeny peter09 #64;thoeny.org 1 4O8 #53;O #53; #53;1O8 TWiki Consultants for Hire Need help with your TWiki? Consultants around the world can... |
Contact Peter Thoeny peter09 #64;thoeny.org 1 4O8 #53;O #53; #53;1O8 TWiki Consultants for Hire Need help with your TWiki? Consultants around the world can... |
$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 |