FormattedSearch 15 - 27 Jul 2004 - Main.PeterThoeny
|
|
META TOPICPARENT | name="TWikiVariables" |
| | Inline search feature allows flexible formatting of search result | |
< < | The %SEARCH{...}% variable documented in TWikiVariables has a fixed format for the search result, that is, a table consisting of topic names and topic summaries. Use the format="..." parameter to specify a customized format of the search result. The string of the format parameter is typically a bullet list or table row containing variables (such as %SEARCH{ "food" format="| $topic | $summary |" }% ). | > > | The %SEARCH{...}% variable documented in TWikiVariables has a fixed format for the search result, that is, a table consisting of topic names and topic summaries. Use the format="..." parameter to specify a customized format of the search result. The string of the format parameter is typically a bullet list or table row containing variables (such as %SEARCH{ "food" format="| $topic | $summary |" }% ). | | Syntax | |
$topic(20) | Topic name, "- " hyphenated each 20 characters |
$topic(30, -<br />) | Topic name, hyphenated each 30 characters with separator "-<br />" |
$topic(40, ...) | Topic name, shortended to 40 characters with "..." indication |
| |
> > |
$parent | Name of parent topic; empty if not set |
$parent(20) | Name of parent topic, same hyphenation/shortening like $topic() |
| |
$text | Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit. |
$locked | LOCKED flag (if any) |
$date | Time stamp of last topic update, e.g. 28 Nov 2024 - 15:47 |
| |
$formfield(name, 10) | Form field value, "- " hyphenated each 10 characters |
$formfield(name, 20, -<br />) | Form field value, hyphenated each 20 characters with separator "-<br />" |
$formfield(name, 30, ...) | Form field value, shortended to 30 characters with "..." indication |
| |
< < |
$pattern(reg-exp) | A regular expression pattern to extract some text from a topic (does not search meta data; use $formfield instead). In case of a multiple="on" search, the pattern is applied to the line found in each search hit. The pattern must cover the whole text (topic or line). For example, $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ... . This example has non-greedy .*? patterns to scan for the first occurance of the Email bullet; use greedy .* patterns to scan for the last occurance. |
| > > |
$pattern(reg-exp) | A regular expression pattern to extract some text from a topic (does not search meta data; use $formfield instead). In case of a multiple="on" search, the pattern is applied to the line found in each search hit. • Specify a RegularExpression that covers the whole text (topic or line), which typically starts with .* , and must end in .* • Put text you want to keep in parenthesis, like $pattern(.*?(from here.*?to here).*) • Example: $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ... • This example has non-greedy .*? patterns to scan for the first occurance of the Email bullet; use greedy .* patterns to scan for the last occurance • Limitation: Do not use .*) inside the pattern, e.g. $pattern(.*foo(.*)bar.*) does not work, but $pattern(.*foo(.*?)bar.*) does • Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag |
| |
$n or $n() | New line |
$nop or $nop() | Is a "no operation". This variable gets removed; useful for nested search |
$quot | Double quote (" ). Alternatively write \" to escape it |
$percnt | Percent sign (% ) |
$dollar | Dollar sign ($ ) |
| |
< < | Note: For $pattern(reg-exp) , specify a RegularExpression that scans from start to end and contains the text you want to keep in parenthesis, like $pattern(.*?(from here.*?to here).*) . You need to make sure that the integrity of a web page is not compromised; for example, if you include a table make sure to include everything including the table end tag. | | Examples | | Table showing form field values of topics with a form | |
< < | Write this in the Know web: | > > | In a web where there is a form that contains a TopicClassification field, an OperatingSystem field and an OsVersion field we could write: | | | *Topic:* | *OperatingSystem:* | *OsVersion:* |
%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }% | |
< < | To get this: | > > | To get this: | | | | OperatingSystem: |
OsVersion: |
|
| |
< < | | > > | | | | |
|
< < | | > > | | | | |
- ATasteOfTWiki is referenced by:
- FormattedSearch is referenced by:
- ActionTrackerPlugin, BlackListPlugin, BreadCrumbsPlugin, CalendarPlugin, EditTablePlugin, EmptyPlugin, FilterPlugin, FlexWebListPlugin, FootNotePlugin, GluePlugin, IfDefinedPlugin, InterwikiPlugin, ManagingWebs, MySideBarTemplate, NatEditHelpText, NatEditWordHelpText, NatSkinPlugin, PreferencesPlugin, RedDotPlugin, RenderListPlugin, SearchHelp, SearchPatternCookbook, SlideShowPlugin, SmiliesPlugin, SpreadSheetPlugin, TWikiForms, TWikiHistory, TWikiMetaData, TWikiReferenceManual, TWikiReleaseNotes04x00, TWikiReleaseNotes04x01, TWikiScripts, TWikiSearchDotPm, TWikiSiteTools, TWikiUISearchDotPm, TWikiVariablesQuickStart, TreeBrowserPlugin, TreePlugin, VarMETA, VarSEARCH, VarURLPARAM, WebLeftBar, WelcomeGuest
- TWikiAccessControl is referenced by:
- EditTablePlugin, FileAttachment, MainFeatures, ManagingTopics, ManagingUsers, SitePermissions, SourceCode, TWikiAccessControl, TWikiForms, TWikiFuncDotPm, TWikiHistory, TWikiPreferences, TWikiReferenceManual, TWikiReleaseNotes04x01, TWikiScripts, TWikiSiteTools, TWikiTopics, TWikiTutorial, TWikiUserAuthentication, TWikiVariables, VarSEARCH, WebPreferences, WebPreferencesHelp, WikiCulture, WikiWord
- TWikiSite is referenced by:
- AdminToolsCategory, InstantEnhancements, InterwikiPlugin, ManagingWebs, StartingPoints, TWikiGlossary, TWikiI18NDotPm, TWikiInstallationGuide, TWikiPreferences, TWikiReferenceManual, TWikiScripts, TWikiSite, TWikiTopics, TWikiTutorial, TWikiUserAuthentication, TWikiUsersGuide, WabiSabi, WebLeftBar, WebSiteTools, WelcomeGuest, WhatDoesTWikiStandFor, WhatIsWikiWiki, WikiCulture, WikiReferences
- WabiSabi is referenced by:
- WhatIsWikiWiki is referenced by:
- WikiCulture is referenced by:
| |
> > | Note: Nested search can be slow, especially if you nest more then 3 times. Nesting is limited to 16 levels. For each new nesting level you need to "escape the escapes", e.g. write $dollarpercntSEARCH{ for level three, $dollardollarpercntSEARCH{ for level four, etc. | | Most recently changed pages
Write this: | | Result:
Number of topics: 0 | |
< < | -- TWiki:Main.PeterThoeny - 16 Mar 2004 | > > | -- TWiki:Main.PeterThoeny - 26 Jul 2004 | | |
|
Revision 15 | r15 - 27 Jul 2004 - 02:42:48 - PeterThoeny? |
Revision 14 | r14 - 08 May 2004 - 21:54:29 - PeterThoeny? |
|
|
This site is powered by the TWiki collaboration platform. All material on this collaboration platform is the property of the contributing authors. All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
|
|