maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r607880 - in /maven/doxia: doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java site/src/site/apt/macros/index.apt
Date Tue, 01 Jan 2008 18:01:18 GMT
Author: dennisl
Date: Tue Jan  1 10:01:18 2008
New Revision: 607880

URL: http://svn.apache.org/viewvc?rev=607880&view=rev
Log:
[DOXIA-142] Allow snippet macro contents to be output as-is, instead of verbatim

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
    maven/doxia/site/src/site/apt/macros/index.apt

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java?rev=607880&r1=607879&r2=607880&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
Tue Jan  1 10:01:18 2008
@@ -67,6 +67,15 @@
 
         String fileParam = (String) request.getParameter( "file" );
 
+        boolean verbatim = true;
+
+        String verbatimParam = (String) request.getParameter( "verbatim" );
+
+        if ( verbatimParam != null && !"".equals( verbatimParam ) )
+        {
+            verbatim = Boolean.valueOf( verbatimParam ).booleanValue();
+        }
+
         URL url;
 
         if ( !StringUtils.isEmpty( urlParam ) )
@@ -114,11 +123,17 @@
             throw new MacroExecutionException( "Error reading snippet", e );
         }
 
-        sink.verbatim( true );
+        if ( verbatim )
+        {
+            sink.verbatim( true );
 
-        sink.text( snippet.toString() );
+            sink.text( snippet.toString() );
 
-        sink.verbatim_();
+            sink.verbatim_();
+        }
+        else {
+            sink.rawText( snippet.toString() );
+        }
     }
 
     /**

Modified: maven/doxia/site/src/site/apt/macros/index.apt
URL: http://svn.apache.org/viewvc/maven/doxia/site/src/site/apt/macros/index.apt?rev=607880&r1=607879&r2=607880&view=diff
==============================================================================
--- maven/doxia/site/src/site/apt/macros/index.apt (original)
+++ maven/doxia/site/src/site/apt/macros/index.apt Tue Jan  1 10:01:18 2008
@@ -73,7 +73,7 @@
 </macro>
 -----
 
- If you need to include only a part of a file, you could add a start and end snippets.
+ If you need to include only a part of a file, you could add start and end snippets.
 
   * Start and end snippets in a Java file
 
@@ -116,6 +116,10 @@
 | url       | The path of the URL to include.
 *-----------+--------------+
 | file      | The path of the file to include.
+*-----------+--------------+
+| verbatim  | If the content should be output as verbatim escaped text. If this is set to
<<<false>>> then the content
+|           | of the snippet will not be escaped. This means that you can use it like Server-Side
Includes on a
+|           | webserver. Default value is <<<true>>>.
 *-----------+--------------+
 
 *TOC Macro



Mime
View raw message