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
this, you should include some "guard characters" before or after
the math SCRIPT tag; define the patterns you want to use below.
Note that these are used as regular expressions, so you will need
to quote special characters. Furthermore, since they are
javascript strings, you must quote javascript special characters
as well. So to obtain a backslash, you must use ``\\`` (doubled
for javascript). For example, ``"\\["`` represents the pattern
``\[`` in the regular expression. That means that if you want an
actual backslash in your guard characters, you need to use
``"\\\\"`` in order to get ``\\`` in the regular expression, and
``\`` in the actual text. If both preJax and postJax are defined,
both must be present in order to be removed.
Note that these are used as part of a regular expression, so you
will need to quote special characters. Furthermore, since they
are javascript strings, you must quote javascript special
characters as well. So to obtain a backslash, you must use ``\\``
(doubled for javascript). For example, ``"\\["`` represents the
pattern ``\[`` in the regular expression, or ``[`` in the text of
the web page. That means that if you want an actual backslash in
your guard characters, you need to use ``"\\\\"`` in order to get
``\\`` in the regular expression, and ``\`` in the actual text.
If both ``preJax`` and ``postJax`` are defined, both must be
present in order to be removed.
See also the ``preRemoveClass`` comments below.
Examples:
``preJax: "\\\\\\\\\"`` makes a double backslash the preJax text
``preJax: "\\\\\\\\\"`` makes a double backslash the ``preJax`` text
``preJax: "\\[\\[", postJax: "\\]\\]"`` makes it so jax
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
``processClass`` pattern below). Note that this is a regular
expression, and so you need to be sure to quote any `regexp`
special characters. The pattern is automatically preceeded by
``'(^| )('`` and followed by ``')( |$)'``, so your pattern will
have to match full words in the class name. Assigning an element
this class name will prevent `tex2jax` from processing its
contents.
special characters. The pattern is inserted into one that
requires your pattern to match a complete word, so setting
``ignoreClass: "class2"`` would cause it to match an element with
``class="class1 class2 class3"``. Note that you can assign
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"
@ -126,7 +129,10 @@ preprocessor.
processing within tags that have been marked as ignored or skipped
above. Note that this is a regular expression, and so you need to
be sure to quote any `regexp` special characters. The pattern is
automatically preceeded by ``'(^| )('`` and followed by ``')(
|$)'``, so your pattern will have to match full words in the class
name. Use this to restart processing within an element that has
been marked as ignored above.
inserted into one that requires your pattern to match a complete
word, so setting ``processClass: "class2"`` would cause it to
match an element with ``class="class1 class2 class3"``. Note that
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>
</ul>
<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>

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
this, you should include some &#8220;guard characters&#8221; before or after
the math SCRIPT tag; define the patterns you want to use below.
Note that these are used as regular expressions, so you will need
to quote special characters. Furthermore, since they are
javascript strings, you must quote javascript special characters
as well. So to obtain a backslash, you must use <tt class="docutils literal"><span class="pre">\\</span></tt> (doubled
for javascript). For example, <tt class="docutils literal"><span class="pre">&quot;\\[&quot;</span></tt> represents the pattern
<tt class="docutils literal"><span class="pre">\[</span></tt> in the regular expression. That means that if you want an
actual backslash in 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 regular expression, and
<tt class="docutils literal"><span class="pre">\</span></tt> in the actual text. If both preJax and postJax are defined,
both must be present in order to be removed.</p>
Note that these are used as part of a regular expression, so you
will need to quote special characters. Furthermore, since they
are javascript strings, you must quote javascript special
characters as well. So to obtain a backslash, you must use <tt class="docutils literal"><span class="pre">\\</span></tt>
(doubled for javascript). For example, <tt class="docutils literal"><span class="pre">&quot;\\[&quot;</span></tt> represents the
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
the web page. That means that if you want an actual backslash in
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 regular expression, and <tt class="docutils literal"><span class="pre">\</span></tt> in the actual text.
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>Examples:</p>
<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
scripts must be enclosed in double brackets.</p>
</div></blockquote>

View File

@ -163,11 +163,14 @@ contexts.</p>
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
expression, and so you need to 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> <span class="pre">|$)'</span></tt>, so your pattern will
have to match full words in the class name. Assigning an element
this class name will prevent <cite>tex2jax</cite> from processing its
contents.</p>
special characters. The pattern is inserted into one that
requires your pattern to match a complete word, so setting
<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
<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
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>
<dl class="describe">
@ -178,10 +181,13 @@ contents.</p>
processing within tags that have been marked as ignored or skipped
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
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>
<span class="pre">|$)'</span></tt>, so your pattern will have to match full words in the class
name. Use this to restart processing within an element that has
been marked as ignored above.</p>
inserted into one that requires your pattern to match a complete
word, so setting <tt class="docutils literal"><span class="pre">processClass:</span> <span class="pre">&quot;class2&quot;</span></tt> would cause it to
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
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>
</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
this, you should include some "guard characters" before or after
the math SCRIPT tag; define the patterns you want to use below.
Note that these are used as regular expressions, so you will need
to quote special characters. Furthermore, since they are
javascript strings, you must quote javascript special characters
as well. So to obtain a backslash, you must use ``\\`` (doubled
for javascript). For example, ``"\\["`` represents the pattern
``\[`` in the regular expression. That means that if you want an
actual backslash in your guard characters, you need to use
``"\\\\"`` in order to get ``\\`` in the regular expression, and
``\`` in the actual text. If both preJax and postJax are defined,
both must be present in order to be removed.
Note that these are used as part of a regular expression, so you
will need to quote special characters. Furthermore, since they
are javascript strings, you must quote javascript special
characters as well. So to obtain a backslash, you must use ``\\``
(doubled for javascript). For example, ``"\\["`` represents the
pattern ``\[`` in the regular expression, or ``[`` in the text of
the web page. That means that if you want an actual backslash in
your guard characters, you need to use ``"\\\\"`` in order to get
``\\`` in the regular expression, and ``\`` in the actual text.
If both ``preJax`` and ``postJax`` are defined, both must be
present in order to be removed.
See also the ``preRemoveClass`` comments below.
Examples:
``preJax: "\\\\\\\\\"`` makes a double backslash the preJax text
``preJax: "\\\\\\\\\"`` makes a double backslash the ``preJax`` text
``preJax: "\\[\\[", postJax: "\\]\\]"`` makes it so jax
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
``processClass`` pattern below). Note that this is a regular
expression, and so you need to be sure to quote any `regexp`
special characters. The pattern is automatically preceeded by
``'(^| )('`` and followed by ``')( |$)'``, so your pattern will
have to match full words in the class name. Assigning an element
this class name will prevent `tex2jax` from processing its
contents.
special characters. The pattern is inserted into one that
requires your pattern to match a complete word, so setting
``ignoreClass: "class2"`` would cause it to match an element with
``class="class1 class2 class3"``. Note that you can assign
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"
@ -126,7 +129,10 @@ preprocessor.
processing within tags that have been marked as ignored or skipped
above. Note that this is a regular expression, and so you need to
be sure to quote any `regexp` special characters. The pattern is
automatically preceeded by ``'(^| )('`` and followed by ``')(
|$)'``, so your pattern will have to match full words in the class
name. Use this to restart processing within an element that has
been marked as ignored above.
inserted into one that requires your pattern to match a complete
word, so setting ``processClass: "class2"`` would cause it to
match an element with ``class="class1 class2 class3"``. Note that
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.