On Fri, Mar 13, 2009 at 16:50, SVN jvelociter
<platform-notifications(a)xwiki.org> wrote:
Author: jvelociter
Date: 2009-03-13 16:50:43 +0100 (Fri, 13 Mar 2009)
New Revision: 17618
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/transformation/MacroTransformation.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro7.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro8.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro9.test
Log:
XWIKI-3352 Wrap rendering error descriptions in a <pre> tag
Merged from branch 1.8
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/transformation/MacroTransformation.java
===================================================================
---
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/transformation/MacroTransformation.java
2009-03-13 15:43:26 UTC (rev 17617)
+++
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/transformation/MacroTransformation.java
2009-03-13 15:50:43 UTC (rev 17618)
@@ -226,15 +226,17 @@
Map<String, String> errorDescriptionBlockParams =
Collections.singletonMap("class",
"xwikirenderingerrordescription hidden");
+ Block descriptionBlock = new XMLBlock(Arrays.asList((Block) new
WordBlock(description)), new XMLElement("pre", Collections.EMPTY_MAP));
You should use VerbatimBlock instead, it's its job.
+
if (macroToReplace.isInline()) {
errorBlocks.add(new XMLBlock(Arrays.asList((Block) new WordBlock(message)),
new XMLElement("span",
errorBlockParams)));
- errorBlocks.add(new XMLBlock(Arrays.asList((Block) new
WordBlock(description)), new XMLElement("span",
+ errorBlocks.add(new XMLBlock(Arrays.asList((Block) descriptionBlock), new
XMLElement("span",
errorDescriptionBlockParams)));
} else {
errorBlocks.add(new XMLBlock(Arrays.asList((Block) new WordBlock(message)),
new XMLElement("div",
errorBlockParams)));
- errorBlocks.add(new XMLBlock(Arrays.asList((Block) new
WordBlock(description)), new XMLElement("div",
+ errorBlocks.add(new XMLBlock(Arrays.asList((Block) descriptionBlock), new
XMLElement("div",
errorDescriptionBlockParams)));
}
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro7.test
===================================================================
---
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro7.test
2009-03-13 15:43:26 UTC (rev 17617)
+++
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro7.test
2009-03-13 15:50:43 UTC (rev 17618)
@@ -16,7 +16,9 @@
onWord [Unknown macro: unknown]
endXMLNode [span] [class=xwikirenderingerror]
beginXMLNode [span] [class=xwikirenderingerrordescription hidden]
+beginXMLNode [pre]
onWord [The "unknown" macro is not in the list of registered macros. Verify
the spelling or contact your administrator.]
+endXMLNode [pre]
endXMLNode [span] [class=xwikirenderingerrordescription hidden]
endMacroMarkerInline [unknown] [] []
onSpace
@@ -26,7 +28,7 @@
.#-----------------------------------------------------
.expect|xhtml/1.0
.#-----------------------------------------------------
-<p>Unknown <!--startmacro:unknown|-||-|--><span
class="xwikirenderingerror">Unknown macro: unknown</span><span
class="xwikirenderingerrordescription hidden">The "unknown" macro
is not in the list of registered macros. Verify the spelling or contact your
administrator.</span><!--stopmacro--> macro</p>
+<p>Unknown <!--startmacro:unknown|-||-|--><span
class="xwikirenderingerror">Unknown macro: unknown</span><span
class="xwikirenderingerrordescription hidden"><pre>The
"unknown" macro is not in the list of registered macros. Verify the spelling or
contact your administrator.</pre></span><!--stopmacro-->
macro</p>
.#-----------------------------------------------------
.expect|xwiki/2.0
.#-----------------------------------------------------
@@ -34,4 +36,4 @@
.#-----------------------------------------------------
.input|xhtml/1.0
.#-----------------------------------------------------
-<html><p>Unknown <!--startmacro:unknown|-||-|--><span
class="xwikirenderingerror">Unknown macro: unknown</span><span
class="xwikirenderingerrordescription hidden">The "unknown" macro
is not in the list of registered macros. Verify the spelling or contact your
administrator.</span><!--stopmacro--> macro</p></html>
\ No newline at end of file
+<html><p>Unknown <!--startmacro:unknown|-||-|--><span
class="xwikirenderingerror">Unknown macro: unknown</span><span
class="xwikirenderingerrordescription hidden"><pre>The
"unknown" macro is not in the list of registered macros. Verify the spelling or
contact your administrator.</pre></span><!--stopmacro-->
macro</p></html>
\ No newline at end of file
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro8.test
===================================================================
---
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro8.test
2009-03-13 15:43:26 UTC (rev 17617)
+++
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro8.test
2009-03-13 15:50:43 UTC (rev 17618)
@@ -17,7 +17,9 @@
onWord [Not an inline macro]
endXMLNode [span] [class=xwikirenderingerror]
beginXMLNode [span] [class=xwikirenderingerrordescription hidden]
+beginXMLNode [pre]
onWord [This macro can only be used by itself on a new line]
+endXMLNode [pre]
endXMLNode [span] [class=xwikirenderingerrordescription hidden]
endMacroMarkerInline [testsimplemacro] [] []
onSpace
@@ -27,7 +29,7 @@
.#-----------------------------------------------------
.expect|xhtml/1.0
.#-----------------------------------------------------
-<p>Not inline <!--startmacro:testsimplemacro|-||-|--><span
class="xwikirenderingerror">Not an inline macro</span><span
class="xwikirenderingerrordescription hidden">This macro can only be used by
itself on a new line</span><!--stopmacro--> macro</p>
+<p>Not inline <!--startmacro:testsimplemacro|-||-|--><span
class="xwikirenderingerror">Not an inline macro</span><span
class="xwikirenderingerrordescription hidden"><pre>This macro can only
be used by itself on a new line</pre></span><!--stopmacro-->
macro</p>
.#-----------------------------------------------------
.expect|xwiki/2.0
.#-----------------------------------------------------
@@ -35,4 +37,4 @@
.#-----------------------------------------------------
.input|xhtml/1.0
.#-----------------------------------------------------
-<html><p>Not inline <!--startmacro:testsimplemacro|-||-|--><span
class="xwikirenderingerror">Not an inline macro</span><span
class="xwikirenderingerrordescription hidden">This macro can only be used by
itself on a new line</span><!--stopmacro--> macro</p></html>
\ No newline at end of file
+<html><p>Not inline <!--startmacro:testsimplemacro|-||-|--><span
class="xwikirenderingerror">Not an inline macro</span><span
class="xwikirenderingerrordescription hidden"><pre>This macro can only
be used by itself on a new line</pre></span><!--stopmacro-->
macro</p></html>
\ No newline at end of file
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro9.test
===================================================================
---
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro9.test
2009-03-13 15:43:26 UTC (rev 17617)
+++
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro9.test
2009-03-13 15:50:43 UTC (rev 17618)
@@ -15,7 +15,9 @@
onWord [Failed to execute macro: testfailingmacro]
endXMLNode [span] [class=xwikirenderingerror]
beginXMLNode [span] [class=xwikirenderingerrordescription hidden]
+beginXMLNode [pre]
onWord [stack trace here]
+endXMLNode [pre]
endXMLNode [span] [class=xwikirenderingerrordescription hidden]
endMacroMarkerInline [testfailingmacro] [] []
onSpace
@@ -25,7 +27,7 @@
.#-----------------------------------------------------
.expect|xhtml/1.0
.#-----------------------------------------------------
-<p>Execution <!--startmacro:testfailingmacro|-||-|--><span
class="xwikirenderingerror">Failed to execute macro:
testfailingmacro</span><span class="xwikirenderingerrordescription
hidden">stack trace here</span><!--stopmacro--> error</p>
+<p>Execution <!--startmacro:testfailingmacro|-||-|--><span
class="xwikirenderingerror">Failed to execute macro:
testfailingmacro</span><span class="xwikirenderingerrordescription
hidden"><pre>stack trace here</pre></span><!--stopmacro-->
error</p>
.#-----------------------------------------------------
.expect|xwiki/2.0
.#-----------------------------------------------------
@@ -33,4 +35,4 @@
.#-----------------------------------------------------
.input|xhtml/1.0
.#-----------------------------------------------------
-<html><p>Execution <!--startmacro:testfailingmacro|-||-|--><span
class="xwikirenderingerror">Failed to execute macro:
testfailingmacro</span><span class="xwikirenderingerrordescription
hidden">stack trace here</span><!--stopmacro-->
error</p></html>
\ No newline at end of file
+<html><p>Execution <!--startmacro:testfailingmacro|-||-|--><span
class="xwikirenderingerror">Failed to execute macro:
testfailingmacro</span><span class="xwikirenderingerrordescription
hidden"><pre>stack trace here</pre></span><!--stopmacro-->
error</p></html>
\ No newline at end of file
_______________________________________________
notifications mailing list
notifications(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications
--
Thomas Mortagne