On Feb 9, 2011, at 9:52 AM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2011-02-09 09:52:25 +0100 (Wed, 09 Feb 2011)
New Revision: 34573
Modified:
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/listener/InlineFilterListener.java
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-doxia/src/main/java/org/xwiki/rendering/internal/parser/doxia/XWikiGeneratorSink.java
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/DefaultXWikiGeneratorListener.java
Log:
XWIKI-5927: Content lost when using the streaming parser and renderer APIs to convert
from HTML to wiki syntax
Backport properly modification incompatible with 2.7 branch
Modified:
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/listener/InlineFilterListener.java
===================================================================
---
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/listener/InlineFilterListener.java 2011-02-09
08:12:53 UTC (rev 34572)
+++
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/listener/InlineFilterListener.java 2011-02-09
08:52:25 UTC (rev 34573)
@@ -21,9 +21,9 @@
import java.util.Map;
-
/**
* Wrap a listener and skip begin/endDocument events.
+ *
* @version $Id$
* @since 3.0M3
I always find it strange to see a since for a future version number in a previous branch.
We need to decide if the since is done based on the version ordering (3.0.x > 2.7.x) or
based on when the release is done (time-based), in which case 3.0M3 might be released
before 2.7.1 (although that's not sure).
IMO we should based it on the version ordering and do for this use case at hand:
* Use @since 2.7.1 in the 2.7 branch
* Use @since 3.0M2 in trunk
WDYT?
Thanks
-Vincent
*/
@@ -32,10 +32,10 @@
/**
* {@inheritDoc}
*
- * @see
org.xwiki.rendering.listener.WrappingListener#beginDocument(org.xwiki.rendering.listener.MetaData)
+ * @see org.xwiki.rendering.listener.WrappingListener#beginDocument(java.util.Map)
*/
@Override
- public void beginDocument(MetaData metaData)
+ public void beginDocument(Map<String, String> parameters)
{
// Disable this event
}
@@ -43,32 +43,52 @@
/**
* {@inheritDoc}
*
- * @see
org.xwiki.rendering.listener.WrappingListener#endDocument(org.xwiki.rendering.listener.MetaData)
+ * @see org.xwiki.rendering.listener.WrappingListener#endDocument(java.util.Map)
*/
@Override
- public void endDocument(MetaData metaData)
+ public void endDocument(Map<String, String> parameters)
{
// Disable this event
}
-
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.xwiki.rendering.listener.WrappingListener#beginSection(java.util.Map)
+ */
@Override
public void beginSection(Map<String, String> parameters)
{
// Filter
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.xwiki.rendering.listener.WrappingListener#endSection(java.util.Map)
+ */
@Override
public void endSection(Map<String, String> parameters)
{
// Filter
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.xwiki.rendering.listener.WrappingListener#beginParagraph(java.util.Map)
+ */
@Override
public void beginParagraph(Map<String, String> parameters)
{
// Filter
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.xwiki.rendering.listener.WrappingListener#endParagraph(java.util.Map)
+ */
@Override
public void endParagraph(Map<String, String> parameters)
{
Modified:
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-doxia/src/main/java/org/xwiki/rendering/internal/parser/doxia/XWikiGeneratorSink.java
===================================================================
---
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-doxia/src/main/java/org/xwiki/rendering/internal/parser/doxia/XWikiGeneratorSink.java 2011-02-09
08:12:53 UTC (rev 34572)
+++
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-doxia/src/main/java/org/xwiki/rendering/internal/parser/doxia/XWikiGeneratorSink.java 2011-02-09
08:52:25 UTC (rev 34573)
@@ -20,6 +20,7 @@
package org.xwiki.rendering.internal.parser.doxia;
import java.io.StringReader;
+import java.util.Collections;
import java.util.Map;
import java.util.Stack;
@@ -29,15 +30,14 @@
import org.xwiki.rendering.listener.CompositeListener;
import org.xwiki.rendering.listener.Format;
import org.xwiki.rendering.listener.HeaderLevel;
-import org.xwiki.rendering.listener.MetaData;
-import org.xwiki.rendering.listener.reference.ResourceReference;
import org.xwiki.rendering.listener.ListType;
import org.xwiki.rendering.listener.Listener;
import org.xwiki.rendering.listener.QueueListener;
+import org.xwiki.rendering.listener.WrappingListener;
+import org.xwiki.rendering.listener.reference.ResourceReference;
import org.xwiki.rendering.listener.reference.ResourceType;
-import org.xwiki.rendering.listener.WrappingListener;
+import org.xwiki.rendering.parser.ParseException;
import org.xwiki.rendering.parser.ResourceReferenceParser;
-import org.xwiki.rendering.parser.ParseException;
import org.xwiki.rendering.parser.StreamParser;
import org.xwiki.rendering.renderer.PrintRenderer;
import org.xwiki.rendering.renderer.PrintRendererFactory;
@@ -209,7 +209,7 @@
*/
public void body(SinkEventAttributes attributes)
{
- getListener().beginDocument(MetaData.EMPTY);
+ getListener().beginDocument(Collections.<String, String> emptyMap());
}
/**
@@ -219,7 +219,7 @@
*/
public void body()
{
- getListener().beginDocument(MetaData.EMPTY);
+ getListener().beginDocument(Collections.<String, String> emptyMap());
}
/**
@@ -229,7 +229,7 @@
*/
public void body_()
{
- getListener().endDocument(MetaData.EMPTY);
+ getListener().endDocument(Collections.<String, String> emptyMap());
}
/**
Modified:
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/DefaultXWikiGeneratorListener.java
===================================================================
---
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/DefaultXWikiGeneratorListener.java 2011-02-09
08:12:53 UTC (rev 34572)
+++
platform/core/branches/xwiki-core-2.7/xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-wikimodel/src/main/java/org/xwiki/rendering/internal/parser/wikimodel/DefaultXWikiGeneratorListener.java 2011-02-09
08:52:25 UTC (rev 34573)
@@ -38,13 +38,12 @@
import org.xwiki.rendering.listener.CompositeListener;
import org.xwiki.rendering.listener.Format;
import org.xwiki.rendering.listener.HeaderLevel;
-import org.xwiki.rendering.listener.MetaData;
-import org.xwiki.rendering.listener.reference.ResourceReference;
import org.xwiki.rendering.listener.ListType;
import org.xwiki.rendering.listener.Listener;
import org.xwiki.rendering.listener.QueueListener;
-import org.xwiki.rendering.parser.ResourceReferenceParser;
+import org.xwiki.rendering.listener.reference.ResourceReference;
import org.xwiki.rendering.parser.ParseException;
+import org.xwiki.rendering.parser.ResourceReferenceParser;
import org.xwiki.rendering.parser.StreamParser;
import org.xwiki.rendering.renderer.PrintRenderer;
import org.xwiki.rendering.renderer.PrintRendererFactory;
@@ -333,7 +332,7 @@
if (this.documentDepth > 0) {
getListener().beginGroup(convertParameters(params));
} else {
- getListener().beginDocument(MetaData.EMPTY);
+ getListener().beginDocument(convertParameters(params));
}
++this.documentDepth;
@@ -592,7 +591,7 @@
if (this.documentDepth > 0) {
getListener().endGroup(convertParameters(params));
} else {
- getListener().endDocument(MetaData.EMPTY);
+ getListener().endDocument(convertParameters(params));
}
}
@@ -934,8 +933,7 @@
onReference(reference.getLink(), reference.getLabel(), false,
convertParameters(reference.getParameters()));
}
- protected void onReference(String reference, String label, boolean
isFreeStandingURI,
- Map<String, String> parameters)
+ protected void onReference(String reference, String label, boolean
isFreeStandingURI, Map<String, String> parameters)
{
flushFormat();