Topics

ANN: DITA-OT plugin to add a mini-TOC anywhere you want

Chris Papademetrious
 

Hi all,

I created a plugin that lets you implement a "mini-TOC" within your content via a placeholder element:

https://github.com/chrispy-snps/DITA-mini-toc-element

The plugin hooks into the preprocess stage, and thus works for all output formats (including normalized DITA). The idea is that you add a "mini-TOC" placeholder element within your DITA content:

<topic>
  <title>My Topic</title>
  <body>
    <div outputclass="mini-toc">
      <p>The following topics provide information about the XYZ feature:</p>
    </div>
  </body>
  <topic>
    <title>XYZ Feature Writeup 1</title>
    ...
  </topic>
  <topic>
    <title>XYZ Feature Writeup 2</title>
    ...
  </topic>
</topic>

The topics can be in the same file or separate files. During transformation, a list of xrefs to the child topics is appended at the end inside the mini-TOC element.

The plugin also looks for an element named <mini-toc>. In our authoring environment, we specialize this from <div> and add placeholder child items in the Oxygen editor via CSS:

@media oxygen {
  *[class~='snps-d/mini-toc'] {
    border-style: dotted;
    border-color: blue;
    border-width: thin;
  }
  *[class~='snps-d/mini-toc']:after {
    display: block;
    content: oxy_label(text, "\2022", styles, "font-size:1.5em;") oxy_label(text, "   (child topics will", styles, "color:blue;display:inline-block;")
        '\a' oxy_label(text, "\2022", styles, "font-size:1.5em;") oxy_label(text, "   be added here)", styles, "color:blue;display:inline-block;");
    list-style-type: disc;
    list-style-position: outside;
    margin-top: -6pt;
  }
}

 - Chris

Julio J Vazquez
 

Nice. 

Julio J. Vazquez

Larry Kollar
 

Is there a minimum version of DITA-OT needed for this to work? Or do we need to add it as a requirement in our own plugins to get it to hook into preprocess? I installed it in Oxygen (20.1 if that's important) and it's not doing anything.

For the book I'm testing with, it has sub-maps for each chapter, and all topics are in their own files.

Chris Papademetrious
 

Hi Larry,

I developed the plugin with DITA-OT 3.5. I didn't do any testing of prior versions, but I'm happy to do so if you can tell me what DITA-OT version you're using and if you can provide me with a small testcase.

I'll contact you privately by email.

 - Chris

Roger Sheen
 

On Wednesday, 2020-05-13, at 15:24 CEST, Chris Papademetrious wrote:

I created a plugin that lets you implement a "mini-TOC" within your content via a placeholder element:

https://github.com/chrispy-snps/DITA-mini-toc-element

Hi Chris,

This looks useful. Please consider submitting it to the DITA-OT plug-in registry at https://www.dita-ot.org/plugins.

For details on the process, see “Publishing plug-ins to the registry” in the docs:

https://www.dita-ot.org/dev/topics/plugins-registry.html#plugin-registry__publishing-to-registry

Regards,

Roger


--

https://www.dita-ot.org/dev/ · DITA Open Toolkit Documentation