Improve rendering of config
This commit is contained in:
+1
-6
@@ -80,11 +80,6 @@ abstract class ConfigString extends AbstractConfigValue implements Serializable
|
||||
|
||||
@Override
|
||||
protected void render(StringBuilder sb, int indent, boolean atRoot, ConfigRenderOptions options) {
|
||||
String rendered;
|
||||
if (options.getJson())
|
||||
rendered = ConfigImplUtil.renderJsonString(value);
|
||||
else
|
||||
rendered = ConfigImplUtil.renderStringUnquotedIfPossible(value);
|
||||
sb.append(rendered);
|
||||
sb.append(ConfigImplUtil.renderJsonString(value));
|
||||
}
|
||||
}
|
||||
|
||||
-8
@@ -209,9 +209,7 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
|
||||
sb.append("[");
|
||||
if (options.getFormatted())
|
||||
sb.append('\n');
|
||||
int count = 0;
|
||||
for (AbstractConfigValue v : value) {
|
||||
count++;
|
||||
if (options.getOriginComments()) {
|
||||
String[] lines = v.origin().description().split("\n");
|
||||
for (String l : lines) {
|
||||
@@ -224,12 +222,6 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList,
|
||||
}
|
||||
}
|
||||
if (options.getComments()) {
|
||||
if (count > 1) {
|
||||
sb.append('\n');
|
||||
if (!v.origin().comments().isEmpty()) {
|
||||
sb.append('\n');
|
||||
}
|
||||
}
|
||||
for (String comment : v.origin().comments()) {
|
||||
indent(sb, indent + 1, options);
|
||||
sb.append("# ");
|
||||
|
||||
Reference in New Issue
Block a user