Tags:
create new tag
, view all tags

Feature Proposal: Finer-control variable expansion in topic creation

Motivation

In new topic creation, there are cases where you need to mix variables to be expanded and variables not to be expanded.

Variables inside a section whose type is expandvariables. But it's not practical to mix variables to be expanded and variables not to be expanded.

Description and Documentation

By this enhancement, outside the expandvariables section on a topic edit template, variables named EOTC__XYZ are expanded as XYZ when a new topic is created based on the edit template.

The variable name prefix EOTC__ ( EOTC followed by two underscores) came from "Expand Only in Topic Creation".

Examples

This is an artificial example but you can create a new topic consisted of %INCLUDE{...}% to include topics whose names start with the string specified by the prefix URL parameter handed to the edit or save script.

%EOTC__SEARCH{"."
 topic="%URLPARAM{prefix}%*"
 nonoise="on"
 format="$percntINCLUDE{$topic}$percnt" separator="$n"
}%

Impact

Implementation

-- Contributors: HideyoImazu - 2012-11-01

Discussion

I am OK with this proposal, although it is a little bit an esoteric case since it is possible to turn on/off variable expansion (which is already done in NewUserTemplate).

As for prefix, how about making it very obvious that this is a special case by separating this with a colon instead of double underscore? Example: %EOTC:SEARCH{...}%. The template system already uses colons, such as %TMPL:DEF{...}%.

-- PeterThoeny - 2012-11-01

I implemented it on TWiki 4.1.2 by tweaking TWiki::_expandTagOnTopicCreation(). For that, the prefix needs to match $TWiki::regex{tagNameRegex}. Is there a better way?

-- HideyoImazu - 2012-11-02

Accepted by 7 day review period at JerusalemReleaseMeeting2012x11x09, but with request to look into %EOTC:SEARCH{...}% rule with colon.

-- PeterThoeny - 2012-11-09

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2013-02-18 - HideyoImazu
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.