You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by lt...@apache.org on 2008/02/19 17:07:55 UTC
svn commit: r629139 - in /maven/doxia/doxia/trunk:
doxia-core/src/main/java/org/apache/maven/doxia/parser/
doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/
doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/do...
Author: ltheussl
Date: Tue Feb 19 08:07:52 2008
New Revision: 629139
URL: http://svn.apache.org/viewvc?rev=629139&view=rev
Log:
Do not log unknown tags within <pre> and <source>
Modified:
maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java?rev=629139&r1=629138&r2=629139&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java Tue Feb 19 08:07:52 2008
@@ -56,6 +56,9 @@
/** Counts section level. */
private int sectionLevel;
+ /** Verbatim level, increased whenever a <pre> tag is encountered. */
+ private int verbatimLevel;
+
/**
* <p>
* Goes through a common list of possible html start tags. These include only tags that can go into
@@ -137,6 +140,8 @@
*/
else if ( parser.getName().equals( Tag.PRE.toString() ) )
{
+ verbatim();
+
sink.verbatim( false );
}
else if ( parser.getName().equals( Tag.UL.toString() ) )
@@ -394,6 +399,8 @@
}
else if ( parser.getName().equals( Tag.PRE.toString() ) )
{
+ verbatim_();
+
sink.verbatim_();
}
else if ( parser.getName().equals( Tag.UL.toString() ) )
@@ -677,6 +684,33 @@
protected void setSectionLevel( int newLevel )
{
this.sectionLevel = newLevel;
+ }
+
+ /**
+ * Decrease the current verbatim level.
+ */
+ protected void verbatim_()
+ {
+ verbatimLevel--;
+ }
+
+ /**
+ * Increases the current verbatim level.
+ * A value of 0 means that we are not in verbatim mode, every nested <pre> tag increases the level.
+ */
+ protected void verbatim()
+ {
+ verbatimLevel++;
+ }
+
+ /**
+ * Checks if we are currently insid a <pre> tag.
+ *
+ * @return true if we are currently in verbatim mode.
+ */
+ protected boolean isVerbatim()
+ {
+ return ( this.verbatimLevel != 0 );
}
}
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java?rev=629139&r1=629138&r2=629139&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java Tue Feb 19 08:07:52 2008
@@ -48,11 +48,13 @@
}
else if ( parser.getName().equals( SOURCE_TAG.toString() ) )
{
+ verbatim();
+
sink.verbatim( true );
}
else if ( !baseStartTag( parser, sink ) )
{
- if ( getLog().isWarnEnabled() )
+ if ( !isVerbatim() && getLog().isWarnEnabled() )
{
String position = "[" + parser.getLineNumber() + ":"
+ parser.getColumnNumber() + "]";
@@ -69,6 +71,8 @@
{
if ( parser.getName().equals( SOURCE_TAG.toString() ) )
{
+ verbatim_();
+
sink.verbatim_();
}
else if ( !baseEndTag( parser, sink ) )
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java?rev=629139&r1=629138&r2=629139&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java Tue Feb 19 08:07:52 2008
@@ -150,6 +150,8 @@
}
else if ( parser.getName().equals( SOURCE_TAG.toString() ) )
{
+ verbatim();
+
sink.verbatim( true );
}
else if ( parser.getName().equals( PROPERTIES_TAG.toString() ) )
@@ -214,7 +216,8 @@
{
// TODO: remove
handleRawText( sink, parser );
- if ( getLog().isWarnEnabled() )
+
+ if ( !isVerbatim() && getLog().isWarnEnabled() )
{
String position = "[" + parser.getLineNumber() + ":"
+ parser.getColumnNumber() + "]";
@@ -258,6 +261,8 @@
}
else if ( parser.getName().equals( SOURCE_TAG.toString() ) )
{
+ verbatim_();
+
sink.verbatim_();
}
else if ( parser.getName().equals( PROPERTIES_TAG.toString() ) )