create new tag
, view all tags

Feature Proposals » INCLUDE to be able to include a topic in the raw


Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
MergedToCore HideyoImazu AcceptedBy7DayFeedbackPeriod 2013-06-25   TWikibug:Item7289 JerusalemRelease

Edit Form

DateOfCommitment:   Format: YYYY-MM-DD


There are cases where you want to include a topic in the raw, without variables in the included topic expanded in the included topic's context. Those variables are expanded in in the including topic's context instead.

Description and Documentation

This is an extension of raw="on" parameter, which currently takes effect only when you include from outside TWiki via HTTP. With this enhancement, when a topic is included, if raw="on" is specified, the specified topic is included as is without variables in the included topic are not expanded in the included topic's context.

Let's say there is a topic named IncludedTopic whose content is %TOPIC%.

!IncludedTopic: %TOPIC%

If that's included by another topic IncludingTopic with raw="on" parameter and this enhancement is in effect, IncludingTopic shows IncludedTopic.

!IncludingTopic: %INCLUDE{"IncludedTopic" raw="on"}% -> IncludingTopic

This is because when IncludedTopic is included by IncludingTopic, the variable %TOPIC% is not expanded and the processing of %INCLUDE{"IncludedTopic" raw="on"}% ends there. Then, %TOPIC% is expanded in the IncludingTopic's context.

On the other hand, if you don't have raw="on", %TOPIC% is expanded in IncludedTopic's context.

!IncludingTopic: %INCLUDE{"IncludedTopic"}% -> IncludedTopic


One use case is in a template topic having %EOTC__INCLUDE{... raw="on"}%.

When a new topic is created based on a template topic, variable expansion doesn't happen for the most part. But by prefixing a variable name with EOTC__ (EOTC stands for "expand only in topic creation". FinerControlVariableExpansionInTopicCreation), you can force the variable expanded.

When a topic is INCLUDE'd, usually, variables in the included topic are expanded in the INCLUDE'd topic's context. You may not want it to happen. This happens e.g. when a topic template consists of three three parts managed separately. Let's call them TmplPartA, TmplPartB, and TmplPartC. And the topic template topic is as follows.

%EOTC__INCLUDE{"TmplPartA" raw="on"}%
%EOTC__INCLUDE{"TmplPartB" raw="on"}%
%EOTC__INCLUDE{"TmplPartC" raw="on"}%

If raw="on" is not specified in %EOTC__INCLUDE{...}%, variables in TmplPartA, TmplPartB, and TmplPartC are expanded in the context of TmplPartA, TmplPartB, and TmplPartC. You cannot put variables in a new topic created based on the template topic.



-- Contributors: Hideyo Imazu - 2013-06-25


Sensible incremental enhancement.

-- Peter Thoeny - 2013-06-25

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