Skip to content

Commit

Permalink
Allow a component to be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
recrwplay committed Feb 19, 2025
1 parent e3d0c66 commit 77d27fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion extensions/asciidoc/antora-add-notes/add-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ module.exports.register = function (registry, { file, contentCatalog }) {
if (!doc.getAttribute('page-add-notes-tags')) return reader
if (doc.getAttribute('page-add-notes-versions') && !doc.getAttribute('page-add-notes-versions').includes(doc.getAttribute('page-version'))) return reader
var notesModule = doc.getAttribute('page-add-notes-module') ? doc.getAttribute('page-add-notes-module') : 'ROOT';
var notesComponent = doc.getAttribute('page-add-notes-component') ? doc.getAttribute('page-add-notes-component') : '';
const notesModuleComponent = notesComponent ? `${notesComponent}:${notesModule}` : notesModule;
var lines = reader.lines
lines.reverse()
var found = false
for (var i = 0; i < lines.length; i++) {
if (lines[i].startsWith("= ")) found = true
if (lines[i].length == 0 && found) {
lines.splice(++i,0, '', 'include::'+notesModule+':partial$/notes.adoc[tags={page-add-notes-tags}]','')
lines.splice(++i,0, '', `include::${notesModuleComponent}:partial$/notes.adoc[tags={page-add-notes-tags}]`,'')
lines.reverse()
return reader
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/asciidoc/antora-add-notes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neo4j-antora/antora-add-notes",
"version": "0.3.1",
"version": "0.3.2",
"description": "Add asciidoc blocks into the top of pages based on page attributes",
"main": "add-notes.js",
"scripts": {
Expand Down

0 comments on commit 77d27fe

Please sign in to comment.