Question
For some reason extractions using formatted search that has CR or NL spoils the rendering of tables if you use them in the format field.
To avoid this I´ve been trying to extract a single parragraph out of a twiky page. The paraghaph will start with a known word. Se the following text:
Author: Miguel de Cervantes.
Comment: This is actually a second "text" line but it is rendered by Twiky as a single paragraph.
TWiki will render it as follows.
Author: Miguel de Cervantes.
Comment: This is actually a second text line but it is rendered by Twiky as a single paragraph.
The goal is to extract a "Text paragraph" (see source text) for example to get "Miguel de Cervantes." upon querying "Author:" in the search text. (No CR nor NL at the end of the extraction). Please note that "Commnet:" might not be the next word, so I can not use it as a extractor delimiter. The stractor delimiter should be [\n\r]*.
I know that this kind of extraction might be easier if I use Twiki forms, and or somehow marking-up the start and the end of the text of interest.
- TWiki version: Sept 2001
- Web server: Apache
- Server OS: Linux
- Web browser: IE
- Client OS: Windows 98
--
AntonioVega - 27 May 2002
Answer
Each TWiki table row needs to be on one line, this is spec. If you build a table with a formatted search you need to make sure not to include new lines.
Try this:
%SEARCH{ "Miguel de Cervantes" header="| Author | Comment |" format="| $pattern(.*?[\n\r]Author\: ([^\n\r]*).*) | $pattern(.*?[\n\r]Comment\: ([^\n\r]*).*) |" }%
To get this:
Search:
Miguel de Cervantes
| Author |
Comment |
| Miguel de Cervantes. |
This is actually a second "text" line but it is rendered by Twiky as a single paragraph. |
Number of topics: 1
--
PeterThoeny - 28 May 2002