This question about Using an extension: Answered

Remove potential newlines vom TML matches

Im using FilterPlugin to extract parts of topics and build a table of them.

This is a stripped down version of what Im doing:

TODO as: Clean desktop. kdfh kfh kfh kaf kafh.
TODO jl: Turn of heating. blah blubb.
TODO as: Clean house. This should be done soon.
TODO jl: Go to supermarket and buy ham
and eggs.


%EXTRACT{topic="%TOPIC%" expand="off" pattern="TODO ([^;]+?):([^.]+)\." format="| $1 | $percntSUBST{
    text=\"$2\" 
    pattern=\"([\r\n])\" 
    format=\"<br/>\"
  }$percnt |$n"
  header="| *Who* | *What do to* |$n"
}%

The table builds fine. However, if there are linebreaks in the matched substring (relevant only for $2), then this breaks the TML table layout (Demonstrated by the last TODO).

Is there any possibility to remove unwanted newlines before they are inserted into the text? The same would be useful if I would want to build a bulleted list.


Try a nested SUBST expression (have fixed up your example). Of course, this will die if your text contains double-quotes (") - you may wish to use HTML tables instead of TML (if you need column sorting, consider JQTablePlugin)

-- PaulHarvey - 04 Apr 2010

QuestionForm edit

Subject Using an extension
Extension FilterPlugin
Version TWikiRelease04x03x00
Status Answered
Topic revision: r2 - 04 Apr 2010, PaulHarvey - This page was cached on 16 Oct 2018 - 15:48.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy