Using Templates to Create a New DITA Topic with Elements Already Inserted

Today I want to tell you about a feature that we ourselves never considered a “feature” until our users begin to tell us how helpful it is. So it’s a sort of an undocumented feature that you probably didn’t know about.

As you know, you can create new DITA topics from DITAToo by clicking the New Topic button. DITAToo asks you about the topic type you want to create. Currently, you can select between concept, task, and reference (though in the future we are planning to add more choices and possibly even allow you to create your own specialized topics). Then DITAToo launches your DITA editor which starts with a new empty topic already opened. The new topic contains a few top level elements already inserted. For example, a new task will contain the title and taskbody elements.

If you take a closer look at the DITAToo installation folder (by default, it’s c:\Program Files\Ditatoo), you’ll see where these elements are coming from. There’re three files: concept_template, task_template, and reference_template. These are usual text files that serve as boilerplates for different topic types. DITAToo uses them to create a new topic.

Therefore, if you want a new topic to contain some elements already inserted, you should just edit the appropriate template. For example, you might want a new task to contain the context and steps elements already inserted. All you need to do is to open task_template, say, in Notepad, add the required elements, and save the file. Next time when you create a new task from DITAToo, the new task will contain the elements you added to the template.

That’s it. Does it sound useful?

By the way, you can learn more about DITAToo by visiting the DITAToo official website.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation