Creating DITA Maps

You can create DITA map files using three new qdoc commands, the ditamap command, the topicref command, and the mapref command. How these DITA maps will be used automatically or manually by the documentation build process is still under consideration. This section will be updated as the decisions are made.

What is a DITA Map?

A complete description of DITA can be found at the OASIS Darwin Information Typing Architecture site.

An explanation of the DITA map is found at that site here.

\ditamap

The \ditamap command is for creating a DITA map using qdoc commands. The \ditamap command is a kind of \page command that produces a .ditamap instead of a .html or .xml file. The file that is created actually contains XML text, but the .ditamap suffix is used to identify the file as containing a DITA MAP.

The argument is the name of the file to be created. In the following example, the file creator.ditamap is output:

\ditamap creator.ditamap

\topicref \endtopicref

The \topicref \endtopicref commands are for creating a topicref in the ditamap. The \endtopicref command is required because \topicref commands can be nested.

\topicref has two arguments. The first argument becomes the value of the navtitle attribute. Normally, you use the title of the topic being referenced. This title is often what will appear in a table of contents constructed from the ditamap.

The second argument is the name of the page being referenced. The second argument is actually optional, for example if you are using a topicref as a container for other topicrefs and maprefs. It is also optional if you want qdoc to find the page name for you by looking up the title in its internal data structure. It is recommended that you provide the second parameter if you know the page name.

\topicref {QML Module QtQuick 2} {qtquick-2.xml}
  \mapref {Creator Manual} {creator-manual.ditamap} \endmapref
  \topicref {QML Mouse Events} {qtquick2-mouseevents.xml} \endtopicref
  \topicref {Property Binding} {qtquick2-propertybinding.xml} \endtopicref
\endtopicref

\mapref

The \mapref command is for creating a mapref in the ditamap. A mapref refers to another ditamap, which you want to include in your ditamap. Like the \topicref command, the \mapref command has two arguments, but for the \mapref command, both arguments are required. The arguments are essentially the same as described for \topicref, but for \mapref, the second command must be the name of another ditamap, i.e. it must have the .ditamap suffix. You must provide the file name. qdoc can't look up the file name for you.

\mapref {Creator Manual} {creator-manual.ditamap} \endmapref

An Example Ditamap Page

The following example uses the three qdoc ditamap commands described above.

\ditamap creator.ditamap
\title The DITA Map for Creator

\topicref {QML Module QtQuick 1}
  \topicref {QML Mouse Events} \endtopicref
  \topicref {Property Binding} \endtopicref
\endtopicref

\topicref {QML Module QtQuick 2} {qtquick-2.xml}
  \mapref {Creator Manual} {creator-manual.ditamap} \endmapref
  \topicref {QML Mouse Events} {qtquick2-mouseevents.xml} \endtopicref
  \topicref {Property Binding} {qtquick2-propertybinding.xml} \endtopicref
\endtopicref

\topicref {QML Module QtQuick.Particles 2} {qtquick-particles-2.xml}
  \topicref {Age} {qml-qtquick-particles2-age.xml} \endtopicref
\endtopicref

The Resulting Ditamap File

This is the .ditamap file you get when you input the qdoc ditamap page shown above. Note that you can write ditamap files directly in XML just as easily as you can write them using the qdoc commands. The choice is yours.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
  <topicmeta>
    <shortdesc>The DITA Map for Creator</shortdesc>
  </topicmeta>
  <topicref navtitle="QML Module QtQuick 1" href="qtquick-1.xml">
    <topicref navtitle="QML Mouse Events" href="qtquick2-mouseevents.xml"/>
    <topicref navtitle="Property Binding" href="qtquick2-propertybinding.xml"/>
  </topicref>
  <topicref navtitle="QML Module QtQuick 2" href="qtquick-2.xml">
    <mapref navtitle="Creator Manual" href="creator-manual.ditamap"/>
    <topicref navtitle="QML Mouse Events" href="qtquick2-mouseevents.xml"/>
    <topicref navtitle="Property Binding" href="qtquick2-propertybinding.xml"/>
  </topicref>
  <topicref navtitle="QML Module QtQuick.Particles 2" href="qtquick-particles-2.xml">
    <topicref navtitle="Age" href="qml-qtquick-particles2-age.xml"/>
  </topicref>
</map>

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.