Merge dpvc/issue85 (fixes for element configuration option)

This commit is contained in:
Davide P. Cervone 2011-04-05 12:19:46 -04:00
commit 4a2969c45b
35 changed files with 229 additions and 239 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -174,6 +174,16 @@ MathJax.Hub.Config({
// //
skipStartupTypeset: false, skipStartupTypeset: false,
//
// A list of element ID's that are the ones to process for mathematics
// when any of the Hub typesetting calls (Typeset, Process, Update, etc)
// are called with no element specified. This lets you restrict the
// processing to particular containers rather than scanning the entire
// document for mathematics. If none are supplied, the entire document
// is processed.
//
elements: [],
//============================================================================ //============================================================================
// //
// These parameters control the tex2jax preprocessor (when you have included // These parameters control the tex2jax preprocessor (when you have included
@ -181,11 +191,6 @@ MathJax.Hub.Config({
// //
tex2jax: { tex2jax: {
//
// The Id of the element to be processed (defaults to full document)
//
element: null,
// //
// The delimiters that surround in-line math expressions. The first in each // The delimiters that surround in-line math expressions. The first in each
// pair is the initial delimiter and the second is the terminal delimiter. // pair is the initial delimiter and the second is the terminal delimiter.
@ -282,11 +287,6 @@ MathJax.Hub.Config({
// //
mml2jax: { mml2jax: {
//
// The Id of the element to be processed (defaults to full document)
//
element: null,
// //
// Controls whether mml2jax inserts MathJax_Preview spans to make a // Controls whether mml2jax inserts MathJax_Preview spans to make a
// preview available, and what preview to use, whrn it locates // preview available, and what preview to use, whrn it locates
@ -313,11 +313,6 @@ MathJax.Hub.Config({
// //
jsMath2jax: { jsMath2jax: {
//
// The Id of the element to be processed (defaults to full document)
//
element: null,
// //
// Controls whether jsMath2jax inserts MathJax_Preview spans to make a // Controls whether jsMath2jax inserts MathJax_Preview spans to make a
// preview available, and what preview to use, when it locates // preview available, and what preview to use, when it locates

View File

@ -187,24 +187,26 @@ Methods
.. Method:: Typeset([element[,callback]]) .. Method:: Typeset([element[,callback]])
Calls the preprocessors on the given element, and then typesets Calls the preprocessors on the given element (or elements if it is an
any math elements within the element. If no `element` is array of elements), and then typesets any math elements within the
provided, the whole document is processed. The `element` is element. If no `element` is provided, the whole document is processed.
either the DOM `id` of the element, or a reference to the DOM The `element` is either the DOM `id` of the element, a reference to
element itself. The `callback` is called when the process is the DOM element itself, or an array of id's or refereneces. The
complete. See the :ref:`Modifying Math <typeset-math>` section `callback` is called when the process is complete. See the
for details of how to use this method properly. :ref:`Modifying Math <typeset-math>` section for details of how to use
this method properly.
:Parameters: :Parameters:
- **element** --- the element whose math is to be typeset - **element** --- the element(s) whose math is to be typeset
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object
.. method:: PreProcess([element[,callback]]) .. method:: PreProcess([element[,callback]])
Calls the loaded preprocessors on the entire document, or on the Calls the loaded preprocessors on the entire document, or on the given
given DOM element. The `element` is either the DOM `id` of the DOM element (or elements, if it is an array of elements). The
element, or a reference to the DOM element itself. The `callback` `element` is either the DOM `id` of the element, a reference to the
DOM element itself, or an array of id's or references. The `callback`
is called when the processing is complete. is called when the processing is complete.
:Parameters: :Parameters:
@ -214,43 +216,44 @@ Methods
.. method:: Process([element[,callback]]) .. method:: Process([element[,callback]])
Scans either the entire document or a given DOM `element` for Scans either the entire document or a given DOM `element` (or array of
MathJax ``<script>`` tags and processes the math those tags elements) for MathJax ``<script>`` tags and processes the math those
contain. The `element` is either the DOM `id` of the element to tags contain. The `element` is either the DOM `id` of the element to
scan, or a reference to the DOM element itself. The `callback` is scan, a reference to the DOM element itself, or an array of id's or
called when the processing is complete. references. The `callback` is called when the processing is complete.
:Parameters: :Parameters:
- **element** --- the element to be processed - **element** --- the element(s) to be processed
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object
.. method:: Update([element[,callback]]) .. method:: Update([element[,callback]])
Scans either the entire document or a given DOM element for Scans either the entire document or a given DOM element (or elements if
mathematics that has changed since the last time it was processed, it is an array of elements) for mathematics that has changed since the
or is new, and typesets the mathematics they contain. The last time it was processed, or is new, and typesets the mathematics
`element` is either the DOM `id` of the element to scan, or a they contain. The `element` is either the DOM `id` of the element to
reference to the DOM element itself. The `callback` is called scan, a reference to the DOM element itself, or an array of id's or
when the processing is complete. references. The `callback` is called when the processing is complete.
:Parameters: :Parameters:
- **element** --- the element to be updated - **element** --- the element(s) to be updated
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object
.. method:: Reprocess([element[,callback]]) .. method:: Reprocess([element[,callback]])
Removes any typeset mathematics from the document or DOM Removes any typeset mathematics from the document or DOM element (or
element, and then processes the mathematics again, elements if it is an array of elements), and then processes the
re-typesetting everything. This may be necessary, for example, if mathematics again, re-typesetting everything. This may be necessary,
the CSS styles have changed and those changes would affect the for example, if the CSS styles have changed and those changes would
mathematics. The `element` is either the DOM `id` of the element affect the mathematics. The `element` is either the DOM `id` of the
to scan, or a reference to the DOM element itself. The `callback` element to scan, a reference to the DOM element itself, or an array of
is called when the processing is complete. id's or references. The `callback` is called when the processing is
complete.
:Parameters: :Parameters:
- **element** --- the element to be reprocessed - **element** --- the element(s) to be reprocessed
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object

View File

@ -145,6 +145,16 @@ behavior of MathJax. They are given with their default values.
which case you will need to call :meth:`MathJax.Hub.Typeset()` which case you will need to call :meth:`MathJax.Hub.Typeset()`
yourself by hand, set this value to ``true``. yourself by hand, set this value to ``true``.
.. describe:: elements: []
This is a list of DOM element ID's that are the ones to process for
mathematics when any of the Hub typesetting calls (Typeset, Process,
Update, etc.) are called with no element specified, and during
MathJax's initial typesetting run when it starts up. This lets you
restrict the processing to particular containers rather than scanning
the entire document for mathematics. If none are supplied, the complete
document is processed.
.. describe:: menuSettings: { ... } .. describe:: menuSettings: { ... }
This block contains settings for the mathematics contextual menu This block contains settings for the mathematics contextual menu

View File

@ -20,12 +20,6 @@ section in your :meth:`MathJax.Hub.Config()` call. For example
would set the ``preview`` parameter to ``"none"``. would set the ``preview`` parameter to ``"none"``.
.. describe:: element: null
The id name of the element that should be processed by `jsMath2jax`.
The default is the whole document.
.. describe:: preview: "TeX" .. describe:: preview: "TeX"
This controls whether `jsMath2jax` inserts ``MathJax_Preview`` spans This controls whether `jsMath2jax` inserts ``MathJax_Preview`` spans

View File

@ -20,11 +20,6 @@ set any of these options, include a ``mml2jax`` section in your
would set the ``preview`` parameter to ``"none"``. would set the ``preview`` parameter to ``"none"``.
.. describe:: element: null
The id name of the element that should be processed by `mml2jax`.
The default is the whole document.
.. describe:: preview: "alttext" .. describe:: preview: "alttext"
This controls whether `mml2jax` inserts ``MathJax_Preview`` spans This controls whether `mml2jax` inserts ``MathJax_Preview`` spans

View File

@ -22,11 +22,6 @@ would set the ``inlineMath`` delimiters for the `tex2jax`
preprocessor. preprocessor.
.. describe:: element: null
The id name of the element that should be processed by `tex2jax`.
The default is the whole document.
.. describe:: inlineMath: [['\\\(','\\\)']] .. describe:: inlineMath: [['\\\(','\\\)']]
Array of pairs of strings that are to be used as in-line math Array of pairs of strings that are to be used as in-line math

View File

@ -330,19 +330,20 @@ supply as many <cite>callback</cite> specifications in one call to the
<dl class="method"> <dl class="method">
<dt id="Typeset"> <dt id="Typeset">
<tt class="descname">Typeset</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Typeset" title="Permalink to this definition"></a></dt> <tt class="descname">Typeset</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Typeset" title="Permalink to this definition"></a></dt>
<dd><p>Calls the preprocessors on the given element, and then typesets <dd><p>Calls the preprocessors on the given element (or elements if it is an
any math elements within the element. If no <cite>element</cite> is array of elements), and then typesets any math elements within the
provided, the whole document is processed. The <cite>element</cite> is element. If no <cite>element</cite> is provided, the whole document is processed.
either the DOM <cite>id</cite> of the element, or a reference to the DOM The <cite>element</cite> is either the DOM <cite>id</cite> of the element, a reference to
element itself. The <cite>callback</cite> is called when the process is the DOM element itself, or an array of id&#8217;s or refereneces. The
complete. See the <a class="reference internal" href="../typeset.html#typeset-math"><em>Modifying Math</em></a> section <cite>callback</cite> is called when the process is complete. See the
for details of how to use this method properly.</p> <a class="reference internal" href="../typeset.html#typeset-math"><em>Modifying Math</em></a> section for details of how to use
this method properly.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple"> <tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>element</strong> &#8212; the element whose math is to be typeset</li> <li><strong>element</strong> &#8212; the element(s) whose math is to be typeset</li>
<li><strong>callback</strong> &#8212; the callback specification</li> <li><strong>callback</strong> &#8212; the callback specification</li>
</ul> </ul>
</td> </td>
@ -357,9 +358,10 @@ for details of how to use this method properly.</p>
<dl class="method"> <dl class="method">
<dt id="PreProcess"> <dt id="PreProcess">
<tt class="descname">PreProcess</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#PreProcess" title="Permalink to this definition"></a></dt> <tt class="descname">PreProcess</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#PreProcess" title="Permalink to this definition"></a></dt>
<dd><p>Calls the loaded preprocessors on the entire document, or on the <dd><p>Calls the loaded preprocessors on the entire document, or on the given
given DOM element. The <cite>element</cite> is either the DOM <cite>id</cite> of the DOM element (or elements, if it is an array of elements). The
element, or a reference to the DOM element itself. The <cite>callback</cite> <cite>element</cite> is either the DOM <cite>id</cite> of the element, a reference to the
DOM element itself, or an array of id&#8217;s or references. The <cite>callback</cite>
is called when the processing is complete.</p> is called when the processing is complete.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -381,17 +383,17 @@ is called when the processing is complete.</p>
<dl class="method"> <dl class="method">
<dt id="Process"> <dt id="Process">
<tt class="descname">Process</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Process" title="Permalink to this definition"></a></dt> <tt class="descname">Process</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Process" title="Permalink to this definition"></a></dt>
<dd><p>Scans either the entire document or a given DOM <cite>element</cite> for <dd><p>Scans either the entire document or a given DOM <cite>element</cite> (or array of
MathJax <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tags and processes the math those tags elements) for MathJax <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tags and processes the math those
contain. The <cite>element</cite> is either the DOM <cite>id</cite> of the element to tags contain. The <cite>element</cite> is either the DOM <cite>id</cite> of the element to
scan, or a reference to the DOM element itself. The <cite>callback</cite> is scan, a reference to the DOM element itself, or an array of id&#8217;s or
called when the processing is complete.</p> references. The <cite>callback</cite> is called when the processing is complete.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple"> <tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>element</strong> &#8212; the element to be processed</li> <li><strong>element</strong> &#8212; the element(s) to be processed</li>
<li><strong>callback</strong> &#8212; the callback specification</li> <li><strong>callback</strong> &#8212; the callback specification</li>
</ul> </ul>
</td> </td>
@ -406,18 +408,18 @@ called when the processing is complete.</p>
<dl class="method"> <dl class="method">
<dt id="Update"> <dt id="Update">
<tt class="descname">Update</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Update" title="Permalink to this definition"></a></dt> <tt class="descname">Update</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Update" title="Permalink to this definition"></a></dt>
<dd><p>Scans either the entire document or a given DOM element for <dd><p>Scans either the entire document or a given DOM element (or elements if
mathematics that has changed since the last time it was processed, it is an array of elements) for mathematics that has changed since the
or is new, and typesets the mathematics they contain. The last time it was processed, or is new, and typesets the mathematics
<cite>element</cite> is either the DOM <cite>id</cite> of the element to scan, or a they contain. The <cite>element</cite> is either the DOM <cite>id</cite> of the element to
reference to the DOM element itself. The <cite>callback</cite> is called scan, a reference to the DOM element itself, or an array of id&#8217;s or
when the processing is complete.</p> references. The <cite>callback</cite> is called when the processing is complete.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple"> <tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>element</strong> &#8212; the element to be updated</li> <li><strong>element</strong> &#8212; the element(s) to be updated</li>
<li><strong>callback</strong> &#8212; the callback specification</li> <li><strong>callback</strong> &#8212; the callback specification</li>
</ul> </ul>
</td> </td>
@ -432,19 +434,20 @@ when the processing is complete.</p>
<dl class="method"> <dl class="method">
<dt id="Reprocess"> <dt id="Reprocess">
<tt class="descname">Reprocess</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Reprocess" title="Permalink to this definition"></a></dt> <tt class="descname">Reprocess</tt><big>(</big><span class="optional">[</span><em>element</em><span class="optional">[</span>, <em>callback</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Reprocess" title="Permalink to this definition"></a></dt>
<dd><p>Removes any typeset mathematics from the document or DOM <dd><p>Removes any typeset mathematics from the document or DOM element (or
element, and then processes the mathematics again, elements if it is an array of elements), and then processes the
re-typesetting everything. This may be necessary, for example, if mathematics again, re-typesetting everything. This may be necessary,
the CSS styles have changed and those changes would affect the for example, if the CSS styles have changed and those changes would
mathematics. The <cite>element</cite> is either the DOM <cite>id</cite> of the element affect the mathematics. The <cite>element</cite> is either the DOM <cite>id</cite> of the
to scan, or a reference to the DOM element itself. The <cite>callback</cite> element to scan, a reference to the DOM element itself, or an array of
is called when the processing is complete.</p> id&#8217;s or references. The <cite>callback</cite> is called when the processing is
complete.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple"> <tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>element</strong> &#8212; the element to be reprocessed</li> <li><strong>element</strong> &#8212; the element(s) to be reprocessed</li>
<li><strong>callback</strong> &#8212; the callback specification</li> <li><strong>callback</strong> &#8212; the callback specification</li>
</ul> </ul>
</td> </td>

View File

@ -121,7 +121,7 @@ MathML that works in all modern browsers.</p>
</li> </li>
</ul> </ul>
<hr class="docutils" /> <hr class="docutils" />
<p>This version of the documentation was built March 29, 2011.</p> <p>This version of the documentation was built April 05, 2011.</p>
</div> </div>
</div> </div>

View File

@ -208,6 +208,18 @@ which case you will need to call <tt class="xref py py-meth docutils literal"><s
yourself by hand, set this value to <tt class="docutils literal"><span class="pre">true</span></tt>.</p> yourself by hand, set this value to <tt class="docutils literal"><span class="pre">true</span></tt>.</p>
</dd></dl> </dd></dl>
<dl class="describe">
<dt>
<tt class="descname">elements: []</tt></dt>
<dd><p>This is a list of DOM element ID&#8217;s that are the ones to process for
mathematics when any of the Hub typesetting calls (Typeset, Process,
Update, etc.) are called with no element specified, and during
MathJax&#8217;s initial typesetting run when it starts up. This lets you
restrict the processing to particular containers rather than scanning
the entire document for mathematics. If none are supplied, the complete
document is processed.</p>
</dd></dl>
<dl class="describe"> <dl class="describe">
<dt> <dt>
<tt class="descname">menuSettings: { ... }</tt></dt> <tt class="descname">menuSettings: { ... }</tt></dt>

View File

@ -66,13 +66,6 @@ section in your <tt class="xref py py-meth docutils literal"><span class="pre">M
</pre></div> </pre></div>
</div> </div>
<p>would set the <tt class="docutils literal"><span class="pre">preview</span></tt> parameter to <tt class="docutils literal"><span class="pre">&quot;none&quot;</span></tt>.</p> <p>would set the <tt class="docutils literal"><span class="pre">preview</span></tt> parameter to <tt class="docutils literal"><span class="pre">&quot;none&quot;</span></tt>.</p>
<dl class="describe">
<dt>
<tt class="descname">element: null</tt></dt>
<dd><p>The id name of the element that should be processed by <cite>jsMath2jax</cite>.
The default is the whole document.</p>
</dd></dl>
<dl class="describe"> <dl class="describe">
<dt> <dt>
<tt class="descname">preview: &quot;TeX&quot;</tt></dt> <tt class="descname">preview: &quot;TeX&quot;</tt></dt>

View File

@ -66,13 +66,6 @@ set any of these options, include a <tt class="docutils literal"><span class="pr
</pre></div> </pre></div>
</div> </div>
<p>would set the <tt class="docutils literal"><span class="pre">preview</span></tt> parameter to <tt class="docutils literal"><span class="pre">&quot;none&quot;</span></tt>.</p> <p>would set the <tt class="docutils literal"><span class="pre">preview</span></tt> parameter to <tt class="docutils literal"><span class="pre">&quot;none&quot;</span></tt>.</p>
<dl class="describe">
<dt>
<tt class="descname">element: null</tt></dt>
<dd><p>The id name of the element that should be processed by <cite>mml2jax</cite>.
The default is the whole document.</p>
</dd></dl>
<dl class="describe"> <dl class="describe">
<dt> <dt>
<tt class="descname">preview: &quot;alttext&quot;</tt></dt> <tt class="descname">preview: &quot;alttext&quot;</tt></dt>

View File

@ -67,13 +67,6 @@ set any of these options, include a <tt class="docutils literal"><span class="pr
</div> </div>
<p>would set the <tt class="docutils literal"><span class="pre">inlineMath</span></tt> delimiters for the <cite>tex2jax</cite> <p>would set the <tt class="docutils literal"><span class="pre">inlineMath</span></tt> delimiters for the <cite>tex2jax</cite>
preprocessor.</p> preprocessor.</p>
<dl class="describe">
<dt>
<tt class="descname">element: null</tt></dt>
<dd><p>The id name of the element that should be processed by <cite>tex2jax</cite>.
The default is the whole document.</p>
</dd></dl>
<dl class="describe"> <dl class="describe">
<dt> <dt>
<tt class="descname">inlineMath: [['\(','\)']]</tt></dt> <tt class="descname">inlineMath: [['\(','\)']]</tt></dt>

File diff suppressed because one or more lines are too long

View File

@ -187,24 +187,26 @@ Methods
.. Method:: Typeset([element[,callback]]) .. Method:: Typeset([element[,callback]])
Calls the preprocessors on the given element, and then typesets Calls the preprocessors on the given element (or elements if it is an
any math elements within the element. If no `element` is array of elements), and then typesets any math elements within the
provided, the whole document is processed. The `element` is element. If no `element` is provided, the whole document is processed.
either the DOM `id` of the element, or a reference to the DOM The `element` is either the DOM `id` of the element, a reference to
element itself. The `callback` is called when the process is the DOM element itself, or an array of id's or refereneces. The
complete. See the :ref:`Modifying Math <typeset-math>` section `callback` is called when the process is complete. See the
for details of how to use this method properly. :ref:`Modifying Math <typeset-math>` section for details of how to use
this method properly.
:Parameters: :Parameters:
- **element** --- the element whose math is to be typeset - **element** --- the element(s) whose math is to be typeset
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object
.. method:: PreProcess([element[,callback]]) .. method:: PreProcess([element[,callback]])
Calls the loaded preprocessors on the entire document, or on the Calls the loaded preprocessors on the entire document, or on the given
given DOM element. The `element` is either the DOM `id` of the DOM element (or elements, if it is an array of elements). The
element, or a reference to the DOM element itself. The `callback` `element` is either the DOM `id` of the element, a reference to the
DOM element itself, or an array of id's or references. The `callback`
is called when the processing is complete. is called when the processing is complete.
:Parameters: :Parameters:
@ -214,43 +216,44 @@ Methods
.. method:: Process([element[,callback]]) .. method:: Process([element[,callback]])
Scans either the entire document or a given DOM `element` for Scans either the entire document or a given DOM `element` (or array of
MathJax ``<script>`` tags and processes the math those tags elements) for MathJax ``<script>`` tags and processes the math those
contain. The `element` is either the DOM `id` of the element to tags contain. The `element` is either the DOM `id` of the element to
scan, or a reference to the DOM element itself. The `callback` is scan, a reference to the DOM element itself, or an array of id's or
called when the processing is complete. references. The `callback` is called when the processing is complete.
:Parameters: :Parameters:
- **element** --- the element to be processed - **element** --- the element(s) to be processed
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object
.. method:: Update([element[,callback]]) .. method:: Update([element[,callback]])
Scans either the entire document or a given DOM element for Scans either the entire document or a given DOM element (or elements if
mathematics that has changed since the last time it was processed, it is an array of elements) for mathematics that has changed since the
or is new, and typesets the mathematics they contain. The last time it was processed, or is new, and typesets the mathematics
`element` is either the DOM `id` of the element to scan, or a they contain. The `element` is either the DOM `id` of the element to
reference to the DOM element itself. The `callback` is called scan, a reference to the DOM element itself, or an array of id's or
when the processing is complete. references. The `callback` is called when the processing is complete.
:Parameters: :Parameters:
- **element** --- the element to be updated - **element** --- the element(s) to be updated
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object
.. method:: Reprocess([element[,callback]]) .. method:: Reprocess([element[,callback]])
Removes any typeset mathematics from the document or DOM Removes any typeset mathematics from the document or DOM element (or
element, and then processes the mathematics again, elements if it is an array of elements), and then processes the
re-typesetting everything. This may be necessary, for example, if mathematics again, re-typesetting everything. This may be necessary,
the CSS styles have changed and those changes would affect the for example, if the CSS styles have changed and those changes would
mathematics. The `element` is either the DOM `id` of the element affect the mathematics. The `element` is either the DOM `id` of the
to scan, or a reference to the DOM element itself. The `callback` element to scan, a reference to the DOM element itself, or an array of
is called when the processing is complete. id's or references. The `callback` is called when the processing is
complete.
:Parameters: :Parameters:
- **element** --- the element to be reprocessed - **element** --- the element(s) to be reprocessed
- **callback** --- the callback specification - **callback** --- the callback specification
:Returns: the callback object :Returns: the callback object

View File

@ -145,6 +145,16 @@ behavior of MathJax. They are given with their default values.
which case you will need to call :meth:`MathJax.Hub.Typeset()` which case you will need to call :meth:`MathJax.Hub.Typeset()`
yourself by hand, set this value to ``true``. yourself by hand, set this value to ``true``.
.. describe:: elements: []
This is a list of DOM element ID's that are the ones to process for
mathematics when any of the Hub typesetting calls (Typeset, Process,
Update, etc.) are called with no element specified, and during
MathJax's initial typesetting run when it starts up. This lets you
restrict the processing to particular containers rather than scanning
the entire document for mathematics. If none are supplied, the complete
document is processed.
.. describe:: menuSettings: { ... } .. describe:: menuSettings: { ... }
This block contains settings for the mathematics contextual menu This block contains settings for the mathematics contextual menu

View File

@ -20,12 +20,6 @@ section in your :meth:`MathJax.Hub.Config()` call. For example
would set the ``preview`` parameter to ``"none"``. would set the ``preview`` parameter to ``"none"``.
.. describe:: element: null
The id name of the element that should be processed by `jsMath2jax`.
The default is the whole document.
.. describe:: preview: "TeX" .. describe:: preview: "TeX"
This controls whether `jsMath2jax` inserts ``MathJax_Preview`` spans This controls whether `jsMath2jax` inserts ``MathJax_Preview`` spans

View File

@ -20,11 +20,6 @@ set any of these options, include a ``mml2jax`` section in your
would set the ``preview`` parameter to ``"none"``. would set the ``preview`` parameter to ``"none"``.
.. describe:: element: null
The id name of the element that should be processed by `mml2jax`.
The default is the whole document.
.. describe:: preview: "alttext" .. describe:: preview: "alttext"
This controls whether `mml2jax` inserts ``MathJax_Preview`` spans This controls whether `mml2jax` inserts ``MathJax_Preview`` spans

View File

@ -22,11 +22,6 @@ would set the ``inlineMath`` delimiters for the `tex2jax`
preprocessor. preprocessor.
.. describe:: element: null
The id name of the element that should be processed by `tex2jax`.
The default is the whole document.
.. describe:: inlineMath: [['\\\(','\\\)']] .. describe:: inlineMath: [['\\\(','\\\)']]
Array of pairs of strings that are to be used as in-line math Array of pairs of strings that are to be used as in-line math

View File

@ -12,5 +12,5 @@
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
*/ */
MathJax.Extension.jsMath2jax={version:"1.1",config:{element:null,preview:"TeX"},PreProcess:function(b){if(!this.configured){this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.previewClass=MathJax.Hub.config.preRemoveClass;this.configured=true}if(typeof(b)==="string"){b=document.getElementById(b)}if(!b){b=this.config.element||document.body}var c=b.getElementsByTagName("span"),a;for(a=c.length-1;a>=0;a--){if(String(c[a].className).match(/(^| )math( |$)/)){this.ConvertMath(c[a],"")}}var d=b.getElementsByTagName("div");for(a=d.length-1;a>=0;a--){if(String(d[a].className).match(/(^| )math( |$)/)){this.ConvertMath(d[a],"; mode=display")}}},ConvertMath:function(c,d){if(c.getElementsByTagName("script").length===0){var b=c.parentNode,a=this.createMathTag(d,c.innerHTML);if(c.nextSibling){b.insertBefore(a,c.nextSibling)}else{b.appendChild(a)}if(this.config.preview!=="none"){this.createPreview(c)}b.removeChild(c)}},createPreview:function(a){var b;if(this.config.preview==="TeX"){b=[this.filterTeX(a.innerHTML)]}else{if(this.config.preview instanceof Array){b=this.config.preview}}if(b){b=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},b);a.parentNode.insertBefore(b,a)}},createMathTag:function(c,b){b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);return a},filterTeX:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js"); MathJax.Extension.jsMath2jax={version:"1.1.1",config:{preview:"TeX"},PreProcess:function(b){if(!this.configured){this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.previewClass=MathJax.Hub.config.preRemoveClass;this.configured=true}if(typeof(b)==="string"){b=document.getElementById(b)}if(!b){b=document.body}var c=b.getElementsByTagName("span"),a;for(a=c.length-1;a>=0;a--){if(String(c[a].className).match(/(^| )math( |$)/)){this.ConvertMath(c[a],"")}}var d=b.getElementsByTagName("div");for(a=d.length-1;a>=0;a--){if(String(d[a].className).match(/(^| )math( |$)/)){this.ConvertMath(d[a],"; mode=display")}}},ConvertMath:function(c,d){if(c.getElementsByTagName("script").length===0){var b=c.parentNode,a=this.createMathTag(d,c.innerHTML);if(c.nextSibling){b.insertBefore(a,c.nextSibling)}else{b.appendChild(a)}if(this.config.preview!=="none"){this.createPreview(c)}b.removeChild(c)}},createPreview:function(a){var b;if(this.config.preview==="TeX"){b=[this.filterTeX(a.innerHTML)]}else{if(this.config.preview instanceof Array){b=this.config.preview}}if(b){b=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},b);a.parentNode.insertBefore(b,a)}},createMathTag:function(c,b){b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);return a},filterTeX:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js");

View File

@ -12,5 +12,5 @@
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
*/ */
MathJax.Extension.mml2jax={version:"1.1",config:{element:null,preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=this.config.element||document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d=document.getElementsByTagName("html")[0];if(d){for(var c=0,b=d.attributes.length;c<b;c++){var a=d.attributes[c];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.msieMathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.msieProcessMath(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.msieScriptBug){var b=this.msieOuterHTML(e);b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");MathJax.HTML.setScript(a,b.replace(/&nbsp;/g,"&#xA0;"));d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},msieProcessMath:function(e){var c=e.parentNode;var a=document.createElement("script");a.type="math/mml";c.insertBefore(a,e);var b="",d;while(e&&e.nodeName!=="/MATH"){d=e;e=e.nextSibling;b+=this.msieNodeHTML(d);d.parentNode.removeChild(d)}if(e&&e.nodeName==="/MATH"){e.parentNode.removeChild(e)}a.text=b+"</math>";if(this.config.preview!=="none"){this.createPreview(e,a)}},msieNodeHTML:function(d){var c,b,a;if(d.nodeName==="#text"){c=d.nodeValue.replace(/&/g,"&#x26;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}else{if(d.nodeName==="#comment"){c="<!--"+d.nodeValue+"-->"}else{if(this.msieAttributeBug){c="<"+d.nodeName.toLowerCase();for(b=0,a=d.attributes.length;b<a;b++){if(d.attributes[b].specified){c+=" "+d.attributes[b].nodeName.toLowerCase()+"=";c+='"'+d.attributes[b].nodeValue.replace(/\"/g,'\\"')+'"'}}c+=">"}else{c=this.toLowerCase(d.outerHTML);var e=c.split(/\"/);for(b=0,a=e.length;b<a;b+=2){e[b]=e[b].toLowerCase()}c=e.join('"')}}}return c},msieOuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.msieNodeHTML(d)}if(!this.msieAttributeBug){return d.outerHTML}var c=this.msieNodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.msieOuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterText(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterText:function(a){return a},InitBrowser:function(){MathJax.Hub.Browser.Select({MSIE:function(a){var b=MathJax.HTML.Element("span",{className:"mathjax"});MathJax.Hub.Insert(MathJax.Extension.mml2jax,{msieScriptBug:true,msieMathTagBug:(MathJax.HTML.Element("span",{innerHTML:"<math><mi>x</mi></math>"}).childNodes.length!==1),msieAttributeBug:(b.outerHTML.substr(12)!=='"')})}})}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js"); MathJax.Extension.mml2jax={version:"1.1.1",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d=document.getElementsByTagName("html")[0];if(d){for(var c=0,b=d.attributes.length;c<b;c++){var a=d.attributes[c];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.msieMathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.msieProcessMath(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.msieScriptBug){var b=this.msieOuterHTML(e);b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");MathJax.HTML.setScript(a,b.replace(/&nbsp;/g,"&#xA0;"));d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},msieProcessMath:function(e){var c=e.parentNode;var a=document.createElement("script");a.type="math/mml";c.insertBefore(a,e);var b="",d;while(e&&e.nodeName!=="/MATH"){d=e;e=e.nextSibling;b+=this.msieNodeHTML(d);d.parentNode.removeChild(d)}if(e&&e.nodeName==="/MATH"){e.parentNode.removeChild(e)}a.text=b+"</math>";if(this.config.preview!=="none"){this.createPreview(e,a)}},msieNodeHTML:function(d){var c,b,a;if(d.nodeName==="#text"){c=d.nodeValue.replace(/&/g,"&#x26;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}else{if(d.nodeName==="#comment"){c="<!--"+d.nodeValue+"-->"}else{if(this.msieAttributeBug){c="<"+d.nodeName.toLowerCase();for(b=0,a=d.attributes.length;b<a;b++){if(d.attributes[b].specified){c+=" "+d.attributes[b].nodeName.toLowerCase()+"=";c+='"'+d.attributes[b].nodeValue.replace(/\"/g,'\\"')+'"'}}c+=">"}else{c=this.toLowerCase(d.outerHTML);var e=c.split(/\"/);for(b=0,a=e.length;b<a;b+=2){e[b]=e[b].toLowerCase()}c=e.join('"')}}}return c},msieOuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.msieNodeHTML(d)}if(!this.msieAttributeBug){return d.outerHTML}var c=this.msieNodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.msieOuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterText(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterText:function(a){return a},InitBrowser:function(){MathJax.Hub.Browser.Select({MSIE:function(a){var b=MathJax.HTML.Element("span",{className:"mathjax"});MathJax.Hub.Insert(MathJax.Extension.mml2jax,{msieScriptBug:true,msieMathTagBug:(MathJax.HTML.Element("span",{innerHTML:"<math><mi>x</mi></math>"}).childNodes.length!==1),msieAttributeBug:(b.outerHTML.substr(12)!=='"')})}})}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ if (document.getElementById && document.childNodes && document.createElement) {
if (!window.MathJax) {window.MathJax= {}} if (!window.MathJax) {window.MathJax= {}}
if (!MathJax.Hub) { // skip if already loaded if (!MathJax.Hub) { // skip if already loaded
MathJax.version = "1.1"; MathJax.version = "1.1.1";
/**********************************************************/ /**********************************************************/
@ -1178,6 +1178,7 @@ MathJax.Hub = {
// set to a Callback to wait for before continuing with the startup // set to a Callback to wait for before continuing with the startup
skipStartupTypeset: false, // set to true to skip PreProcess and Process during startup skipStartupTypeset: false, // set to true to skip PreProcess and Process during startup
"v1.0-compatible": true, // set to false to prevent loading of default configuration file "v1.0-compatible": true, // set to false to prevent loading of default configuration file
elements: [], // array of elements to process when none is given explicitly
preProcessors: [], // list of callbacks for preprocessing (initialized by extensions) preProcessors: [], // list of callbacks for preprocessing (initialized by extensions)
inputJax: {}, // mime-type mapped to input jax (by registration) inputJax: {}, // mime-type mapped to input jax (by registration)
@ -1281,20 +1282,32 @@ MathJax.Hub = {
Typeset: function (element,callback) { Typeset: function (element,callback) {
if (!MathJax.isReady) return null; if (!MathJax.isReady) return null;
var ec = this.elementCallback(element,callback); var ec = this.elementCallback(element,callback);
return MathJax.Callback.Queue( var queue = MathJax.Callback.Queue();
["PreProcess",this,ec.element], for (var i = 0, m = ec.elements.length; i < m; i++) {
["Process",this,ec.element] if (ec.elements[i]) {
).Push(ec.callback); queue.Push(
["PreProcess",this,ec.elements[i]],
["Process",this,ec.elements[i]]
);
}
}
return queue.Push(ec.callback);
}, },
PreProcess: function (element,callback) { PreProcess: function (element,callback) {
var ec = this.elementCallback(element,callback); var ec = this.elementCallback(element,callback);
return MathJax.Callback.Queue( var queue = MathJax.Callback.Queue();
["Post",this.signal,"Begin PreProcess"], for (var i = 0, m = ec.elements.length; i < m; i++) {
if (ec.elements[i]) {
queue.Push(
["Post",this.signal,["Begin PreProcess",ec.elements[i]]],
["ExecuteHooks",MathJax.Callback, ["ExecuteHooks",MathJax.Callback,
(arguments.callee.disabled ? [] : this.config.preProcessors), ec.element, true], (arguments.callee.disabled ? [] : this.config.preProcessors), ec.elements[i], true],
["Post",this.signal,"End PreProcess"] ["Post",this.signal,["End PreProcess",ec.elements[i]]]
).Push(ec.callback); );
}
}
return queue.Push(ec.callback);
}, },
Process: function (element,callback) {return this.takeAction("Process",element,callback)}, Process: function (element,callback) {return this.takeAction("Process",element,callback)},
@ -1303,14 +1316,19 @@ MathJax.Hub = {
takeAction: function (action,element,callback) { takeAction: function (action,element,callback) {
var ec = this.elementCallback(element,callback); var ec = this.elementCallback(element,callback);
var queue = MathJax.Callback.Queue(["Clear",this.signal]);
for (var i = 0, m = ec.elements.length; i < m; i++) {
if (ec.elements[i]) {
var scripts = []; // filled in by prepareScripts var scripts = []; // filled in by prepareScripts
return MathJax.Callback.Queue( queue.Push(
["Clear",this.signal], ["Post",this.signal,["Begin "+action,ec.elements[i]]],
["Post",this.signal,["Begin "+action,ec.element]], ["prepareScripts",this,action,ec.elements[i],scripts],
["prepareScripts",this,action,ec.element,scripts],
["processScripts",this,scripts], ["processScripts",this,scripts],
["Post",this.signal,["End "+action,ec.element]] ["Post",this.signal,["End "+action,ec.elements[i]]]
).Push(ec.callback); );
}
}
return queue.Push(ec.callback);
}, },
scriptAction: { scriptAction: {
@ -1385,11 +1403,11 @@ MathJax.Hub = {
if (!start) {start = new Date().getTime()} if (!start) {start = new Date().getTime()}
var i = 0, script, prev; var i = 0, script, prev;
while (i < scripts.length) { while (i < scripts.length) {
script = scripts[i]; if (!script) continue; script = scripts[i]; if (!script) {i++; continue}
prev = script.previousSibling; prev = script.previousSibling;
if (prev && prev.className === "MathJax_Error") {prev.parentNode.removeChild(prev)} if (prev && prev.className === "MathJax_Error") {prev.parentNode.removeChild(prev)}
var type = script.type.replace(/ *;(.|\s)*/,""); var type = script.type.replace(/ *;(.|\s)*/,"");
if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) continue; if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) {i++; continue};
if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) { if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) {
this.checkScriptSiblings(script); this.checkScriptSiblings(script);
result = inputJax[type].Process(script); result = inputJax[type].Process(script);
@ -1444,12 +1462,15 @@ MathJax.Hub = {
elementCallback: function (element,callback) { elementCallback: function (element,callback) {
if (callback == null && (element instanceof Array || typeof element === 'function')) if (callback == null && (element instanceof Array || typeof element === 'function'))
{callback = element; element = document.body} {try {MathJax.Callback(element); callback = element; element = null} catch(e) {}}
else if (element == null) {element = document.body} if (element == null) {element = this.config.elements || []}
else if (typeof(element) === 'string') {element = document.getElementById(element)} if (!(element instanceof Array)) {element = [element]}
if (!element) {throw Error("No such element")} element = [].concat(element); // make a copy so the original isn't changed
for (var i = 0, m = element.length; i < m; i++)
{if (typeof(element[i]) === 'string') {element[i] = document.getElementById(element[i])}}
if (element.length == 0) {element.push(document.body)}
if (!callback) {callback = {}} if (!callback) {callback = {}}
return {element: element, callback: callback}; return {elements: element, callback: callback};
}, },
elementScripts: function (element) { elementScripts: function (element) {

View File

@ -174,6 +174,16 @@ MathJax.Hub.Config({
// //
skipStartupTypeset: false, skipStartupTypeset: false,
//
// A list of element ID's that are the ones to process for mathematics
// when any of the Hub typesetting calls (Typeset, Process, Update, etc)
// are called with no element specified. This lets you restrict the
// processing to particular containers rather than scanning the entire
// document for mathematics. If none are supplied, the entire document
// is processed.
//
elements: [],
//============================================================================ //============================================================================
// //
// These parameters control the tex2jax preprocessor (when you have included // These parameters control the tex2jax preprocessor (when you have included
@ -181,11 +191,6 @@ MathJax.Hub.Config({
// //
tex2jax: { tex2jax: {
//
// The Id of the element to be processed (defaults to full document)
//
element: null,
// //
// The delimiters that surround in-line math expressions. The first in each // The delimiters that surround in-line math expressions. The first in each
// pair is the initial delimiter and the second is the terminal delimiter. // pair is the initial delimiter and the second is the terminal delimiter.
@ -282,11 +287,6 @@ MathJax.Hub.Config({
// //
mml2jax: { mml2jax: {
//
// The Id of the element to be processed (defaults to full document)
//
element: null,
// //
// Controls whether mml2jax inserts MathJax_Preview spans to make a // Controls whether mml2jax inserts MathJax_Preview spans to make a
// preview available, and what preview to use, whrn it locates // preview available, and what preview to use, whrn it locates
@ -313,11 +313,6 @@ MathJax.Hub.Config({
// //
jsMath2jax: { jsMath2jax: {
//
// The Id of the element to be processed (defaults to full document)
//
element: null,
// //
// Controls whether jsMath2jax inserts MathJax_Preview spans to make a // Controls whether jsMath2jax inserts MathJax_Preview spans to make a
// preview available, and what preview to use, when it locates // preview available, and what preview to use, when it locates

View File

@ -31,12 +31,9 @@
*/ */
MathJax.Extension.jsMath2jax = { MathJax.Extension.jsMath2jax = {
version: "1.1", version: "1.1.1",
config: { config: {
element: null, // The ID of the element to be processed
// (defaults to full document)
preview: "TeX" // Set to "none" to prevent preview strings from being inserted preview: "TeX" // Set to "none" to prevent preview strings from being inserted
// or to an array that specifies an HTML snippet to use for // or to an array that specifies an HTML snippet to use for
// the preview. // the preview.
@ -52,7 +49,7 @@ MathJax.Extension.jsMath2jax = {
this.configured = true; this.configured = true;
} }
if (typeof(element) === "string") {element = document.getElementById(element)} if (typeof(element) === "string") {element = document.getElementById(element)}
if (!element) {element = this.config.element || document.body} if (!element) {element = document.body}
var span = element.getElementsByTagName("span"), i; var span = element.getElementsByTagName("span"), i;
for (i = span.length-1; i >= 0; i--) for (i = span.length-1; i >= 0; i--)
{if (String(span[i].className).match(/(^| )math( |$)/)) {this.ConvertMath(span[i],"")}} {if (String(span[i].className).match(/(^| )math( |$)/)) {this.ConvertMath(span[i],"")}}

View File

@ -24,11 +24,8 @@
*/ */
MathJax.Extension.mml2jax = { MathJax.Extension.mml2jax = {
version: "1.1", version: "1.1.1",
config: { config: {
element: null, // The ID of the element to be processed
// (defaults to full document)
preview: "alttext" // Use the <math> element's alttext as the preview: "alttext" // Use the <math> element's alttext as the
// preview. Set to "none" for no preview, // preview. Set to "none" for no preview,
// or set to an array specifying an HTML snippet // or set to an array specifying an HTML snippet
@ -45,7 +42,7 @@ MathJax.Extension.mml2jax = {
this.configured = true; this.configured = true;
} }
if (typeof(element) === "string") {element = document.getElementById(element)} if (typeof(element) === "string") {element = document.getElementById(element)}
if (!element) {element = this.config.element || document.body} if (!element) {element = document.body}
// //
// Handle all math tags with no namespaces // Handle all math tags with no namespaces
// //

View File

@ -24,11 +24,8 @@
*/ */
MathJax.Extension.tex2jax = { MathJax.Extension.tex2jax = {
version: "1.1.1", version: "1.1.2",
config: { config: {
element: null, // The ID of the element to be processed
// (defaults to full document)
inlineMath: [ // The start/stop pairs for in-line math inlineMath: [ // The start/stop pairs for in-line math
// ['$','$'], // (comment out any you don't want, or add your own, but // ['$','$'], // (comment out any you don't want, or add your own, but
['\\(','\\)'] // be sure that you don't have an extra comma at the end) ['\\(','\\)'] // be sure that you don't have an extra comma at the end)
@ -74,7 +71,7 @@ MathJax.Extension.tex2jax = {
this.configured = true; this.configured = true;
} }
if (typeof(element) === "string") {element = document.getElementById(element)} if (typeof(element) === "string") {element = document.getElementById(element)}
if (!element) {element = this.config.element || document.body} if (!element) {element = document.body}
this.createPatterns(); this.createPatterns();
this.scanElement(element,element.nextSibling); this.scanElement(element,element.nextSibling);
}, },