Allow generate closed start tags and do not reorder specific tags
This commit is contained in:
@@ -68,11 +68,12 @@ public class TagsTestDataUtil {
|
|||||||
String tagText;
|
String tagText;
|
||||||
if (point.isStart) {
|
if (point.isStart) {
|
||||||
String attributesString = point.getAttributesString();
|
String attributesString = point.getAttributesString();
|
||||||
|
String closeSuffix = point.isClosed ? "/" : "";
|
||||||
if (attributesString.isEmpty()) {
|
if (attributesString.isEmpty()) {
|
||||||
tagText = String.format("<%s>", point.getName());
|
tagText = String.format("<%s%s>", point.getName(), closeSuffix);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tagText = String.format("<%s %s>", point.getName(), attributesString);
|
tagText = String.format("<%s %s%s>", point.getName(), attributesString, closeSuffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -88,11 +89,23 @@ public class TagsTestDataUtil {
|
|||||||
public static class TagInfo<Data> implements Comparable<TagInfo<?>> {
|
public static class TagInfo<Data> implements Comparable<TagInfo<?>> {
|
||||||
protected final int offset;
|
protected final int offset;
|
||||||
protected final boolean isStart;
|
protected final boolean isStart;
|
||||||
|
protected final boolean isClosed;
|
||||||
|
protected final boolean isFixed;
|
||||||
protected final Data data;
|
protected final Data data;
|
||||||
|
|
||||||
public TagInfo(int offset, boolean start, Data data) {
|
public TagInfo(int offset, boolean start, Data data) {
|
||||||
|
this(offset, start, false, false, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TagInfo(int offset, boolean isStart, boolean isClosed, boolean isFixed, Data data) {
|
||||||
|
if (isClosed && !isStart) {
|
||||||
|
throw new IllegalArgumentException("isClosed should be true only for start tags");
|
||||||
|
}
|
||||||
|
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
isStart = start;
|
this.isStart = isStart;
|
||||||
|
this.isClosed = isClosed;
|
||||||
|
this.isFixed = isFixed;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +120,10 @@ public class TagsTestDataUtil {
|
|||||||
return isStart ? -1 : 1;
|
return isStart ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFixed || other.isFixed) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
String thisTag = this.getName();
|
String thisTag = this.getName();
|
||||||
String otherTag = other.getName();
|
String otherTag = other.getName();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user