Tags:
create new tag
, view all tags

Question

Hello,

All of our topics start out with a title line line, like:

---+ This ... is ... the ... title

We are using the GenPDFAddOn. This addon can create custom title pages by setting the GENPDFADDON_TITLE variable.

I wish to use the title line of a topic as the title on the PDF frontpage, so I need to extract this line out of the current topic.

I tried to fill the title variable using:

%SEARCH{ ".*" scope="text" regex="on" nosearch="on" nototal="on" topic=%TOPIC% format="$pattern(.*?---\++\ (.*?[^\n\r]+).*)" }%

thinking that this would extract the title line out of the current topic.

But this doesn't work, I get the list of topics in the web.

Is there another (or better) way to do what I want?

Environment

TWiki version: TWikiRelease04x00x05
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Etch
Web server: Apache 2.2.3
Perl version: 5.8.8
Client OS: MS windows XP
Web Browser: Firefox
Categories: Search, Add-Ons

-- GerritJanBaarda - 09 Jul 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Your SEARCH variable works with a tiny correction: Enclose the %TOPIC% variable in quotes. I admit that the result of the query without quotes is very surprising. Looks like a quirk in TWiki's attribute parser which I am sorry to say that I am too lazy to examine right now wink

As a minor change I've removed the .*? from your capture - it isn't necessary since the [] construct should capture the same result anyway.

%SEARCH{ ".*" scope="text" regex="on" nosearch="on" nototal="on" topic="%TOPIC%" format="$pattern(.*?---\++\ ([^\n\r]+).*)" }%

Look here for a life example of the same regular expression:

Question

-- HaraldJoerg - 09 Jul 2007

Thanks! that did the trick...

-- GerritJanBaarda - 10 Jul 2007

 
Change status to:
Topic revision: r5 - 2007-07-10 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.