Class KonceptTreeBlockProcessor

java.lang.Object
org.asciidoctor.extension.BaseProcessor
org.asciidoctor.extension.BlockProcessor
network.ike.docs.koncept.KonceptTreeBlockProcessor
All Implemented Interfaces:
org.asciidoctor.extension.Processor

@Name("koncept-tree") @Contexts(":listing") @ContentModel(":raw") public class KonceptTreeBlockProcessor extends org.asciidoctor.extension.BlockProcessor
AsciidoctorJ block processor that renders a [koncept-tree] delimited block as an indented list of Koncept chips — the print/HTML/e-mail projection of the live tree Komet draws in the assistant surface (IKE-Network/ike-issues#827, the static counterpart of #805).

Usage in AsciiDoc:

[koncept-tree]
----
k:sctid=772222008[Medical devices]
  k:sctid=118956008[Microbiology device]
    k:MultiTargetRespiratoryTest[Multi-target respiratory NAA test]
----

Each line is an id-bearing k: token; leading-space indentation carries the parent/child edges (nearest ancestor with a strictly smaller indent — any consistent unit works). Two token forms are accepted, so the same block is portable across media:

  • Typed id — k:sctid=…, k:uuid=…, k:id=…, k:nid=… — the exact grammar the live renderer parses (KonceptTreeBlockRenderer in komet-claude-plugin), so a tree the assistant emits in Komet renders identically here. The identicon is resolved store-free: sctid via SnomedUuids.fromSnomed(String), uuid/id directly. A nid is a live-store native id with no static meaning, so it falls back to its authoring label.
  • Name key — k:HeartFailure[…] — a key into koncepts.yml, resolved exactly like the inline KonceptInlineMacro; this form additionally carries the glossary cross-reference and the component-kind sigil.

A line may also be a computed query directive instead of a literal k: token — leaves: Identifier (every leaf descendant, walked recursively), children: Identifier (direct children only), descendants: Identifier (every descendant at any depth, not including the identifier itself), or kindof: Identifier (the identifier itself plus every descendant — Tinkar's own "kind of" relation) — expanded, before token parsing, into the equivalent set of k:Identifier[] lines at the directive's own indent (so they nest exactly where a literal list of the same lines would have). Both are computed fresh from the broader relationship already in koncepts.yml (KonceptGraph) — no separate query data, just a graph walk over what's already there (IKE-Network/ike-issues#879):

[koncept-tree]
----
k:Axioms[]
  leaves: Axioms
----

The hierarchy is drawn with indentation, not line art: box-drawing connectors (├─ └─ │) are exactly what breaks on copy-and-paste (wrong font, collapsed whitespace, a plain-text target), whereas a leading run of fixed-width non-breaking spaces survives. The indent is therefore emitted as literal U+00A0 characters in the text — not a CSS margin, which would vanish the instant a reader copies the tree into a plain-text e-mail — and each chip carries its concept identity in the identicon alt/link title, so a plain-text copy degrades to an indented outline of names-with-identity rather than to rubble.

Stage 1 (#827) renders the html5 family (which includes the CSS-PDF backends Prince/AH/WeasyPrint, all of which report backend=html5); docbook5 → FO and Prawn pdf render the raw tokens as a literal block for now and gain their own indented projection in stage 2.

  • Field Summary

    Fields inherited from class org.asciidoctor.extension.BlockProcessor

    name
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new block processor instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    process(org.asciidoctor.ast.StructuralNode parent, org.asciidoctor.extension.Reader reader, Map<String,Object> attributes)
    Parses the block body and renders it as an indented list of Koncept chips for the current backend.

    Methods inherited from class org.asciidoctor.extension.BlockProcessor

    getName, setName

    Methods inherited from class org.asciidoctor.extension.BaseProcessor

    createBlock, createBlock, createBlock, createBlock, createBlock, createBlock, createBlock, createDocument, createList, createList, createList, createListItem, createListItem, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createSection, createSection, createSection, createSection, createSection, createTable, createTable, createTableCell, createTableCell, createTableCell, createTableCell, createTableColumn, createTableColumn, createTableRow, getConfig, log, newCursor, newCursor, newCursor, newReader, newReader, newReader, newReader, parseContent, setConfig, unwrap, updateConfig

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KonceptTreeBlockProcessor

      public KonceptTreeBlockProcessor()
      Creates a new block processor instance.
  • Method Details

    • process

      public Object process(org.asciidoctor.ast.StructuralNode parent, org.asciidoctor.extension.Reader reader, Map<String,Object> attributes)
      Parses the block body and renders it as an indented list of Koncept chips for the current backend.
      Specified by:
      process in class org.asciidoctor.extension.BlockProcessor
      Parameters:
      parent - the parent AST node
      reader - the block content reader (raw, unsubstituted lines)
      attributes - the block attributes (unused)
      Returns:
      a passthrough block of chip rows on the html5 family; a literal block of the raw tokens on other backends or when the body is not a well-formed tree