create new tag
, view all tags

Implemented: New TWiki::Func::extractParameters Function to extract all parameters from a variable string

extractParameters( $attr ) ==> %params

Description: Extract all parameters from a variable string and returns a hash of parameters
Parameter: $attr Attribute string
Return: %params Hash containing all parameters. The nameless parameter is stored in key _DEFAULT
Since: TWiki::Plugins::VERSION 1.025 (26 Aug 2004)

  • Example:
    • Variable: %TEST{ "nameless" name1="val1" name2="val2" }%
    • First extract text between {...} to get: "nameless" name1="val1" name2="val2"
    • Then call this on the text:
      my %params = TWiki::Func::extractParameters( $text );
    • The %params hash contains now:
      _DEFAULT => "nameless"
      name1 => "val1"
      name2 => "val2"

This function complements the existing TWiki::Func::extractNameValuePair function. TWiki::Func::ExtractParameters is faster if you have several parameters to extract.

-- PeterThoeny - 29 Aug 2004


This was a simple addition for Cairo, so that Plugin authors can use it if needed.

After Cairo we can improve some places of the core code that use repeated extractNameValuePair calls.

I am aware of Crawford's Attrs function. The Attrs parsing differs from TWiki::Func::extractNameValuePair; Wiki::Func::extractParameters parsing is the same as TWiki::Func::extractNameValuePair.

-- PeterThoeny - 29 Aug 2004

TopicClassification FeatureDone
TopicSummary Plugins: New TWiki::Func::extractParameters Function to extract all parameters from a variable string


AssignedToCore PeterThoeny
ScheduledFor CairoRelease

SpecProgress 100%
ImplProgress 100%
DocProgress 100%
Topic revision: r1 - 2004-08-29 - 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.