Skip to content

[#317] Turn cross-guide xrefs into site links in asciidoc-to-pdf - #318

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-317-pdf-xref
Oct 5, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-317-pdf-xref

Conversation

@vharseko

@vharseko vharseko commented Oct 3, 2026

Copy link
Copy Markdown
Member

Fixes #317

Problem

asciidoc-to-pdf renders each guide with plain Asciidoctor, which knows neither the other guides nor the other Antora components. Every xref that leaves the current guide ended up in the PDF as a dead link such as opendj:install-guide:index.pdf or ../connectors-guide/chap-ldap.pdf#ldap-connector.

Change

AsciidocToPdfMojo now copies target/asciidoc/source to target/asciidoc/pdf-source, rewrites xrefs in the copy, and renders from it. The antora goal keeps reading the original sources, whatever the goal order.

Source In the PDF
xref:opendj:admin-guide:chap-replication.adoc#a[…] link:<siteUrl>/opendj/admin-guide/chap-replication.html#a[…]
xref:install-guide:chap-install.adoc#a[…] link:<siteUrl>/<component>/install-guide/chap-install.html#a[…]
xref:../connectors-guide/chap-ldap.adoc#a[…] link:<siteUrl>/<component>/connectors-guide/chap-ldap.html#a[…]
xref:openam:ROOT:index.adoc[…], xref:openam::index.adoc[…] link:<siteUrl>/openam/index.html[…]
xref:../<current guide>/page.adoc#a[…] xref:page.adoc#a[…] (same guide)
xref:#a[…], xref:page.adoc#a[…], xref:./page.adoc[…], xref:ROOT:attachment$…[…] unchanged

New goal parameters:

  • siteUrl, default https://doc.openidentityplatform.org
  • antoraComponent, default projectName in lower case. This matches openidm, opendj, openam and openig in the site's antora.yml files, so the four projects need no configuration change.

Testing

  • New AsciidocToPdfMojoTest (8 tests); all 48 tests of the module pass.
  • End to end: built Getting_Started.pdf and Connectors_Guide.pdf from a copy of the OpenIDM doc sources with this plugin, adding the two cross-component xrefs from [#232] Fix legacy relative links and typos in the guides OpenIDM#234. No xref to another guide is left in the PDF sources, and all 27 distinct site pages return 200. The 10 section anchors exist on the site. The other 18 anchors are chapter ids such as chap-csv.html#chap-csv: Antora renders that heading as the page title without an id, so the link opens the top of the right page.

Not in scope

The PDFs still contain dead link: macros that are not xrefs: link:../attachments/…, legacy link:../../../opendj/… links (being replaced in OpenIdentityPlatform/OpenIDM#234), and a hhttps:// typo in the OpenIDM Connectors Guide.

…asciidoc-to-pdf

Plain Asciidoctor knows neither the other guides nor the other Antora
components, so the PDF goal left every xref that leaves the current guide
as a dead link (opendj:install-guide:index.pdf, ../connectors-guide/x.pdf).

The goal now renders from a copy of the sources (target/asciidoc/pdf-source)
in which such xrefs become links to the page on the documentation site:
- xref:component:module:page.adoc#a[] and xref:module:page.adoc#a[]
- xref:../module/page.adoc#a[]
A relative xref into the current guide becomes a same-guide xref; other
xrefs are left as they are. The antora goal keeps reading the original
sources.

New goal parameters: siteUrl (default https://doc.openidentityplatform.org)
and antoraComponent (default: projectName in lower case).

Fixes OpenIdentityPlatform#317
@vharseko vharseko added bug documentation Documentation and Javadoc changes labels Oct 3, 2026
@vharseko
vharseko requested a review from maximthomas October 3, 2026 07:44

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: The rewrite lands where the dead links come from and leaves the Antora input alone.

  • preparePdfSource rewrites a copy in target/asciidoc/pdf-source, so the antora goal reads the original sources whatever the goal order.
  • The component default uses projectName.toLowerCase(Locale.ROOT). The consumers' projectName values are OpenIDM, OpenAM, OpenDJ and OpenIG. Under a tr default locale, a plain toLowerCase() would turn OpenIDM into openıdm.
  • The generated URLs match the site: /openidm/index.html, /opendj/install-guide/index.html and the other component roots return 200, and a missing page returns 404.

@vharseko
vharseko merged commit 78e48f2 into OpenIdentityPlatform:master Oct 5, 2026
14 checks passed
@vharseko
vharseko deleted the issue-317-pdf-xref branch October 5, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug documentation Documentation and Javadoc changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc-maven-plugin: asciidoc-to-pdf leaves cross-guide and cross-component xrefs as dead links

2 participants