• 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.

This is a performance issue for a number of reasons, but most notably, as CC has pointed out many times, because of the overhead of compilation.

There is an opportunity here to factor out common code in the same way thet TWiki::Func does.

One of my favourite code fragments is :-

sub replaceVars {
  my ($format, $data) = @_;

  if (defined $data) {
    if (defined $data->{wikiname}) {
      $data->{username} = &TWiki::Func::wikiToUserName($data->{wikiname});
      $data->{wikiusername} = &TWiki::Func::userToWikiName($data->{wikiname});
    }

    foreach my $key (keys %$data) {
      $format =~ s/\$$key/$data->{$key}/g;
    }
  }

  $format =~ s/\$n\b/\n/g;
  $format =~ s/\$quot\b/\"/gos;
  $format =~ s/\$percnt\b/\%/gos;
  $format =~ s/\$dollar\b/\$/gos;

  return $format;
}

Is this better as a core module or a Contrib?

ItemTemplate
Summary Extensive code duplication across Plugins
ReportedBy TWiki:Main.AntonAylward
Codebase

SVN Range Thu, 02 Feb 2006 build 8675
AppliesTo Extension
Component Many plugins
Priority Enhancement
CurrentState New
WaitingFor

TargetRelease major
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r4 - 2006-02-13 - AntonAylward
 
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