This is an automated email from the ASF dual-hosted git repository.
brushed pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git
The following commit(s) were added to refs/heads/master by this push:
new 7453019 [JSPWIKI-1100] Add support for mixed css-class & css-style
markup
7453019 is described below
commit 7453019c2afdb03ebfe2d51c5f117b81b0b314f1
Author: brushed <[email protected]>
AuthorDate: Fri Apr 5 23:23:19 2019 +0200
[JSPWIKI-1100] Add support for mixed css-class & css-style markup
---
ChangeLog | 7 +++++-
.../src/main/java/org/apache/wiki/Release.java | 2 +-
.../apache/wiki/parser/JSPWikiMarkupParser.java | 7 +++++-
.../wiki/parser/JSPWikiMarkupParserTest.java | 27 ++++++++++++++++++++++
4 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f611c7b..7d490cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,17 @@
2019-04-05 Dirk Frederickx (brushed AT apache DOT org)
+ * 2.11.0-M4-git-03
+
+ * [JSPWIKI-1100] Add support for mixed css-class & css-style markup
+
+2019-04-05 Dirk Frederickx (brushed AT apache DOT org)
+
* 2.11.0-M4-git-02
* [JSPWIKI-1101] Improve rendering of {{{inline preformatted text}}}
* Change UI for attachement upload: by default, the FILE SELECTION
input should be visible
-
2019-04-05 Dirk Frederickx (brushed AT apache DOT org)
* 2.11.0-M4-git-01
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/Release.java
b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
index a24f495..7e4d610 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "02";
+ public static final String BUILD = "03";
/**
* This is the generic version string you should use when printing out
the version. It is of
diff --git
a/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
b/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 739649f..e8ab63c 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -2051,7 +2051,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
else if( Character.isLetter( (char) ch ) )
{
pushBack( ch );
- clazz = readUntil( " \t\n\r" );
+ clazz = readUntil( "( \t\n\r" );
//Note: ref.https://www.w3.org/TR/CSS21/syndata.html#characters
//CSS Classnames can contain only the characters [a-zA-Z0-9]
and
//ISO 10646 characters U+00A0 and higher, plus the "-" and the
"_".
@@ -2067,6 +2067,11 @@ public class JSPWikiMarkupParser extends MarkupParser {
}
ch = nextToken();
+ //check for %%class1.class2( style information )
+ if( ch == '(' )
+ {
+ style = readBraceContent('(',')');
+ }
//
// Pop out only spaces, so that the upcoming EOL check does
not check the
// next line.
diff --git
a/jspwiki-main/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
b/jspwiki-main/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
index de744cd..b7c864a 100644
---
a/jspwiki-main/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
+++
b/jspwiki-main/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
@@ -2623,12 +2623,39 @@ public class JSPWikiMarkupParserTest
public void testDivStyle2()
throws Exception
{
+ String src = "%%foo.bar\ntest\n%%\n";
+
+ Assertions.assertEquals( "<div class=\"foo bar\">\ntest\n</div>\n",
translate(src) );
+ }
+
+ @Test
+ public void testDivStyle3()
+ throws Exception
+ {
String src = "%%(foo:bar;)\ntest\n%%\n";
Assertions.assertEquals( "<div style=\"foo:bar;\">\ntest\n</div>\n",
translate(src) );
}
@Test
+ public void testDivStyle4()
+ throws Exception
+ {
+ String src = "%%zoo(foo:bar;)\ntest\n%%\n";
+
+ Assertions.assertEquals( "<div style=\"foo:bar;\"
class=\"zoo\">\ntest\n</div>\n", translate(src) );
+ }
+
+ @Test
+ public void testDivStyle5()
+ throws Exception
+ {
+ String src = "%%zoo1.zoo2(foo:bar;)\ntest\n%%\n";
+
+ Assertions.assertEquals( "<div style=\"foo:bar;\" class=\"zoo1
zoo2\">\ntest\n</div>\n", translate(src) );
+ }
+
+ @Test
public void testSpanStyle1()
throws Exception
{