You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2012/08/30 22:11:48 UTC

svn commit: r1379115 - in /trafficserver/site/trunk/lib: WikiVar.pm doxy-link.pm

Author: amc
Date: Thu Aug 30 20:11:47 2012
New Revision: 1379115

URL: http://svn.apache.org/viewvc?rev=1379115&view=rev
Log:
Fixed another WikiVar bug and added delimiter access methods.

Modified:
    trafficserver/site/trunk/lib/WikiVar.pm
    trafficserver/site/trunk/lib/doxy-link.pm

Modified: trafficserver/site/trunk/lib/WikiVar.pm
URL: http://svn.apache.org/viewvc/trafficserver/site/trunk/lib/WikiVar.pm?rev=1379115&r1=1379114&r2=1379115&view=diff
==============================================================================
--- trafficserver/site/trunk/lib/WikiVar.pm (original)
+++ trafficserver/site/trunk/lib/WikiVar.pm Thu Aug 30 20:11:47 2012
@@ -229,7 +229,8 @@ sub new {
     }
     # Clip delimiter from any quote matching
     $marks =~ s/$dl_left//;
-    delete $QUOTE_TABLE{$dl};
+    my %quote_table = %QUOTE_TABLE; # copy so we don't mess up other instances when we clip.
+    delete $quote_table{$dl};
     # Clip out the keyword mark if set (only symmetric quotes supported)
     my $kw = $self->[KEYWORD_MARK];
     if ($kw) {
@@ -243,7 +244,7 @@ sub new {
     my $quoted_value_rxp = join('|', map { my $c = quotemeta($_); $c.'[^'.$c.']*'.$c} split(//,$marks));
     # Generate an RE for the assymmetric quotes
     my @paren_rxp;
-    while (my ($left, $right) = each %QUOTE_TABLE) {
+    while (my ($left, $right) = each %quote_table) {
         push(@paren_rxp, "[$left][^$left]*[$right]");
     }
     my $paren_rxp = join('|', @paren_rxp);
@@ -527,6 +528,18 @@ sub error_bounding_text {
     return ($self->[PRE_ERROR_TEXT], $self->[POST_ERROR_TEXT]);
 }
 
+# Return the left (leading) delimiter.
+sub left_delimiter {
+    my $self = _self(\@_);
+    return $self->[DELIMITER];    
+}
+# return the right (trailing) delimiter;
+sub right_delimiter {
+    my $self = _self(\@_);
+    my $delim = $self->[DELIMITER];
+    return $QUOTE_TABLE{$delim} || $delim;
+}
+
 # Return our version
 sub Version {
     return $VERSION;
@@ -737,11 +750,11 @@ This can be changed later using the C<fa
 
 =item PRE_ERROR_TEXT, POST_ERROR_TEXT
 
-If an error occurs, an error message is
-generated and used as the value of the variable causing the error. These values
-are prepended and appended to that message. The default is C<E<lt>!-- WikiVar
-Error:> and C< --E<gt>> respectively, so that if used to process HTML the errors
-are findable but not visible.
+If an error occurs, an error message is generated and used as the value of the
+variable causing the error. The C<PRE_ERROR_TEXT> and C<POST_ERROR_TEXT> values
+are prepended and appended to that message respectively. The defaults are
+C<E<lt>!-- WikiVar Error:> and C< --E<gt>> respectively so that if used to
+process HTML the errors are findable but not visible.
 
 =back
 
@@ -947,6 +960,14 @@ multiple times.
 
 =back
 
+=head4 Method left_delimiter
+
+Returns the character that is the left delimiter for a macro.
+
+=head4 Method right_delimiter
+
+Returns the character that is the right delimiter for a macro.
+
 =head2 Example
 
 Here is some example text illustrating the basic usage.

Modified: trafficserver/site/trunk/lib/doxy-link.pm
URL: http://svn.apache.org/viewvc/trafficserver/site/trunk/lib/doxy-link.pm?rev=1379115&r1=1379114&r2=1379115&view=diff
==============================================================================
--- trafficserver/site/trunk/lib/doxy-link.pm (original)
+++ trafficserver/site/trunk/lib/doxy-link.pm Thu Aug 30 20:11:47 2012
@@ -22,15 +22,16 @@ our $LOADED_P = 0;
 our $SYMBOLS;
 # Array of source files
 our $FILES;
+# Our WikiVar instance.
+our $WV;
 
 sub wikivar_fallback {
     # Just generate the function name, in effect escaping WikiVar uses
     # that are not defined.
-    return $_[0]->[0];
+    return $WV->left_delimiter . $_[0]->[0] . $WV->right_delimiter;
 }
 
-# Our instance of WikiVar
-our $WV = Text::WikiVar->new
+$WV = Text::WikiVar->new
     ( KEYWORD_MARK => ':'
     , DELIMITER => '['
     , FALLBACK => \&wikivar_fallback