Improve documentation of options that include regular expressions (Fred's suggestion)

This commit is contained in:
Davide P. Cervone 2011-07-27 15:26:19 -04:00
parent da8d4885fb
commit 9cc6a284e2
8 changed files with 83 additions and 62 deletions

View File

@ -59,22 +59,23 @@ behavior of MathJax. They are given with their default values.
no space before it and the preceding text. In order to avoid no space before it and the preceding text. In order to avoid
this, you should include some "guard characters" before or after this, you should include some "guard characters" before or after
the math SCRIPT tag; define the patterns you want to use below. the math SCRIPT tag; define the patterns you want to use below.
Note that these are used as regular expressions, so you will need Note that these are used as part of a regular expression, so you
to quote special characters. Furthermore, since they are will need to quote special characters. Furthermore, since they
javascript strings, you must quote javascript special characters are javascript strings, you must quote javascript special
as well. So to obtain a backslash, you must use ``\\`` (doubled characters as well. So to obtain a backslash, you must use ``\\``
for javascript). For example, ``"\\["`` represents the pattern (doubled for javascript). For example, ``"\\["`` represents the
``\[`` in the regular expression. That means that if you want an pattern ``\[`` in the regular expression, or ``[`` in the text of
actual backslash in your guard characters, you need to use the web page. That means that if you want an actual backslash in
``"\\\\"`` in order to get ``\\`` in the regular expression, and your guard characters, you need to use ``"\\\\"`` in order to get
``\`` in the actual text. If both preJax and postJax are defined, ``\\`` in the regular expression, and ``\`` in the actual text.
both must be present in order to be removed. If both ``preJax`` and ``postJax`` are defined, both must be
present in order to be removed.
See also the ``preRemoveClass`` comments below. See also the ``preRemoveClass`` comments below.
Examples: Examples:
``preJax: "\\\\\\\\\"`` makes a double backslash the preJax text ``preJax: "\\\\\\\\\"`` makes a double backslash the ``preJax`` text
``preJax: "\\[\\[", postJax: "\\]\\]"`` makes it so jax ``preJax: "\\[\\[", postJax: "\\]\\]"`` makes it so jax
scripts must be enclosed in double brackets. scripts must be enclosed in double brackets.

View File

@ -113,11 +113,14 @@ preprocessor.
not be processed by tex2jax (other than to look for the not be processed by tex2jax (other than to look for the
``processClass`` pattern below). Note that this is a regular ``processClass`` pattern below). Note that this is a regular
expression, and so you need to be sure to quote any `regexp` expression, and so you need to be sure to quote any `regexp`
special characters. The pattern is automatically preceeded by special characters. The pattern is inserted into one that
``'(^| )('`` and followed by ``')( |$)'``, so your pattern will requires your pattern to match a complete word, so setting
have to match full words in the class name. Assigning an element ``ignoreClass: "class2"`` would cause it to match an element with
this class name will prevent `tex2jax` from processing its ``class="class1 class2 class3"``. Note that you can assign
contents. several classes by separating them by the vertical line character
(``|``). For instance, with ``ignoreClass: "class1|class2"``
any element assigned a class of either ``class1`` or ``class2``
will be skipped.
.. describe:: processClass: "tex2jax_process" .. describe:: processClass: "tex2jax_process"
@ -126,7 +129,10 @@ preprocessor.
processing within tags that have been marked as ignored or skipped processing within tags that have been marked as ignored or skipped
above. Note that this is a regular expression, and so you need to above. Note that this is a regular expression, and so you need to
be sure to quote any `regexp` special characters. The pattern is be sure to quote any `regexp` special characters. The pattern is
automatically preceeded by ``'(^| )('`` and followed by ``')( inserted into one that requires your pattern to match a complete
|$)'``, so your pattern will have to match full words in the class word, so setting ``processClass: "class2"`` would cause it to
name. Use this to restart processing within an element that has match an element with ``class="class1 class2 class3"``. Note that
been marked as ignored above. you can assign several classes by separating them by the vertical
line character (``|``). For instance, with ``processClass:
"class1|class2"`` any element assigned a class of either
``class1`` or ``class2`` will have its contents processed.

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 July 20, 2011.</p> <p>This version of the documentation was built July 27, 2011.</p>
</div> </div>
</div> </div>

View File

@ -116,20 +116,21 @@ MathJax inserts the typeset mathematics, this means there will be
no space before it and the preceding text. In order to avoid no space before it and the preceding text. In order to avoid
this, you should include some &#8220;guard characters&#8221; before or after this, you should include some &#8220;guard characters&#8221; before or after
the math SCRIPT tag; define the patterns you want to use below. the math SCRIPT tag; define the patterns you want to use below.
Note that these are used as regular expressions, so you will need Note that these are used as part of a regular expression, so you
to quote special characters. Furthermore, since they are will need to quote special characters. Furthermore, since they
javascript strings, you must quote javascript special characters are javascript strings, you must quote javascript special
as well. So to obtain a backslash, you must use <tt class="docutils literal"><span class="pre">\\</span></tt> (doubled characters as well. So to obtain a backslash, you must use <tt class="docutils literal"><span class="pre">\\</span></tt>
for javascript). For example, <tt class="docutils literal"><span class="pre">&quot;\\[&quot;</span></tt> represents the pattern (doubled for javascript). For example, <tt class="docutils literal"><span class="pre">&quot;\\[&quot;</span></tt> represents the
<tt class="docutils literal"><span class="pre">\[</span></tt> in the regular expression. That means that if you want an pattern <tt class="docutils literal"><span class="pre">\[</span></tt> in the regular expression, or <tt class="docutils literal"><span class="pre">[</span></tt> in the text of
actual backslash in your guard characters, you need to use the web page. That means that if you want an actual backslash in
<tt class="docutils literal"><span class="pre">&quot;\\\\&quot;</span></tt> in order to get <tt class="docutils literal"><span class="pre">\\</span></tt> in the regular expression, and your guard characters, you need to use <tt class="docutils literal"><span class="pre">&quot;\\\\&quot;</span></tt> in order to get
<tt class="docutils literal"><span class="pre">\</span></tt> in the actual text. If both preJax and postJax are defined, <tt class="docutils literal"><span class="pre">\\</span></tt> in the regular expression, and <tt class="docutils literal"><span class="pre">\</span></tt> in the actual text.
both must be present in order to be removed.</p> If both <tt class="docutils literal"><span class="pre">preJax</span></tt> and <tt class="docutils literal"><span class="pre">postJax</span></tt> are defined, both must be
present in order to be removed.</p>
<p>See also the <tt class="docutils literal"><span class="pre">preRemoveClass</span></tt> comments below.</p> <p>See also the <tt class="docutils literal"><span class="pre">preRemoveClass</span></tt> comments below.</p>
<p>Examples:</p> <p>Examples:</p>
<blockquote> <blockquote>
<div><p><tt class="docutils literal"><span class="pre">preJax:</span> <span class="pre">&quot;\\\\\\\\\&quot;</span></tt> makes a double backslash the preJax text</p> <div><p><tt class="docutils literal"><span class="pre">preJax:</span> <span class="pre">&quot;\\\\\\\\\&quot;</span></tt> makes a double backslash the <tt class="docutils literal"><span class="pre">preJax</span></tt> text</p>
<p><tt class="docutils literal"><span class="pre">preJax:</span> <span class="pre">&quot;\\[\\[&quot;,</span> <span class="pre">postJax:</span> <span class="pre">&quot;\\]\\]&quot;</span></tt> makes it so jax <p><tt class="docutils literal"><span class="pre">preJax:</span> <span class="pre">&quot;\\[\\[&quot;,</span> <span class="pre">postJax:</span> <span class="pre">&quot;\\]\\]&quot;</span></tt> makes it so jax
scripts must be enclosed in double brackets.</p> scripts must be enclosed in double brackets.</p>
</div></blockquote> </div></blockquote>

View File

@ -163,11 +163,14 @@ contexts.</p>
not be processed by tex2jax (other than to look for the not be processed by tex2jax (other than to look for the
<tt class="docutils literal"><span class="pre">processClass</span></tt> pattern below). Note that this is a regular <tt class="docutils literal"><span class="pre">processClass</span></tt> pattern below). Note that this is a regular
expression, and so you need to be sure to quote any <cite>regexp</cite> expression, and so you need to be sure to quote any <cite>regexp</cite>
special characters. The pattern is automatically preceeded by special characters. The pattern is inserted into one that
<tt class="docutils literal"><span class="pre">'(^|</span> <span class="pre">)('</span></tt> and followed by <tt class="docutils literal"><span class="pre">')(</span> <span class="pre">|$)'</span></tt>, so your pattern will requires your pattern to match a complete word, so setting
have to match full words in the class name. Assigning an element <tt class="docutils literal"><span class="pre">ignoreClass:</span> <span class="pre">&quot;class2&quot;</span></tt> would cause it to match an element with
this class name will prevent <cite>tex2jax</cite> from processing its <tt class="docutils literal"><span class="pre">class=&quot;class1</span> <span class="pre">class2</span> <span class="pre">class3&quot;</span></tt>. Note that you can assign
contents.</p> several classes by separating them by the vertical line character
(<tt class="docutils literal"><span class="pre">|</span></tt>). For instance, with <tt class="docutils literal"><span class="pre">ignoreClass:</span> <span class="pre">&quot;class1|class2&quot;</span></tt>
any element assigned a class of either <tt class="docutils literal"><span class="pre">class1</span></tt> or <tt class="docutils literal"><span class="pre">class2</span></tt>
will be skipped.</p>
</dd></dl> </dd></dl>
<dl class="describe"> <dl class="describe">
@ -178,10 +181,13 @@ contents.</p>
processing within tags that have been marked as ignored or skipped processing within tags that have been marked as ignored or skipped
above. Note that this is a regular expression, and so you need to above. Note that this is a regular expression, and so you need to
be sure to quote any <cite>regexp</cite> special characters. The pattern is be sure to quote any <cite>regexp</cite> special characters. The pattern is
automatically preceeded by <tt class="docutils literal"><span class="pre">'(^|</span> <span class="pre">)('</span></tt> and followed by <tt class="docutils literal"><span class="pre">')(</span> inserted into one that requires your pattern to match a complete
<span class="pre">|$)'</span></tt>, so your pattern will have to match full words in the class word, so setting <tt class="docutils literal"><span class="pre">processClass:</span> <span class="pre">&quot;class2&quot;</span></tt> would cause it to
name. Use this to restart processing within an element that has match an element with <tt class="docutils literal"><span class="pre">class=&quot;class1</span> <span class="pre">class2</span> <span class="pre">class3&quot;</span></tt>. Note that
been marked as ignored above.</p> you can assign several classes by separating them by the vertical
line character (<tt class="docutils literal"><span class="pre">|</span></tt>). For instance, with <tt class="docutils literal"><span class="pre">processClass:</span>
<span class="pre">&quot;class1|class2&quot;</span></tt> any element assigned a class of either
<tt class="docutils literal"><span class="pre">class1</span></tt> or <tt class="docutils literal"><span class="pre">class2</span></tt> will have its contents processed.</p>
</dd></dl> </dd></dl>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@ -59,22 +59,23 @@ behavior of MathJax. They are given with their default values.
no space before it and the preceding text. In order to avoid no space before it and the preceding text. In order to avoid
this, you should include some "guard characters" before or after this, you should include some "guard characters" before or after
the math SCRIPT tag; define the patterns you want to use below. the math SCRIPT tag; define the patterns you want to use below.
Note that these are used as regular expressions, so you will need Note that these are used as part of a regular expression, so you
to quote special characters. Furthermore, since they are will need to quote special characters. Furthermore, since they
javascript strings, you must quote javascript special characters are javascript strings, you must quote javascript special
as well. So to obtain a backslash, you must use ``\\`` (doubled characters as well. So to obtain a backslash, you must use ``\\``
for javascript). For example, ``"\\["`` represents the pattern (doubled for javascript). For example, ``"\\["`` represents the
``\[`` in the regular expression. That means that if you want an pattern ``\[`` in the regular expression, or ``[`` in the text of
actual backslash in your guard characters, you need to use the web page. That means that if you want an actual backslash in
``"\\\\"`` in order to get ``\\`` in the regular expression, and your guard characters, you need to use ``"\\\\"`` in order to get
``\`` in the actual text. If both preJax and postJax are defined, ``\\`` in the regular expression, and ``\`` in the actual text.
both must be present in order to be removed. If both ``preJax`` and ``postJax`` are defined, both must be
present in order to be removed.
See also the ``preRemoveClass`` comments below. See also the ``preRemoveClass`` comments below.
Examples: Examples:
``preJax: "\\\\\\\\\"`` makes a double backslash the preJax text ``preJax: "\\\\\\\\\"`` makes a double backslash the ``preJax`` text
``preJax: "\\[\\[", postJax: "\\]\\]"`` makes it so jax ``preJax: "\\[\\[", postJax: "\\]\\]"`` makes it so jax
scripts must be enclosed in double brackets. scripts must be enclosed in double brackets.

View File

@ -113,11 +113,14 @@ preprocessor.
not be processed by tex2jax (other than to look for the not be processed by tex2jax (other than to look for the
``processClass`` pattern below). Note that this is a regular ``processClass`` pattern below). Note that this is a regular
expression, and so you need to be sure to quote any `regexp` expression, and so you need to be sure to quote any `regexp`
special characters. The pattern is automatically preceeded by special characters. The pattern is inserted into one that
``'(^| )('`` and followed by ``')( |$)'``, so your pattern will requires your pattern to match a complete word, so setting
have to match full words in the class name. Assigning an element ``ignoreClass: "class2"`` would cause it to match an element with
this class name will prevent `tex2jax` from processing its ``class="class1 class2 class3"``. Note that you can assign
contents. several classes by separating them by the vertical line character
(``|``). For instance, with ``ignoreClass: "class1|class2"``
any element assigned a class of either ``class1`` or ``class2``
will be skipped.
.. describe:: processClass: "tex2jax_process" .. describe:: processClass: "tex2jax_process"
@ -126,7 +129,10 @@ preprocessor.
processing within tags that have been marked as ignored or skipped processing within tags that have been marked as ignored or skipped
above. Note that this is a regular expression, and so you need to above. Note that this is a regular expression, and so you need to
be sure to quote any `regexp` special characters. The pattern is be sure to quote any `regexp` special characters. The pattern is
automatically preceeded by ``'(^| )('`` and followed by ``')( inserted into one that requires your pattern to match a complete
|$)'``, so your pattern will have to match full words in the class word, so setting ``processClass: "class2"`` would cause it to
name. Use this to restart processing within an element that has match an element with ``class="class1 class2 class3"``. Note that
been marked as ignored above. you can assign several classes by separating them by the vertical
line character (``|``). For instance, with ``processClass:
"class1|class2"`` any element assigned a class of either
``class1`` or ``class2`` will have its contents processed.