Tags:
create new tag
view all tags

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

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2002-05-28 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.