Add fuller DITA task element support to MDITA task topic type - #249
Add fuller DITA task element support to MDITA task topic type#249aireilly wants to merge 2 commits into
Conversation
|
This is a good idea. Haven't looked carefully enough into the implementation, but there are some things that would need to be fixed. |
|
Hi @jelovirt 😃 This is quite out of date now I've spent some time playing with this stuff and landed here: https://github.com/aireilly/redhat.mdita.extended This is all heavily LLM-based work so I am not sure how useful this is to you or org.lwdita generally. We can close this PR, or spend some time to make this work properly. I think an MDITA implementation with a wider compatibility with DITA features generally would be very useful. |
|
@aireilly, I just rebased this PR on the latest code. This PR needs some additional work to be merged, because the task section detection based on header text content needs to be configurable. But this is good start and parts of it can be cherry picked. |
| <ol class="- topic/ol "> | ||
| <li class="- topic/li "> | ||
| <p class="- topic/p ">Command</p> | ||
| </li> | ||
| </ol> |
There was a problem hiding this comment.
AFAICT, this cannot be written in Markdown. Markdown doesn't offer any way to end a section, thus the ordered list would be parsed to be inside the prereq section. So this is a redundant test.
| <section class="- topic/section " outputclass="prereq"> | ||
| <title class="- topic/title ">Prerequisites</title> |
There was a problem hiding this comment.
Having both @outputclass and a predefined title text is redundant. For this test, the @outputclass should be removed, but then the tests break.
|
#252 cherry-picks substeps from this PR with manual refactoring and fixes. |
|
#254 implements support for choices using explicit |
|
#255 adds configuration for implicit |
Extend the SpecializeFilter to support additional task elements through
positional inference and heading-based section annotation:
Layer 1 - Positional inference:
- result: content after steps auto-wraps in <result>
- substeps/substep: nested ordered list in step becomes <substeps>
- choices/choice: nested unordered list in step becomes <choices>
- choicetable: simpletable in step becomes <choicetable> with
chhead/chrow/choption/chdesc elements
Layer 2 - Heading-based sections:
- Add prereq, context, result, postreq, tasktroubleshooting as
recognized section classes in TopicRenderer so {.prereq} etc. on
H2 headings create sections (not nested topics)
- Preserve task section names in outputclass (only strip generic
"section" and "example") so SpecializeFilter can rename them
- Add section handler in SpecializeFilter to rename sections with
matching outputclass to task-specific elements
Also adds useJUnitPlatform() to build.gradle for JUnit 5 test execution.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
# Conflicts:
# src/main/java/com/elovirta/dita/markdown/SpecializeFilter.java
# Conflicts:
# src/main/java/com/elovirta/dita/markdown/SpecializeFilter.java
# src/test/java/com/elovirta/dita/markdown/SpecializeFilterTest.java
# Conflicts:
# src/main/java/com/elovirta/dita/markdown/SpecializeFilter.java
# src/test/resources/specialize/src/task_choices.dita
Map common heading titles to task section elements without requiring
explicit class attributes:
- "Prerequisites" → <prereq>
- "About this task" → <context>
- "Verification" → <result>
- "Next steps" → <postreq>
Title matching is case-insensitive. Explicit class attributes (e.g.
{.prereq}) still work and take precedence, allowing custom titles
like "## Before you begin {.prereq}".
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
|
@jelovirt I've split the remaining features from this PR into focused, standalone PRs:
Once the individual PRs are submitted, this PR can be closed. |
|
Default title mapping is now submitted as #257 — configurable via SAX feature Both PRs from this split are now open:
This PR can be closed once those are reviewed. |
Extend the SpecializeFilter to support additional task elements through positional inference and heading-based section annotation:
Layer 1 - Positional inference:
<result><substeps><choices><choicetable>withchhead/chrow/choption/chdescelementsLayer 2 - Heading-based sections:
{.prereq}etc. on H2 headings create sections (not nested topics)Also adds useJUnitPlatform() to build.gradle for JUnit 5 test execution.Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com