Apply customizations to config lib
This commit is contained in:
+8
@@ -209,7 +209,9 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
|
|||||||
sb.append("[");
|
sb.append("[");
|
||||||
if (options.getFormatted())
|
if (options.getFormatted())
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
|
int count = 0;
|
||||||
for (AbstractConfigValue v : value) {
|
for (AbstractConfigValue v : value) {
|
||||||
|
count++;
|
||||||
if (options.getOriginComments()) {
|
if (options.getOriginComments()) {
|
||||||
String[] lines = v.origin().description().split("\n");
|
String[] lines = v.origin().description().split("\n");
|
||||||
for (String l : lines) {
|
for (String l : lines) {
|
||||||
@@ -222,6 +224,12 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.getComments()) {
|
if (options.getComments()) {
|
||||||
|
if (count > 1) {
|
||||||
|
sb.append('\n');
|
||||||
|
if (!v.origin().comments().isEmpty()) {
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
for (String comment : v.origin().comments()) {
|
for (String comment : v.origin().comments()) {
|
||||||
indent(sb, indent + 1, options);
|
indent(sb, indent + 1, options);
|
||||||
sb.append("# ");
|
sb.append("# ");
|
||||||
|
|||||||
+8
@@ -481,7 +481,9 @@ final class SimpleConfigObject extends AbstractConfigObject implements Serializa
|
|||||||
int separatorCount = 0;
|
int separatorCount = 0;
|
||||||
String[] keys = keySet().toArray(new String[size()]);
|
String[] keys = keySet().toArray(new String[size()]);
|
||||||
Arrays.sort(keys, new RenderComparator());
|
Arrays.sort(keys, new RenderComparator());
|
||||||
|
int count = 0;
|
||||||
for (String k : keys) {
|
for (String k : keys) {
|
||||||
|
count++;
|
||||||
AbstractConfigValue v;
|
AbstractConfigValue v;
|
||||||
v = value.get(k);
|
v = value.get(k);
|
||||||
|
|
||||||
@@ -497,6 +499,12 @@ final class SimpleConfigObject extends AbstractConfigObject implements Serializa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.getComments()) {
|
if (options.getComments()) {
|
||||||
|
if (count > 1) {
|
||||||
|
sb.append('\n');
|
||||||
|
if (!v.origin().comments().isEmpty()) {
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
for (String comment : v.origin().comments()) {
|
for (String comment : v.origin().comments()) {
|
||||||
indent(sb, innerIndent, options);
|
indent(sb, innerIndent, options);
|
||||||
sb.append("#");
|
sb.append("#");
|
||||||
|
|||||||
Reference in New Issue
Block a user