|
META TOPICPARENT |
name="TWikiVariables" |
TWiki Formatted Search |
|
$web |
Name of the web |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot |
Double quote (" ) (\" also works) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
|
|
< < | 2. format="..." parameter |
> > | 2. footer="..." parameter
Use the footer parameter to specify the footer of a search result. It should correspond to the format of the format parameter. This parameter is optional. Example: footer="| *Topic* | *Summary* |"
Variables that can be used in the footer string:
Name:<-- --> |
Expands To: |
$dollar |
Dollar sign ($ ) |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nhits |
Number of hits if multiple="on" . Cumulative across all topics in current web. Identical to $ntopics unless multiple="on" |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$ntopics |
Number of topics found in current web |
$percnt |
Percent sign (% ) |
$quot |
Double quote (" ) (\" also works) |
$web |
Name of the web |
3. format="..." parameter |
|
Use the format parameter to specify the format of one search hit.
Example: format="| $topic | $summary |" |
|
$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. • 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 e-mail 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 |
$count(reg-exp) |
Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under $pattern(reg-exp) . Example: $count(.*?(---[+][+][+][+]) .*) counts the number of <H4> headers in a page. |
|
|
> > |
$ntopics |
Number of topics found in current web. This is the current topic count, not the total number of topics |
$nhits |
Number of hits if multiple="on" . Cumulative across all topics in current web. Identical to $ntopics unless multiple="on" |
|
|
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot |
Double quote (" ) (\" also works) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
Examples |
|
Write this: |
|
< < | %SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" }% |
> > | %SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" footer=" * *Topic: Summary*" }% |
|
To get this: |
|
< < |
- Topic: Summary:
- NatSkinFAQ: NatSkinFAQ The documentation of nop NatSkin is crap. I'm lost! If you need help there are a couple of options: Create a support request on TWiki:Support/WebHome ...
- TWikiFAQ: Frequently Asked Questions About TWiki This is a real FAQ, and also a demo of an easily implemented knowledge base solution. To see how it's done, view the source ...
- TWikiFaqTemplate: FAQ: Answer: Back to: TWikiFAQ
- TextFormattingFAQ: Text Formatting FAQ The most frequently asked questions about text formatting are answered. Also, TextFormattingRules contains the complete TWiki shorthand system ...
|
> > |
- Topic: Summary:
- NatSkinFAQ: NatSkinFAQ The documentation of nop NatSkin is crap. I'm lost! If you need help there are a couple of options: Create a support request on TWiki:Support/WebHome ...
- TWikiFAQ: Frequently Asked Questions About TWiki This is a real FAQ, and also a demo of an easily implemented knowledge base solution. To see how it's done, view the source ...
- TWikiFaqTemplate: FAQ: Answer: Back to: TWikiFAQ
- TextFormattingFAQ: Text Formatting FAQ The most frequently asked questions about text formatting are answered. Also, TextFormattingRules contains the complete TWiki shorthand system ...
- Topic: Summary
|
|
Table showing form field values of topics with a form |
|
Related Topics: UserDocumentationCategory, SearchHelp, TWikiVariables#VarSEARCH, SearchPatternCookbook, RegularExpression |
|
< < | -- Contributors: TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie |
> > | -- Contributors: TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie, TWiki:Main.SopanShewale |