Manage a prefix for the TagsData processAttributes.
This commit is contained in:
parent
d0606fe62e
commit
cbfbfc71d5
6 changed files with 26 additions and 4 deletions
Binary file not shown.
Binary file not shown.
BIN
dist/test.jar
vendored
BIN
dist/test.jar
vendored
Binary file not shown.
BIN
dist/xid.jar
vendored
BIN
dist/xid.jar
vendored
Binary file not shown.
|
@ -495,7 +495,7 @@ public class Presenter
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build attributes.
|
// Build attributes.
|
||||||
result.append (processAttributes (attrs, data));
|
result.append (processAttributes (attrs, data, Integer.toString (nLine)));
|
||||||
|
|
||||||
if ((node.getChildNodes () == null) &&
|
if ((node.getChildNodes () == null) &&
|
||||||
((data == null) || data.display ().equals ("")))
|
((data == null) || data.display ().equals ("")))
|
||||||
|
@ -1039,6 +1039,20 @@ public class Presenter
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
result = processAttributes (attrs, model, "");
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static protected StringBuffer processAttributes (NamedNodeMap attrs, TagData model, String prefix)
|
||||||
|
{
|
||||||
|
StringBuffer result;
|
||||||
|
|
||||||
result = new StringBuffer ();
|
result = new StringBuffer ();
|
||||||
|
|
||||||
// Build the original attributes list.
|
// Build the original attributes list.
|
||||||
|
@ -1089,8 +1103,16 @@ public class Presenter
|
||||||
while (iterator.hasNext ())
|
while (iterator.hasNext ())
|
||||||
{
|
{
|
||||||
Map.Entry<String, String> attribute = (Map.Entry<String, String>) iterator.next();
|
Map.Entry<String, String> attribute = (Map.Entry<String, String>) iterator.next();
|
||||||
|
|
||||||
|
if (attribute.getKey ().equals ("id"))
|
||||||
|
{
|
||||||
|
result.append(" " + attribute.getKey () + "=\"" + attribute.getValue () + '_' + prefix + "\"");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
result.append(" " + attribute.getKey () + "=\"" + attribute.getValue ()+ "\"");
|
result.append(" " + attribute.getKey () + "=\"" + attribute.getValue ()+ "\"");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
|
|
@ -235,7 +235,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<ul>\n<li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
System.out.println ("datas = new TagsDataId ();");
|
System.out.println ("datas = new TagsDataId ();");
|
||||||
|
@ -247,7 +247,7 @@ class Test
|
||||||
System.out.println ("datas.setContent (\"words\", 5, \"fox\");");
|
System.out.println ("datas.setContent (\"words\", 5, \"fox\");");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
System.out.println ("<ul>");
|
System.out.println ("<ul>");
|
||||||
System.out.println ("<li id='words'>a word</li>");
|
System.out.println (" <li id='words'>a word</li>");
|
||||||
System.out.println ("</ul>");
|
System.out.println ("</ul>");
|
||||||
System.out.println ("=>");
|
System.out.println ("=>");
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
|
Loading…
Reference in a new issue