Ignore:
Timestamp:
12/09/08 18:16:48 (3 years ago)
Author:
CrawfordCurrie
Message:

Item253: remove TWikiDrawPlugin hack; analyse, rationalise and document usage of redirectto; Item5926: added encodings that were proposed to make chinese work (they don't break anything AFAICT). Deprecate Foswiki::Func::getRegularExpression (the regex array is published)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Func.pm

    r1050 r1221  
    12781278=begin TML 
    12791279 
    1280 ---+++ saveTopic( $web, $topic, $meta, $text, $options ) -> $error 
     1280---+++ saveTopic( $web, $topic, $meta, $text, $options ) 
    12811281 
    12821282   * =$web= - web for the topic 
     
    12891289     | =forcenewrevision= | force the save to increment the revision counter | 
    12901290     | =minor= | True if this is a minor change, and is not to be notified | 
    1291 Return: error message or undef. 
    12921291 
    12931292For example, 
     
    13001299__Note:__ Plugins handlers ( e.g. =beforeSaveHandler= ) will be called as 
    13011300appropriate. 
     1301 
     1302In the event of an error an exception will be thrown. Callers can elect 
     1303to trap the exceptions thrown, or allow them to propagate to the calling 
     1304environment. May throw Foswiki::OopsException, Foswiki::AccessControlException or Error::Simple. 
    13021305 
    13031306=cut 
     
    23202323=begin TML 
    23212324 
    2322 ---+++ getRegularExpression( $name ) -> $expr 
    2323  
    2324 Retrieves a Foswiki predefined regular expression or character class. 
    2325    * =$name= - Name of the expression to retrieve.  See notes below 
    2326 Return: String or precompiled regular expression matching as described below. 
    2327  
    2328 __Note:__ Foswiki internally precompiles several regular expressions to 
    2329 represent various string entities in an <nop>I18N-compatible manner. Plugins 
    2330 authors are encouraged to use these in matching where appropriate. The 
    2331 following are guaranteed to be present. Others may exist, but their use 
    2332 is unsupported and they may be removed in future Foswiki versions. 
    2333  
    2334 In the table below, the expression marked type 'String' are intended for 
    2335 use within character classes (i.e. for use within square brackets inside 
    2336 a regular expression), for example: 
    2337 <verbatim> 
    2338    my $upper = Foswiki::Func::getRegularExpression('upperAlpha'); 
    2339    my $alpha = Foswiki::Func::getRegularExpression('mixedAlpha'); 
    2340    my $capitalized = qr/[$upper][$alpha]+/; 
    2341 </verbatim> 
    2342 Those expressions marked type 'RE' are precompiled regular expressions that can be used outside square brackets. For example: 
    2343 <verbatim> 
    2344    my $webRE = Foswiki::Func::getRegularExpression('webNameRegex'); 
    2345    my $isWebName = ( $s =~ m/$webRE/ ); 
    2346 </verbatim> 
    2347  
    2348 | *Name*         | *Matches*                        | *Type* | 
    2349 | upperAlpha     | Upper case characters            | String | 
    2350 | upperAlphaNum  | Upper case characters and digits | String | 
    2351 | lowerAlpha     | Lower case characters            | String | 
    2352 | lowerAlphaNum  | Lower case characters and digits | String | 
    2353 | numeric        | Digits                           | String | 
    2354 | mixedAlpha     | Alphabetic characters            | String | 
    2355 | mixedAlphaNum  | Alphanumeric characters          | String | 
    2356 | wikiWordRegex  | WikiWords                        | RE | 
    2357 | webNameRegex   | User web names                   | RE | 
    2358 | anchorRegex    | #AnchorNames                     | RE | 
    2359 | abbrevRegex    | Abbreviations e.g. GOV, IRS      | RE | 
    2360 | emailAddrRegex | email@address.com                | RE | 
    2361 | tagNameRegex   | Standard variable names e.g. %<nop>THIS_BIT% (THIS_BIT only) | RE | 
    2362  
    2363 =cut 
    2364  
    2365 sub getRegularExpression { 
    2366     my ($regexName) = @_; 
    2367     return $Foswiki::regex{$regexName}; 
    2368 } 
    2369  
    2370 =begin TML 
    2371  
    23722325---+++ normalizeWebTopicName($web, $topic) -> ($web, $topic) 
    23732326 
     
    25092462=begin TML 
    25102463 
     2464---+++ isValidWebName( $name, $system ) -> $boolean 
     2465 
     2466Check for a valid web name. If $system is true, then 
     2467system web names are considered valid (names starting with _) 
     2468otherwise only user web names are valid 
     2469 
     2470If $Foswiki::cfg{EnableHierarchicalWebs} is off, it will also return false 
     2471when a nested web name is passed to it. 
     2472 
     2473=cut 
     2474 
     2475sub isValidWebName { 
     2476    return Foswiki::isValidWebName(@_); 
     2477} 
     2478 
     2479=begin TML 
     2480 
     2481---++ StaticMethod isValidTopicName( $name ) -> $boolean 
     2482 
     2483Check for a valid topic name. 
     2484 
     2485=cut 
     2486 
     2487sub isValidTopicName { 
     2488    return Foswiki::isValidTopicName(@_); 
     2489} 
     2490 
     2491=begin TML 
     2492 
    25112493---+++ extractParameters($attr ) -> %params 
    25122494 
     
    25812563The following functions are retained for compatibility only. You should 
    25822564stop using them as soon as possible. 
     2565 
     2566=cut 
     2567 
     2568=begin TML 
     2569 
     2570---+++ getRegularExpression( $name ) -> $expr 
     2571 
     2572*Deprecated* 28 Nov 2008 - use =$Foswiki::regex{...}= instead, it is directly 
     2573equivalent. 
     2574 
     2575See System.DevelopingPlugins for more information 
     2576 
     2577=cut 
     2578 
     2579sub getRegularExpression { 
     2580    my ($regexName) = @_; 
     2581    return $Foswiki::regex{$regexName}; 
     2582} 
     2583 
     2584=begin TML 
    25832585 
    25842586---+++ getScriptUrlPath( ) -> $path 
Note: See TracChangeset for help on using the changeset viewer.