version-fix.js 899 B

1234567891011121314151617181920212223242526272829303132
  1. // https://gitlab.com/antora/antora/-/issues/132#note_712132072
  2. 'use strict'
  3. module.exports.register = (pipeline, { config }) => {
  4. pipeline.on('contentAggregated', ({ contentAggregate }) => {
  5. console.log("version-fix.js")
  6. contentAggregate.forEach(aggregate => {
  7. if (aggregate.name === "" && aggregate.displayVersion === 5.6) {
  8. aggregate.name = "ROOT";
  9. aggregate.version = "5.6.0-RC1"
  10. aggregate.startPage = "ROOT:index.adoc"
  11. aggregate.displayVersion = `${aggregate.version}`
  12. delete aggregate.prerelease
  13. }
  14. out(aggregate);
  15. })
  16. })
  17. }
  18. function out(args) {
  19. console.log(JSON.stringify(args, no_data, 2));
  20. }
  21. function no_data(key, value) {
  22. if (key == "data" || key == "files") {
  23. return value ? "__data__" : value;
  24. }
  25. return value;
  26. }