Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serializationFormat:xml should write XMLs which follow the formatting rules of FileVault #45

Open
kwin opened this issue May 27, 2022 · 1 comment

Comments

@kwin
Copy link

kwin commented May 27, 2022

The DocView XMLs written should comply with the rules from FileVault (compare with https://jackrabbit.apache.org/filevault-package-maven-plugin/format-xml-mojo.html).

The rules are:

  • Indent by 4 spaces
  • all attributes on a new line (does not apply to namespace declarations)
  • attributes sorted alphabetically
@kwin
Copy link
Author

kwin commented May 30, 2022

All rules except for the last one are already followed in version 1.8.0, but the attributes are not yet sorted alphabetically in

if (item.hasOwnProperty('categories')) {
var fieldValue = item.categories.join(',');
content += '\n categories="[' + fieldValue + ']"';
} else {
content += '\n categories="[' + item.name + ']" ';
}
clientLibDirectoryFields.forEach(function (fieldKey) {
if (item.hasOwnProperty(fieldKey)) {
if (typeof item[fieldKey] === 'boolean') {
// Boolean value
content += '\n ' + fieldKey + '="{Boolean}' + item[fieldKey] + '"';
} else if (Array.isArray(item[fieldKey])) {
// Array of strings
var fieldValue = item[fieldKey].join(',');
content += '\n ' + fieldKey + '="[' + fieldValue + ']"';
} else if (typeof item[fieldKey] === 'string') {
// String value
content += '\n ' + fieldKey + '="' + item[fieldKey] + '"';
}
}
});
.

In addition the namespace declaration of cq is superfluous as no JCR property for client libraries use that namespace.

@kwin kwin changed the title serializationFormat:xml should write XMLs which follow the indentation rules of FileVault serializationFormat:xml should write XMLs which follow the formatting rules of FileVault May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant