de.h2b.taglets.mathlets
Class MathTaglet

java.lang.Object
  extended by de.h2b.taglets.InlineTaglet
      extended by de.h2b.taglets.mathlets.MathTaglet
All Implemented Interfaces:
com.sun.tools.doclets.Taglet

@ClassLabel(copyright="Copyright (C) 2008 Hans-Hermann Bode",
            ident="$Id: MathTaglet.java,v 1.10 2008/12/25 17:01:55 h2b Exp $")
public class MathTaglet
extends InlineTaglet

An inline taglet for typesetting mathematical formulas. The @math tag has three variants that allow to include a formula as a graphics or MathML file, as inline MathML or as plain HTML, respectively.

The first variant has the general form {@math attributes file:path}. The file: indicator is mandatory for this variant and must immediately be followed by a path specification. The taglet will produce an HTML <object/> element to embed the given file and commit any attributes to it. For example, to include a graphics file you can write {@math style="vertical-align:text-bottom" file:doc-files/example1.gif} which yields nil. In the same way you can include an XHTML file containing MathML code by {@math height="45" file:doc-files/example1.xhtml} resulting in

nil

(Your browser might not be capable to show that, see below.)

The second variant has the general form {@math attributes <mml:...}. The attributes have the same meaning as above and this time are followed by a valid MathML expression where all MathML elements have to be in the mml namespace. As a matter of principle, both presentation math and content math are possible, but not all browsers can handle MathML. While some can process presentation mode natively, others may need some plugin to work properly; regarding to content mode, I haven't seen any browser that can do it, yet. Anyway, you will notice that for each expression a file will be created in the apidocs directory.

For instance,

 {@math height="45"
  <mml:msup>
    <mml:msqrt>
      <mml:mrow>
        <mml:mi>x</mml:mi>
        <mml:mo>+</mml:mo>
        <mml:mi>y</mml:mi>
      </mml:mrow>
    </mml:msqrt>
    <mml:mn>3</mml:mn>
  </mml:msup>}
 
produces the result

nil

(Again, if your browser does not allow for MathML presentation mode, you will not see the result.)

The third variant has the general form {@math formula}. In this case, you are using plain HTML to write down the formula, where some substitutions take place for convenience.

Character sequences used as subscripts or superscripts do recursively underly substitutions. Of course, braces have to be balanced.

Since:
h2taglets 0.1
Version:
$Revision: 1.10 $, $Date: 2008/12/25 17:01:55 $
Author:
h2b

Field Summary
static java.lang.String PREFIX_FILE
          Indicates file processing.
static java.lang.String PREFIX_MATHML
          Indicates MathML processing.
static java.lang.String SUBDIR_MATHML
          Name of subdirectory for generated MathML files.
 
Constructor Summary
MathTaglet()
          Creates this taglet.
 
Method Summary
 java.lang.String getName()
          Returns the name of this custom tag.
static void register(java.util.Map tagletMap)
          Deprecated. Use central registration of Registration instead.
 java.lang.String toString(com.sun.javadoc.Tag tag)
          Returns the processed text of the tag.
 
Methods inherited from class de.h2b.taglets.InlineTaglet
inConstructor, inField, inMethod, inOverview, inPackage, inType, isInlineTag, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_FILE

public static final java.lang.String PREFIX_FILE
Indicates file processing.

Since:
h2taglets 0.1
See Also:
Constant Field Values

PREFIX_MATHML

public static final java.lang.String PREFIX_MATHML
Indicates MathML processing.

Since:
h2taglets 0.1
See Also:
Constant Field Values

SUBDIR_MATHML

public static final java.lang.String SUBDIR_MATHML
Name of subdirectory for generated MathML files.

Since:
h2taglets 0.1
See Also:
Constant Field Values
Constructor Detail

MathTaglet

public MathTaglet()
Creates this taglet.

Since:
h2taglets 0.1
Method Detail

register

@Deprecated
public static void register(java.util.Map tagletMap)
Deprecated. Use central registration of Registration instead.

Registers this taglet.

Parameters:
tagletMap - the map to register this tag to
Since:
h2taglets 0.1

getName

public java.lang.String getName()
Description copied from class: InlineTaglet
Returns the name of this custom tag.

Specified by:
getName in interface com.sun.tools.doclets.Taglet
Specified by:
getName in class InlineTaglet
Returns:
taglet's name

toString

public java.lang.String toString(com.sun.javadoc.Tag tag)
Returns the processed text of the tag.

If tag contains the PREFIX_FILE string, a file-based processing will be done. Otherwise, if tag contains the PREFIX_MATHML string, a MathML-based processing will be done. If none of these conditions apply, a plain HTML-based processing will occur. Prefixes are case-sensitive.

Specified by:
toString in interface com.sun.tools.doclets.Taglet
Specified by:
toString in class InlineTaglet
Parameters:
tag - the tag to be processed
Returns:
the processed text
See Also:
InlineTaglet.toString(com.sun.javadoc.Tag)


Copyright © 2008 Hans-Hermann Bode, Berlin, Germany. All Rights Reserved.