From doxia-commitsmartinnancy@example.net Fri Apr 20 02:09:14 2007
Return-Path: <doxia-commitsmartinnancy@example.net>
Delivered-To: martinnancy@example.net
Received: (qmail 24737 invoked from network); 20 Apr 2007 02:09:14 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 20 Apr 2007 02:09:14 -0000
Received: (qmail 84079 invoked by uid 500); 20 Apr 2007 02:09:21 -0000
Delivered-To: martinnancy@example.net
Received: (qmail 84061 invoked by uid 500); 20 Apr 2007 02:09:20 -0000
Mailing-List: contact martinnancy@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:martinnancy@example.net>
List-Unsubscribe: <mailto:martinnancy@example.net>
List-Post: <mailto:martinnancy@example.net>
List-Id: <doxia-commits.maven.apache.org>
Reply-To: martinnancy@example.net
Delivered-To: mailing list martinnancy@example.net
Received: (qmail 84050 invoked by uid 99); 20 Apr 2007 02:09:20 -0000
Received: from herse.apache.org (HELO herse.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Apr 2007 19:09:20 -0700
X-ASF-Spam-Status: No, hits=-99.5 required=10.0
	tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Apr 2007 19:09:13 -0700
Received: by eris.apache.org (Postfix, from userid 65534)
	id 88F821A9838; Thu, 19 Apr 2007 19:08:53 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r530611 -
 /maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
Date: Fri, 20 Apr 2007 02:08:53 -0000
To: martinnancy@example.net
From: martinnancy@example.net
X-Mailer: svnmailer-1.1.0
Message-Id: <martinnancy@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: jdcasey
Date: Thu Apr 19 19:08:52 2007
New Revision: 530611

URL: http://svn.apache.org/viewvc?view=rev&rev=530611
Log:
Adding escape sequence for pipe and equals sign using backslash character, so we can embed more advanced macro parameter values, like scripting lines.

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java?view=diff&rev=530611&r1=530610&r2=530611
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java Thu Apr 19 19:08:52 2007
@@ -2192,6 +2192,8 @@
             String s = text;
 
             s = s.substring( 2, s.length() - 1 );
+            
+            s = escapeForMacro( s );
 
             String[] params = StringUtils.split( s, "|" );
 
@@ -2203,7 +2205,10 @@
             {
                 String[] param = StringUtils.split( params[i], "=" );
 
-                parameters.put( param[0], param[1] );
+                String key = unescapeForMacro( param[0] );
+                String value = unescapeForMacro( param[1] );
+                
+                parameters.put( key, value );
             }
 
             parameters.put( "sourceContent", sourceContent );
@@ -2225,6 +2230,38 @@
             {
                 throw new AptParseException( "Unable to find macro used in the APT document", e );
             }
+        }
+
+        private String escapeForMacro( String s )
+        {
+            if ( s == null || s.length() < 1 )
+            {
+                return s;
+            }
+            
+            String result = s;
+            
+            // use some outrageously out-of-place chars for text 
+            // (these are device control one/two in unicode)
+            result = StringUtils.replace( result, "\\=", "\u0011" );
+            result = StringUtils.replace( result, "\\|", "\u0012" );
+            
+            return result;
+        }
+        
+        private String unescapeForMacro( String s )
+        {
+            if ( s == null || s.length() < 1 )
+            {
+                return s;
+            }
+            
+            String result = s;
+            
+            result = StringUtils.replace( result, "\u0011", "=" );
+            result = StringUtils.replace( result, "\u0012", "|" );
+            
+            return result;
         }
     }
 




{'source': 'Apache Software Foundation Public Mail Archives'}