Class GoalLinkRewriter

java.lang.Object
network.ike.plugin.GoalLinkRewriter

public final class GoalLinkRewriter extends Object
Post-render pass that turns inline Maven goal references in the generated site HTML into links to their published goal documentation.

An inline monospaced goal token such as <code>ws:checkpoint-publish</code> becomes <a href="…/ws-goals.html#checkpoint-publish"><code>ws:checkpoint-publish</code></a>. Links always point at the /latest/ goal-reference page (version-independent), so a page never pins a goal link to a specific release:

  • ws:<goal> → "https://ike.network/ike-platform/latest/ike-workspace-maven-plugin/ws-goals.html#"<goal>
  • ike:<goal> → "https://ike.network/ike-tooling/latest/ike-maven-plugin/index.html#"<goal>

The rewrite runs against the already-rendered HTML rather than during AsciiDoc parsing because the site is rendered by asciidoctor-parser-doxia-module, which does not invoke AsciidoctorJ extensions (verified — neither tree- nor postprocessors fire). Operating on the final HTML also makes the behaviour uniform across every ike:site-publish-deployed site with one implementation (IKE-Network/ike-issues#783).

Tokens are skipped when they sit inside a <pre> code listing (a command example is not a cross-reference) or are already inside an <a> (so a hand-authored link is never double-wrapped). Only the matched <code> spans are modified; the rest of each page is left byte-for-byte unchanged.

  • Method Details

    • rewriteSiteHtml

      public static int rewriteSiteHtml(Path siteDir, org.apache.maven.api.plugin.Log log)
      Rewrite every *.html file under siteDir in place, linking inline goal references to their latest goal docs.

      Best-effort: a read/write failure on one file aborts the walk but is reported as a non-fatal warning rather than failing the publish. Files with no goal references are left untouched (not rewritten).

      Parameters:
      siteDir - root of a rendered site tree (e.g. target/site or target/staging); null or a non-directory is a no-op
      log - Maven logger for the summary line
      Returns:
      the total number of goal references linked