Tags:
create new tag
, view all tags

Question

I would like have a topic display the exact string held by a variable, ie. as used in the 'Set' line.

Right now, assume one or more of my site preferences, local site preferences, user preferences, web preferences contains a

  • Set VAR = <em>Hi there!</em>

If this variable is subsequently used in a topic to render Hi there!, I can only either:

  1. view the topic's source, and see %VAR%
  2. view the rendered topic, and see the results of the markup contained in %VAR%, in this case Hi there!

I would like to be able to

  1. view a topic containing whatever markup and a reference to %VAR% that displays <em>Hi there!</em>.

so that I know exactly what string the preferences document (it's hard to track down which) set VAR to.

I tried using

<verbatim>
   %VAR%
</verbatim>

but that just shows

   %VAR%

ie. without expanding the variable first. The same happened with <pre>.

So, I guess the short version of my question is: is there a way to expand variables without applying the markup filter?

Environment

TWiki version: TWikiRelease04x00x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Sarge
Web server: Apache 1.3.33
Perl version: 5.8.4
Client OS: Debian Sarge
Web Browser: Firefox 1.4
Categories: Missing functionality

-- EmileVanBergen - 12 Apr 2006

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.

The verbatim tag shows text verbatim.

Example:

  • Set TESTVAR = Hi there!

Result with verbatim tag:

   %TESTVAR%

If you use the pre tag you get:

   Hi there!

This expands the variable, but also renders it.

You can get the raw text of a topic with this URL:
%SCRIPTURL%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%?raw=on&contenttype=text/plain&skin=text

Test:
http://www.twiki.org/cgi-bin/view/Support/HowToExpandVariablesWithoutRendering?raw=on&contenttype=text/plain&skin=text

This will show the whole topic in raw text mode.

Not sure if it is possible to get only the variable and show it in un-rendered form.

-- PeterThoeny - 12 Apr 2006

The raw text skin doesn't help, as that still displays the variables instead of their content, just as <verbatim> does.

It does indeed not seem possible to display a variable's contents without interpreting it as markup.

That's too bad, because I now have to track down the actual topic containing the 'Set' to learn the contents. And that's hard; there's no quick way to find out where a variable came from. The variable override chain contains 3-7 steps (site preferences, site local preferences, user preferences, web preferences, topic preferences, etc.) I now often find...xargs...grep on the command line for 'Set VAR', but that sure is a clunky way of doing things, even if faster than most web based methods.

-- EmileVanBergen - 13 Apr 2006

Emile, are you wanting to have a topic that looks like this in raw mode:

---+++ title
%BLUEBEAN% was here
| time | details |
| 1 hour | doing stuff thats implotant |
AS:
---+++ title
Hello there, was here
| time | details |
| 1 hour | doing stuff thats implotant |

ie you want half the rendering pass?

if so, I might have something for you that I can drag up from my archives - email me at SvenDowideit@WikiRingPLEASENOSPAM.com

-- SvenDowideit - 13 Apr 2006

Why not share that here?

-- PeterThoeny - 14 Apr 2006

Because looking for it in my archives will take a few hours, and then i'll have to clean it up to be publishable? I have a huge store of test and proof of concept code.... and much of it only works on whatever version systems i was working on at the time.

And quite honestly, I don't have the time to do so, unless it is actually what Emile needs.

-- SvenDowideit - 15 Apr 2006

That's indeed exactly what I need. Sven, if you can spare the time, it'd be great.

Cheers,

-- EmileVanBergen - 19 Apr 2006

Marking this as answered. Anyone wanting to raise this question again, contact Emile or Sven directly.

-- CrawfordCurrie - 23 Apr 2006

 
Topic revision: r10 - 2006-04-23 - CrawfordCurrie
 
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.