[richfaces-svn-commits] JBoss Rich Faces SVN: r12159 - in trunk/ui/editor/src: test/java/org/richfaces/seamparser and 1 other directory.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Thu Jan 8 12:25:42 EST 2009
Author: abelevich
Date: 2009-01-08 12:25:41 -0500 (Thu, 08 Jan 2009)
New Revision: 12159
Modified:
trunk/ui/editor/src/main/antlr/html-seamtext.g
trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5589
Modified: trunk/ui/editor/src/main/antlr/html-seamtext.g
===================================================================
--- trunk/ui/editor/src/main/antlr/html-seamtext.g 2009-01-08 16:35:47 UTC (rev 12158)
+++ trunk/ui/editor/src/main/antlr/html-seamtext.g 2009-01-08 17:25:41 UTC (rev 12159)
@@ -522,17 +522,19 @@
{
beginCapture();
+ Token token = htmlElementStack.peek();
}
+
(
seamCharacters|plain|htmlSpecialChars
{
- Token token = htmlElementStack.peek();
if(isLink(token)) {
String message = "Unexpected token " + "<" + token.getText() + ">";
throw new SemanticException(message);
}
+
}
)
@@ -542,7 +544,11 @@
if(valueCollector == null) {
valueCollector = new StringBuilder();
}
- valueCollector.append(plain);
+ if(!isList(token)) {
+
+ valueCollector.append(plain);
+ }
+
}
|html
{
@@ -577,10 +583,9 @@
}if(isList(name)) {
append(BLANK_LINE);
} else if (isListItem(name)) {
- append(createSeamTextList(name, htmlElementStack));
+ append(createSeamTextList(name, htmlElementStack));
} else if (isHeader(name)) {
append(createSeamTextHeader(name));
-
}else if(isParagraph(name) && !isHeaderProcessed) {
if(!isHeaderProcessed) {
append(BLANK_LINE);
@@ -596,21 +601,15 @@
}
} else {
-
+
if(valueCollector != null) {
- Token prevToken = htmlElementStack.peek();
- if(isListItem(prevToken) && valueCollector.toString().trim().length() == 0) {
- append(" ");
- } else {
- append(valueCollector.toString().trim());
- }
-
- valueCollector = null;
+ append(valueCollector.toString());
+ valueCollector = null;
}
append("<");
append(name.getText());
}
-
+
htmlElementStack.push(name);
}
@@ -631,7 +630,12 @@
Token name = htmlElementStack.pop();
if((isPlainHtmlRequired(name,htmlElementStack))) {
append(">");
- }
+ } else {
+ Token token = LT(1);
+ if((isListItem(name) || isHeader(name)) && (token.getType() != SPACE)) {
+ append(" ");
+ }
+ }
htmlElementStack.push(name);
}
;
@@ -671,7 +675,7 @@
} else {
- append(value.trim());
+ append(value);
}
if(isList(name)) {
Modified: trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java
===================================================================
--- trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java 2009-01-08 16:35:47 UTC (rev 12158)
+++ trunk/ui/editor/src/test/java/org/richfaces/seamparser/HtmlSeamParserTest.java 2009-01-08 17:25:41 UTC (rev 12159)
@@ -40,17 +40,17 @@
private final static String SEAM_TEXT_EXPRESSION_1 = "It's easy to make *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_.";
- private final static String SEAM_TEXT_EXPRESSION_2 = "+This is a big heading\n"
+ private final static String SEAM_TEXT_EXPRESSION_2 = "+ This is a big heading\n"
+ "You /must/ have some text following a heading!\n\n"
- + "++This is a smaller heading\n"
+ + "++ This is a smaller heading\n"
+ "This is the first paragraph. We can split it across multiple"
+ "lines, but we must end it with a blank line.\n\n"
+ "This is the second paragraph.";
private final static String SEAM_TEXT_EXPRESSION_3 = "An ordered list:\n\n"
- + "#first item\n" + "#second item\n"
- + "#and even the /third/ item\n\n" + "An unordered list:\n\n"
- + "=an item\n" + "=another item";
+ + "# first item\n" + "# second item\n"
+ + "# and even the /third/ item\n\n" + "An unordered list:\n\n"
+ + "= an item\n" + "= another item";
private final static String SEAM_TEXT_EXPRESSION_4 = "The other guy said: "+ "\"Nyeah nyeah-nee\"";
@@ -63,15 +63,15 @@
+ "doSomething() " +
"}`" + " Any ideas?";
- private final static String SEAM_TEXT_EXPRESSION_7 = "+test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
+ private final static String SEAM_TEXT_EXPRESSION_7 = "+ test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
- private final static String SEAM_TEXT_EXPRESSION_8 = "++test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
+ private final static String SEAM_TEXT_EXPRESSION_8 = "++ test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
- private final static String SEAM_TEXT_EXPRESSION_9 = "+++test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
+ private final static String SEAM_TEXT_EXPRESSION_9 = "+++ test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
- private final static String SEAM_TEXT_EXPRESSION_10 = "++++test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
+ private final static String SEAM_TEXT_EXPRESSION_10 = "++++ test value<h1>test1<h2>test2</h2>test4</h1>\ntest";
- private final static String SEAM_TEXT_EXPRESSION_11 = "+test value<div>test5</div><h1>test1<div>test2</div>test4</h1>\ntest";
+ private final static String SEAM_TEXT_EXPRESSION_11 = "+ test value<div>test5</div><h1>test1<div>test2</div>test4</h1>\ntest";
private final static String SEAM_TEXT_EXPRESSION_12 = "[test link=>http://test.com]";
@@ -79,45 +79,45 @@
private final static String SEAM_TEXT_EXPRESSION_14 = "This is a |<tag attribute=\"value\"/>| example.";
- private final static String SEAM_TEXT_EXPRESSION_15 = "= <div class=\"testClass1 testClass2\"></div> <h1> test value </h1>";
+ private final static String SEAM_TEXT_EXPRESSION_15 = "= <div class=\"testClass1 testClass2\"></div><h1> test value </h1>";
- private final static String SEAM_TEXT_EXPRESSION_16 = "# <div class=\"testClass1 testClass2\"></div> <h1> test value </h1>";
+ private final static String SEAM_TEXT_EXPRESSION_16 = "# <div class=\"testClass1 testClass2\"></div><h1> test value </h1>";
- private final static String SEAM_TEXT_EXPRESSION_17 = "paragraph\n\n+header\ntext after header\n\nanother paragraph";
+ private final static String SEAM_TEXT_EXPRESSION_17 = "paragraph\n\n+ header\ntext after header\n\nanother paragraph";
- private final static String SEAM_TEXT_EXPRESSION_18 = "paragraph\n\n++header\ntext after header\n\nanother paragraph";
+ private final static String SEAM_TEXT_EXPRESSION_18 = "paragraph\n\n++ header\ntext after header\n\nanother paragraph";
- private final static String SEAM_TEXT_EXPRESSION_19 = "paragraph\n\n+++header\ntext after header\n\nanother paragraph";
+ private final static String SEAM_TEXT_EXPRESSION_19 = "paragraph\n\n+++ header\ntext after header\n\nanother paragraph";
- private final static String SEAM_TEXT_EXPRESSION_20 = "paragraph\n\n++++header\ntext after header\n\nanother paragraph";
+ private final static String SEAM_TEXT_EXPRESSION_20 = "paragraph\n\n++++ header\ntext after header\n\nanother paragraph";
- private final static String SEAM_TEXT_EXPRESSION_21 = "paragraph\n\n=item1\n=item2\n=item3\n\nanother paragraph";
+ private final static String SEAM_TEXT_EXPRESSION_21 = "paragraph\n\n= item1\n= item2\n= item3\n\nanother paragraph";
- private final static String SEAM_TEXT_EXPRESSION_22 = "paragraph\n\n#item1\n#item2\n#item3\n\nanother paragraph";
+ private final static String SEAM_TEXT_EXPRESSION_22 = "paragraph\n\n# item1\n# item2\n# item3\n\nanother paragraph";
- private final static String SEAM_TEXT_EXPRESSION_23 = "+header text *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_23 = "+ header text *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_\n text after header *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_";
- private final static String SEAM_TEXT_EXPRESSION_24 = "++header text *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_24 = "++ header text *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_\n text after header *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_";
- private final static String SEAM_TEXT_EXPRESSION_25 = "+++header text *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_25 = "+++ header text *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_\n text after header *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_";
- private final static String SEAM_TEXT_EXPRESSION_26 = "++++header text *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_26 = "++++ header text *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_\n text after header *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_";
- private final static String SEAM_TEXT_EXPRESSION_27 = "=item1 *emphasis*, |monospace|, "
- + "~deleted text~, super^scripts^ or_underlines_\n=item2 *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_27 = "= item1 *emphasis*, |monospace|, "
+ + "~deleted text~, super^scripts^ or_underlines_\n= item2 *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_";
- private final static String SEAM_TEXT_EXPRESSION_28 = "#item1 *emphasis*, |monospace|, "
- + "~deleted text~, super^scripts^ or_underlines_\n#item2 *emphasis*, |monospace|, "
+ private final static String SEAM_TEXT_EXPRESSION_28 = "# item1 *emphasis*, |monospace|, "
+ + "~deleted text~, super^scripts^ or_underlines_\n# item2 *emphasis*, |monospace|, "
+ "~deleted text~, super^scripts^ or_underlines_";
private final static String SEAM_TEXT_EXPRESSION_29 = "A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9";
More information about the richfaces-svn-commits
mailing list