Class PacketAssembler

java.lang.Object
network.ike.docs.plugin.diff.PacketAssembler

public final class PacketAssembler extends Object
Composes the review packet's generated AsciiDoc (ike-issues#648): the master document with cover sheet, change summary, Record of Changes, per-topic includes, Change Glossary, and Change Index, plus the unified-diff listings for assembly scaffolding files.

All methods are pure functions over already-loaded content — the mojo owns every file read and write.

  • Method Details

    • unifiedDiff

      public static String unifiedDiff(String path, List<String> oldLines, List<String> newLines)
      Produce a unified diff for a scaffolding file.
      Parameters:
      path - the repository-relative path (used in headers)
      oldLines - the from-side lines (empty when added)
      newLines - the to-side lines (empty when deleted)
      Returns:
      the unified diff text, without trailing newline
    • injectChangeTerms

      public static List<String> injectChangeTerms(List<String> lines, List<String> changeTitles)
      Inject one silent change-index term per owning change after a fragment's level-1 title, so the ordinary [index] section collects a change → pages mapping. Titles are quoted because a comma in an indexterm splits levels.
      Parameters:
      lines - the marked fragment
      changeTitles - the owning changes' titles
      Returns:
      the fragment with terms injected (a new list)
    • anchorOf

      public static String anchorOf(List<String> lines)
      Find a fragment's anchor id ([[id]]).
      Parameters:
      lines - the fragment
      Returns:
      the anchor id, or null when none is present
    • masterDoc

      public static String masterDoc(String title, String fromLabel, String toLabel, List<PacketAssembler.TopicEntry> topics, List<String> deleted, ChangeManifest manifest, List<List<String>> anchorsByChange, boolean hasRegistryDelta, List<PacketAssembler.ScaffoldEntry> scaffolds, String singleStampLine, List<StampRegistry.Stamp> stampsUsed)
      Compose the packet master document.
      Parameters:
      title - the document title
      fromLabel - human label for the from side
      toLabel - human label for the to side
      topics - marked topics, in presentation order
      deleted - repository-relative paths deleted in range
      manifest - the change manifest
      anchorsByChange - per-change anchor ids for context links, parallel to manifest.changes()
      hasRegistryDelta - whether a registry-delta partial exists
      scaffolds - scaffolding diffs, in presentation order
      singleStampLine - the packet's one stamp when in-flow refs are suppressed, or null
      stampsUsed - the stamps used in-flow, for the Stamp Register; empty when suppressed
      Returns:
      the master document text