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());
|
||||
|
||||
// Build attributes.
|
||||
result.append (processAttributes (attrs, data));
|
||||
result.append (processAttributes (attrs, data, Integer.toString (nLine)));
|
||||
|
||||
if ((node.getChildNodes () == null) &&
|
||||
((data == null) || data.display ().equals ("")))
|
||||
|
@ -1039,6 +1039,20 @@ public class Presenter
|
|||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = processAttributes (attrs, model, "");
|
||||
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static protected StringBuffer processAttributes (NamedNodeMap attrs, TagData model, String prefix)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = new StringBuffer ();
|
||||
|
||||
// Build the original attributes list.
|
||||
|
@ -1089,8 +1103,16 @@ public class Presenter
|
|||
while (iterator.hasNext ())
|
||||
{
|
||||
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 ()+ "\"");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
|
|
@ -235,7 +235,7 @@ class Test
|
|||
|
||||
|
||||
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 ("datas = new TagsDataId ();");
|
||||
|
@ -247,7 +247,7 @@ class Test
|
|||
System.out.println ("datas.setContent (\"words\", 5, \"fox\");");
|
||||
System.out.println ("+");
|
||||
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 ("=>");
|
||||
System.out.println (html);
|
||||
|
|
Loading…
Reference in a new issue