Repository navigation
[#1275] Fix Release Notes and Getting Started page titles - #1276
Conversation
maximthomas
left a comment
There was a problem hiding this comment.
praise: The fix sits where Antora reads the title, and the new IT checks it the same way Antora does.
generatedPageHasDocumentTitleparses withparseHeaderOnly(true), so Asciidoctor's section-title fallback cannot hide a missing document header.ifndef::env-site[]keeps the chapter IDs on the==headings for the books, andanchor:<id>[]gives the site the same fragment. A local Antora 3.1.15 build with the site's ui-bundle showed each of the four IDs exactly once per page and no subsection ID changed.failIfNoTestson thetest-antora-page-titlesexecution, so a lost include fails the build instead of skipping the check.
suggestion (non-blocking): AntoraPageTitlesIT pins only the four chapter IDs, so losing a published subsection fragment stays green.
opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java:56-64, :79-80
The only body assertion checks the chapter ID. In requirements-and-upgrade.adoc, deleting the blank line after the anchor's endif::[] makes === Java and Installation Environment join the anchor paragraph. Turning anchor:release-requirements[] into [#release-requirements] moves the ID onto that section instead. Either way the published _java_and_installation_environment fragment disappears, and the IT stays green: 6/6 on the blank-line mutant, edited into the generated page and rerun with the CHECKS.md command. The 16 fragment IDs in the PR's validation were checked by hand.
@DataProvider
public Object[][] pages() {
return new Object[][] {
{ "release-notes", "release-5.2.0", "OpenDJ 5.2.0",
new String[] { "release-5-2-0", "_selected_changes", "_distributions" } },
{ "release-notes", "requirements-and-upgrade", "Requirements and Upgrade Considerations",
new String[] { "release-requirements", "_java_and_installation_environment", "_plan_an_upgrade",
"_compatibility_checks", "_known_issues_and_help" } },
{ "getting-started", "overview", "Directory Concepts", new String[] { "getting-started-overview" } },
{ "getting-started", "first-steps", "Your First Directory",
new String[] { "getting-started-first-directory", "_prepare_the_environment",
"_set_up_and_start_the_server", "_add_a_person", "_search_and_change_the_entry",
"_restart_and_remove_the_sample_data", "_next_steps" } }
};
}
@Test(dataProvider = "pages")
public void generatedPageHasDocumentTitle(String guide, String page, String title, String[] fragments) {
final File input = new File(buildDirectory, "antora/modules/" + guide + "/pages/" + page + ".adoc");
assertThat(input).isFile();
// Antora extracts metadata from the header. A full parse can fall back to a section
// title and conceal a missing document header, although Antora publishes "Untitled".
final Document document = asciidoctor.loadFile(input,
Options.builder().safe(SafeMode.SAFE).attributes(Map.of("env-site", ""))
.parseHeaderOnly(true).build());
assertThat(document.getDoctitle()).as("document title of %s", input).isEqualTo(title);
final String html = asciidoctor.convertFile(input,
Options.builder().safe(SafeMode.SAFE).attributes(Map.of("env-site", ""))
.standalone(false).toFile(false).build());
for (final String fragment : fragments) {
assertThat(html).as("published fragment %s in the rendered body of %s", fragment, input)
.contains("id=\"" + fragment + "\"");
}
}Pin: the lists are every ID the env-site render emits at this head, except preamble, which is Asciidoctor's wrapper. A probe on Asciidoctor 2.0.20 (the gem inside asciidoctorj 2.5.11) found that the pin passes on the head pages and fails on both mutants.
suggestion (non-blocking): The doctitle row also passes on a :title: attribute with no document header, a page Antora publishes as "Untitled".
opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java:72-75
The row asserts getDoctitle() of a header-only parse, but Antora takes the doctitle only from a page with a header. Replace :table-caption!:, and with it the inserted :leveloffset: -1, by :title: Requirements and Upgrade Considerations. == Requirements and Upgrade Considerations then stays a section. The header-only getDoctitle() returns the title from the attribute, so the row passes: 6/6 on that mutant in the generated page. Antora's loader returns no doctitle for the same input. AsciidoctorJ 2.5.11 Document has no header accessor. Without a title attribute, though, a header-only parse can get its doctitle only from the header.
assertThat(document.hasAttribute("title"))
.as("%s takes its title from a :title: attribute, which Antora ignores without a header", input)
.isFalse();Pin: add it after line 75. ContentNodeImpl.hasAttribute calls Ruby attr?, which returns false on the four head pages and true on the mutant.
issue (non-blocking): CHECKS.md gives the wrong reason for keeping the inline anchor in its own paragraph.
opendj-doc-generated-ref/CHECKS.md:127
An inline anchor:x[] never sets a section ID. Only a block anchor ([[x]], [#x]) attaches to the next block and replaces its automatic ID. The real failure is a missing blank line: Asciidoctor does not end a paragraph at a section title, so a === heading directly below the anchor joins its paragraph and disappears together with its fragment. This was probed on Asciidoctor 2.0.20 and Asciidoctor.js 2.2.8. As written, the sentence points at the wrong mechanism, and its obvious "fix", a block anchor, causes exactly the ID loss it warns about.
Keep a blank line after the anchor's `endif::[]`: Asciidoctor does not end a paragraph at a
section title, so a heading directly below the anchor joins its paragraph and disappears
together with its fragment ID. Do not turn the anchor into a block anchor (`[[id]]` or
`[#id]`) either: a block anchor attaches to the next block and replaces that section's
automatic ID.Or: drop the reason and keep only the rule, if the file should stay short.
|
@maximthomas Addressed all three suggestions in 2766cbd.
Validation: all 26 documentation-module unit tests and six integration checks passed on Java 11 and Java 27, with no failures, errors or skips. On Java 11, the unchanged generated inputs passed all six integration cases, and each of the three generated-input mutations produced exactly the expected failure. The PR description now reflects the final checks and separates current validation from the earlier Antora preview, PDF builds, attribute check and xref scan, which were not rerun for these test/documentation changes. The full reactor was not rerun, and the live site remains unchanged. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The round-1 gaps are closed, and the test now fails on each of the mutations it was written to catch.
AntoraPageTitlesITchecks all 16 published fragments and rejects a:title:attribute (hasAttribute("title")). On JDK 11 it passes 6/6 at this head. It fails on each of three page mutants ofrequirements-and-upgrade.adoc: the blank line after the anchor removed, a block anchor[[release-requirements]], and:title:in place of:table-caption!:.- The
env-sitesplit keeps every fragment the pages published before. In an Antora 3.1.15 render with the site UI, each page's HTML id set is the base set, pluspreambleon three pages.
The Release Notes and Getting Started chapter pages currently appear as AsciiDoc filenames in navigation and default xrefs, and their browser titles are
Untitled. Give all four pages proper title metadata while retaining their existing URLs, HTML fragments and combined-book chapter hierarchy.Use the existing
:table-caption!:insertion point in doc-maven-plugin 3.2.2 to promote chapter headings only in the generated Antora output. Keep chapter IDs on headings for the books and emit separate inline anchors underenv-site, because the default Antora UI does not render document IDs as HTML anchors.Add six integration checks in the
man-pagesprofile'sverifyphase, after Antora generation. They verify the expected document titles with header-only parsing, reject a:title:attribute that could mask a missing document header, and render the page bodies to check all 16 published chapter and subsection fragment IDs. They also preserve both combined books' chapter titles, IDs and levels. Missing generated inputs or a missing test include fail the build.Document the checks and source conventions in
CHECKS.md, including the blank line required after each inline anchor and the different effect of a block anchor on a section's automatic ID.Fixes #1275.
Validation
Current revision:
:title:. The first two fail on the missing published subsection ID; the third fails on the title attribute.git diff --checkpassed.Earlier validation of the page-title and anchor changes:
The current revision changes only the integration test and
CHECKS.md; the Antora preview, PDFs, attribute checker and xref scan were not rerun for this update. Validation used focused documentation goals; the full reactor was not rerun. Existing Maven/JRuby/JDK access and deprecation warnings remain. The live documentation site has not been deployed by this change.