• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

In TWiki:TWiki.TWikiApplications, users often apply view templates that separate what is visible in a topic but yet should not be user editable, from material that should be edited in the textarea. Some material is thus migrated from the textarea to areas in the template preceding or following the space for the text.

Note that the text is rendered separately from other parts of the template. Usually this is not a problem, except when the material put outside of the text should affect how the text is rendered. For example, users who try to put the <editsections /> tag into the template, hoping that then the topic will get sectioned by TWiki:Plugins.SectionalEditPlugin are in for a disappointment, as when the text is rendered, the tag is not seen.

To solve this dilemma, in our installation I have introduced a template tag %TEXTSTART% . Any material in the template after that tag will be rendered together with the text, but will not be seen during edit. Material that would affect the rendering of the text, such as above tag, or variable definitions, etc., but which should not be visible during edit should go here.

The following simple patch to lib/TWiki/UI/View.pm does the trick:

*** /e/www/twiki-dakar-4.0.2/lib/TWiki/UI/View.pm~   Fri Mar 31 23:44:35 2006
--- /e/www/twiki-dakar-4.0.2/lib/TWiki/UI/View.pm   Thu Aug 17 09:53:26 2006
***************
*** 285,290 ****
--- 285,297 ----
      } else {
          my @args = ( $session, $webName, $topicName, $meta, $minimalist );
  
+    # Add pre-text area to text
+    my @starts = split( /%TEXTSTART%/, $start );
+    if ( $#starts ) {
+      $start = $starts[0];
+      $text = $starts[1] . $text;
+    }
+ 
          $session->enterContext( 'header_text' );
          $page = _prepare($start, @args);
          $session->leaveContext( 'header_text' );

What do you guys think?


Changed to an enhancement.

I really, really don;t want to do this, for a couple of reasons. Firstly, it introduces yet another special tag into templates; there are already far too many undocumented special tags scattered about. Secondly, I think this sort of thing should be done by splitting up the template into macros that can be instantiated; viz

%TMPL:DEF{before_text}%....
%TMPL:DEF{text_body}%...
These are IMHO easier to document and if used consistently, are more flexible as a single text_body might be used in several templates. And they can be parameterised via %TMPL:P parameters.

CC


The template approach is already present in pattern skin.

AC


CC, you got to give me more than "I don't want to do this". I don't understand what you are saying above in terms of suggestion.

Same for AC, what are you saying?

Sorry for being dense, but I absolutely need a way of pushing material into the template in a way that it can affect the textarea. E.g., for TWiki:Plugins.SectionalEditPlugin, when we want to hide the section tag outside of the textarea.

I don't mind to use a different approach, but you guys got to give me something to work with.

Personally, I don't see anything wrong with the above approach, as it is consistent with what other things are being done with templates, in particular, in the pattern skin. -- TW


Discussion moved to TWiki:Codev.TemplateAffectsTextArea.
Checked in so that the solution can be examined. Supplied test case. -- TW

4.1.0 released

KJL

ItemTemplate
Summary Support templates to have text rendering affecting aspect outside of textarea
ReportedBy TWiki:Main.ThomasWeigert
Codebase ~twiki4
SVN Range TWiki-4.1, Sat, 23 Sep 2006, build 11571
AppliesTo Engine
Component

Priority Enhancement
CurrentState Closed
WaitingFor

Checkins 12010 12077
TargetRelease minor
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r10 - 2007-01-16 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback