myfirsttime1
myfirsttime1

Reputation: 287

DITA tag which contents are ignored or to contain non-DITA content

Question: Is there, and what would it be, the right tag to enclose non-DITA content within a DITA document?

The functionality that I am looking for is a tag, say <ignored></ignored> such that any content, including <, >, &, or even other tags, inside it are interpreted as plain text, or perhaps as another language.

For example, in HTML I could use

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    This is some text 
    <script> that gets bold <b> after this tag </script> 
    that doesn't get bold</b><br/>
    This text <b>did get bold</b>
  </body>
</html>

the code inside the <script></script> tags is ignored. The browser should display:


This is some text that doesn't get bold
This text did get bold


I think DITA doesn't have the script tag, or at least I didn't see it in this language reference.

Upvotes: 2

Views: 317

Answers (2)

DrMacro
DrMacro

Reputation: 656

There's two parts to this:

  • How to include arbitrary text in XML (use a CDATA marked section)
  • What element to use to indicate that the content is not DITA?

A marked section is <![CDATA[ ... ]]>

There are a couple of ways to approach your requirement but <data> is not one of them. <data> elements are semantically metadata and what you have is not metadata but content.

As Kris says, a specialization is probably the best solution but it's not required.

You can use @outputclass on any element to signal the need for special processing, e.g.:

<fig><title>My Math Stuff</title>
<p outputclass="latex">{LaTex content here}</p>
</fig>

It's up to you to implement the processing to turn the <p> into math on output or as part of an XML-to-XML transform.

If you want to specialize the best route would be to specialize from <foreign>. The <foreign> element by definition contains content that does not use DITA-defined markup.

Note that DITA 1.3 includes a built-in integration with MathML, so if you transform the LaTeX into MathML you don't need to reinvent special markup for that.

In addition, the DITA 1.3 equation domain provides general container elements for equations, where the content of an equation element is one or more representations of the equation. The representations can be anything: MathML markup, image references, or, in your case, the raw LaTeX definition of the equation.

Upvotes: 2

Stefan Jung
Stefan Jung

Reputation: 1268

It depends in what you are trying to achieve. Maybe <code> is what you are searching for. Otherwise <data> is what you need or a new element based on <data>.

The spec says about <data>:

"Default processing should treat the content as an unknown kind of metadata and ignore it for rendering, but custom processing may match the name attribute or specialized element and use the element for automated manipulation or to format data associated with the body flow."

Upvotes: 2

Related Questions