Motivation
You can include an attachment with
%INCLUDE{%ATTACHURL%/filename.ext}%, which causes INCLUDE to retrieve the specified attachment directly without issuing an HTTP request to itself now that
TWikibug:Item7592
is implemented.
Still, this is roundabout -- composing an attachment URL and then having INCLUDE parse it.
Plus, you need to put variables such as
%ATTACHURL%,
%PUBURL%, and
%WEB% as shown in the examples below, which is no big deal but it's better to be able to do the same things without using those variables.
IncludeAttachment was proposed and partially implemented in 2004 but that feature seemed to have abandoned later.
This proposal is to revive that feature.
Description and Documentation
- Introduce
attachment="filename.ext" parameter to INCLUDE. Variables in the attachment is evaluated in the context of the web and topic it's attached
-
%INCLUDE{%PUBURL%/WebName/TopicName/filename.ext}% keeps working as before. It's close to %INCLUDE{"WebName.TopicName" attachment="filename.ext"}% but not identical -- topic context change doesn't happen. This is to make it consistent with an inclusion from outside TWiki.
Examples
| Conventional way |
Proposed way |
Variable expansion context of the proposed way |
Comment |
%INCLUDE{%ATTACHURL%/filename.ext}% |
%INCLUDE{attachment="filename.ext"}% |
current topic |
an attachment of the current topic |
%INCLUDE{%PUBURL%/%WEB%/TopicName/filename.ext}% |
%INCLUDE{"TopicName" attachment="filename.ext"}% |
TopicName |
an attachment of a different topic of the current web |
%INCLUDE{%PUBURL%/WebName/TopicName/filename.ext}% |
%INCLUDE{"WebName.TopicName" attachment="filename.ext"}% |
WebName.TopicName |
an attachment of a different web |
Impact
Implementation
--
Contributors:
Hideyo Imazu - 2014-11-21
Discussion
This is a sensible enhancement.
--
Peter Thoeny - 2014-11-30