Mock the response from the snuggletex server, and unskip the SymbolicResponse test.
This commit is contained in:
480
common/lib/capa/capa/tests/test_files/snuggletex_correct.html
Normal file
480
common/lib/capa/capa/tests/test_files/snuggletex_correct.html
Normal file
@@ -0,0 +1,480 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<meta content="application/xhtml+xml; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<meta content="SnuggleTeX" name="Generator" />
|
||||
<meta content="SnuggleTeX Documentation" name="description" />
|
||||
<meta content="David McKain" name="author" />
|
||||
<meta content="The University of Edinburgh" name="publisher" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/core.css" rel="stylesheet" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/webapp.css" rel="stylesheet" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/snuggletex.css" rel="stylesheet" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/jquery-ui-1.7.2.custom.css"
|
||||
rel="stylesheet" /><script src="/snuggletex-webapp-1.2.2/includes/jquery.js" type="text/javascript"></script><script src="/snuggletex-webapp-1.2.2/includes/jquery-ui-1.7.2.custom.js"
|
||||
type="text/javascript"></script><script src="/snuggletex-webapp-1.2.2/includes/webapp.js" type="text/javascript"></script><title>SnuggleTeX - ASCIIMathML Enrichment Demo</title><script src="/snuggletex-webapp-1.2.2/includes/ASCIIMathML.js" type="text/javascript"></script><script src="/snuggletex-webapp-1.2.2/includes/ASCIIMathMLwidget.js"
|
||||
type="text/javascript"></script></head>
|
||||
<body id="asciiMathMLUpConversionDemo">
|
||||
<table border="0" cellpadding="0" cellspacing="0" id="header" width="100%">
|
||||
<tr>
|
||||
<td align="left" id="logo" valign="top"><a class="headertext" href="http://www.ed.ac.uk"><img alt="The University of Edinburgh" height="84"
|
||||
src="/snuggletex-webapp-1.2.2/includes/uoe_logo.jpg"
|
||||
width="84" /></a></td>
|
||||
<td align="left">
|
||||
<h3>THE UNIVERSITY of EDINBURGH</h3>
|
||||
<h1>SCHOOL OF PHYSICS AND ASTRONOMY</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1 id="location"><a href="/snuggletex-webapp-1.2.2">SnuggleTeX (1.2.2)</a></h1>
|
||||
<div id="content">
|
||||
<div id="skipnavigation"><a href="#maincontent">Skip Navigation</a></div>
|
||||
<div id="navigation">
|
||||
<div id="navinner">
|
||||
<h2>About SnuggleTeX</h2>
|
||||
<ul>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/overview-and-features.html">Overview & Features</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/use-cases.html">Why Use SnuggleTeX?</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/license.html">License</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/release-notes.html">Release Notes</a></li>
|
||||
</ul>
|
||||
<h2>Demos & Samples</h2>
|
||||
<ul>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/MathInputDemo">Simple Math Input Demo</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/FullLaTeXInputDemo">Full LaTeX Input Demo</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/UpConversionDemo">MathML Semantic Enrichment Demo</a></li>
|
||||
<li><a class="selected" href="/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo">ASCIIMathML Enrichment Demo</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/web-output-samples.html">Web Output Samples</a></li>
|
||||
</ul>
|
||||
<h2>User Guide</h2>
|
||||
<ul>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/getting-snuggletex.html">Getting SnuggleTeX</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/software-requirements.html">Software Requirements</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/your-classpath.html">Setting up Your ClassPath</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/examples.html">Examples</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/basic-usage.html">Basic Usage</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/inputs.html">Parsing LaTeX Inputs</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/xml-or-dom-output.html">Creating XML String or DOM Outputs</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/web-output.html">Creating Web Pages</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/error-reporting.html">Error Reporting</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/supported-latex.html">Supported LaTeX</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/advanced-usage.html">Advanced Usage</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/semantic-enrichment.html">Semantic Enrichment</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/migrating-from-older-versions.html">Migrating from older versions</a></li>
|
||||
<li><a href="http://snuggletex.sourceforge.net/maven/apidocs/index.html">API Documentation<span class="extlink"> </span></a></li>
|
||||
<li><a href="http://snuggletex.sourceforge.net/maven/xref/index.html">Source Code Cross-Reference<span class="extlink"> </span></a></li>
|
||||
</ul>
|
||||
<h2>SnuggleTeX Project Links</h2>
|
||||
<ul>
|
||||
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=221375">Download from SourceForge.net<span class="extlink"> </span></a></li>
|
||||
<li><a href="http://sourceforge.net/projects/snuggletex/">SnuggleTeX on SourceForge.net<span class="extlink"> </span></a></li>
|
||||
<li><a href="http://snuggletex.sourceforge.net/maven/">SnuggleTeX Maven Developer Reports<span class="extlink"> </span></a></li>
|
||||
<li><a href="https://www.wiki.ed.ac.uk/display/Physics/SnuggleTeX">SnuggleTeX Wiki<span class="extlink"> </span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="maincontent">
|
||||
<div id="popup"></div>
|
||||
<div id="maininner">
|
||||
<h2>ASCIIMathML Enrichment Demo</h2>
|
||||
<h3>Input</h3>
|
||||
<p>
|
||||
This demo is similar to the
|
||||
<a href="/snuggletex-webapp-1.2.2/UpConversionDemo">MathML Semantic Enrichnment Demo</a>
|
||||
but uses
|
||||
<a href="http://www1.chapman.edu/~jipsen/asciimath.html">ASCIIMathML</a> as
|
||||
an alternative input format, which provides real-time feedback as you
|
||||
type but can often generate MathML with odd semantics in it.
|
||||
SnuggleTeX includes some functionality that can to convert this raw MathML into
|
||||
something equivalent to its own MathML output, thereby allowing you to
|
||||
<a href="/snuggletex-webapp-1.2.2/documentation/semantic-enrichment.html">semantically enrich</a> it in
|
||||
certain simple cases, making ASCIIMathML a possibly viable input format
|
||||
for simple semantic maths.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
To try the demo, simply enter some some ASCIIMathML into the box below.
|
||||
You should see a real time preview of this while you type.
|
||||
Then hit <tt>Go!</tt> to use SnuggleTeX to semantically enrich your
|
||||
input.
|
||||
|
||||
</p>
|
||||
<form action="/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo" class="input"
|
||||
method="post">
|
||||
<div class="inputBox">
|
||||
ASCIIMath Input:
|
||||
<input id="asciiMathInput" name="asciiMathInput" type="text" value="" /><input id="asciiMathML" name="asciiMathML" type="hidden" /><input type="submit" value="Go!" /></div>
|
||||
</form>
|
||||
<h3>Live Preview</h3>
|
||||
<p>
|
||||
This is a MathML rendering of your input, generated by ASCIIMathML as you type.
|
||||
|
||||
</p>
|
||||
<div class="result">
|
||||
<div id="preview"> </div>
|
||||
</div>
|
||||
<p>
|
||||
This is the underlying MathML source generated by ASCIIMathML, again updated in real time.
|
||||
|
||||
</p>
|
||||
<div class="result"><pre id="previewSource"> </pre></div><script type="text/javascript">
|
||||
registerASCIIMathMLInputWidget('asciiMathInput', 'preview', 'asciiMathML', 'previewSource');
|
||||
var inputChanged = false;
|
||||
// Hide any existing output stuff in page on first change, as it will no longer be in sync
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#asciiMathInput').bind('keydown', function() {
|
||||
if (!inputChanged) jQuery('.outputContainer').css('visibility', 'hidden');
|
||||
inputChanged = true;
|
||||
});
|
||||
});
|
||||
</script><div class="outputContainer">
|
||||
<h3>Enhanced Presentation MathML</h3>
|
||||
<p>
|
||||
This shows the result of attempting to enrich the raw Presentation MathML
|
||||
generated by ASCIIMathML:
|
||||
|
||||
</p><pre class="result"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mrow>
|
||||
<mrow>
|
||||
<mrow>
|
||||
<mi>cos</mi>
|
||||
<mo>&ApplyFunction;</mo>
|
||||
<mfenced close=")" open="(">
|
||||
<mi>theta</mi>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
<mo>&sdot;</mo>
|
||||
<mfenced close="]" open="[">
|
||||
<mtable>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
<mo>+</mo>
|
||||
<mrow>
|
||||
<mi>i</mi>
|
||||
<mo>&sdot;</mo>
|
||||
<mrow>
|
||||
<mi>sin</mi>
|
||||
<mo>&ApplyFunction;</mo>
|
||||
<mfenced close=")" open="(">
|
||||
<mi>theta</mi>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
<mo>&sdot;</mo>
|
||||
<mfenced close="]" open="[">
|
||||
<mtable>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math></pre><h3>Content MathML</h3>
|
||||
<p>
|
||||
This shows the result of an attempted
|
||||
<a href="documentation/content-mathml.html">conversion to Content MathML</a>:
|
||||
|
||||
</p><pre class="result"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<apply>
|
||||
<plus/>
|
||||
<apply>
|
||||
<times/>
|
||||
<apply>
|
||||
<cos/>
|
||||
<ci>theta</ci>
|
||||
</apply>
|
||||
<list>
|
||||
<matrix>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
</matrix>
|
||||
</list>
|
||||
</apply>
|
||||
<apply>
|
||||
<times/>
|
||||
<ci>i</ci>
|
||||
<apply>
|
||||
<sin/>
|
||||
<ci>theta</ci>
|
||||
</apply>
|
||||
<list>
|
||||
<matrix>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
</matrix>
|
||||
</list>
|
||||
</apply>
|
||||
</apply>
|
||||
</math></pre><h3>Maxima Input Form</h3>
|
||||
<p>
|
||||
This shows the result of an attempted
|
||||
<a href="documentation/maxima-input.html">conversion to Maxima Input syntax</a>:
|
||||
|
||||
</p>
|
||||
<p>
|
||||
The conversion from Content MathML to Maxima Input was not successful for
|
||||
this input.
|
||||
|
||||
</p>
|
||||
<table class="failures">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Failure Code</th>
|
||||
<th>Message</th>
|
||||
<th>XPath</th>
|
||||
<th>Context</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="/snuggletex-webapp-1.2.2/documentation/error-codes.html#UMFG00">UMFG00</a></td>
|
||||
<td>Content MathML element matrix not supported</td>
|
||||
<td>apply[1]/apply[1]/list[1]/matrix[1]</td>
|
||||
<td><pre><matrix>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
</matrix></pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/snuggletex-webapp-1.2.2/documentation/error-codes.html#UMFG00">UMFG00</a></td>
|
||||
<td>Content MathML element matrix not supported</td>
|
||||
<td>apply[1]/apply[2]/list[1]/matrix[1]</td>
|
||||
<td><pre><matrix>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
</matrix></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>MathML Parallel Markup</h3>
|
||||
<p>
|
||||
This shows the enhanced Presentation MathML with other forms encapsulated
|
||||
as annotations:
|
||||
|
||||
</p><pre class="result"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics>
|
||||
<mrow>
|
||||
<mrow>
|
||||
<mrow>
|
||||
<mi>cos</mi>
|
||||
<mo>&ApplyFunction;</mo>
|
||||
<mfenced close=")" open="(">
|
||||
<mi>theta</mi>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
<mo>&sdot;</mo>
|
||||
<mfenced close="]" open="[">
|
||||
<mtable>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
<mo>+</mo>
|
||||
<mrow>
|
||||
<mi>i</mi>
|
||||
<mo>&sdot;</mo>
|
||||
<mrow>
|
||||
<mi>sin</mi>
|
||||
<mo>&ApplyFunction;</mo>
|
||||
<mfenced close=")" open="(">
|
||||
<mi>theta</mi>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
<mo>&sdot;</mo>
|
||||
<mfenced close="]" open="[">
|
||||
<mtable>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
</mfenced>
|
||||
</mrow>
|
||||
</mrow>
|
||||
<annotation-xml encoding="MathML-Content">
|
||||
<apply>
|
||||
<plus/>
|
||||
<apply>
|
||||
<times/>
|
||||
<apply>
|
||||
<cos/>
|
||||
<ci>theta</ci>
|
||||
</apply>
|
||||
<list>
|
||||
<matrix>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
</matrix>
|
||||
</list>
|
||||
</apply>
|
||||
<apply>
|
||||
<times/>
|
||||
<ci>i</ci>
|
||||
<apply>
|
||||
<sin/>
|
||||
<ci>theta</ci>
|
||||
</apply>
|
||||
<list>
|
||||
<matrix>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
</matrix>
|
||||
</list>
|
||||
</apply>
|
||||
</apply>
|
||||
</annotation-xml>
|
||||
<annotation encoding="ASCIIMathInput"/>
|
||||
<annotation-xml encoding="Maxima-upconversion-failures">
|
||||
<s:fail xmlns:s="http://www.ph.ed.ac.uk/snuggletex" code="UMFG00"
|
||||
message="Content MathML element matrix not supported">
|
||||
<s:arg>matrix</s:arg>
|
||||
<s:xpath>apply[1]/apply[1]/list[1]/matrix[1]</s:xpath>
|
||||
<s:context>
|
||||
<matrix>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
</matrix>
|
||||
</s:context>
|
||||
</s:fail>
|
||||
<s:fail xmlns:s="http://www.ph.ed.ac.uk/snuggletex" code="UMFG00"
|
||||
message="Content MathML element matrix not supported">
|
||||
<s:arg>matrix</s:arg>
|
||||
<s:xpath>apply[1]/apply[2]/list[1]/matrix[1]</s:xpath>
|
||||
<s:context>
|
||||
<matrix>
|
||||
<vector>
|
||||
<cn>0</cn>
|
||||
<cn>1</cn>
|
||||
</vector>
|
||||
<vector>
|
||||
<cn>1</cn>
|
||||
<cn>0</cn>
|
||||
</vector>
|
||||
</matrix>
|
||||
</s:context>
|
||||
</s:fail>
|
||||
</annotation-xml>
|
||||
</semantics>
|
||||
</math></pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="copyright">
|
||||
<p>
|
||||
SnuggleTeX Release 1.2.2 —
|
||||
<a href="/snuggletex-webapp-1.2.2/documentation/release-notes.html">Release Notes</a><br />
|
||||
Copyright © 2009
|
||||
<a href="http://www.ph.ed.ac.uk">The School of Physics and Astronomy</a>,
|
||||
<a href="http://www.ed.ac.uk">The University of Edinburgh</a>.
|
||||
<br />
|
||||
For more information, contact
|
||||
<a href="http://www.ph.ed.ac.uk/elearning/contacts/#dmckain">David McKain</a>.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
The University of Edinburgh is a charitable body, registered in Scotland,
|
||||
with registration number SC005336.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
187
common/lib/capa/capa/tests/test_files/snuggletex_wrong.html
Normal file
187
common/lib/capa/capa/tests/test_files/snuggletex_wrong.html
Normal file
@@ -0,0 +1,187 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<meta content="application/xhtml+xml; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<meta content="SnuggleTeX" name="Generator" />
|
||||
<meta content="SnuggleTeX Documentation" name="description" />
|
||||
<meta content="David McKain" name="author" />
|
||||
<meta content="The University of Edinburgh" name="publisher" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/core.css" rel="stylesheet" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/webapp.css" rel="stylesheet" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/snuggletex.css" rel="stylesheet" />
|
||||
<link href="/snuggletex-webapp-1.2.2/includes/jquery-ui-1.7.2.custom.css"
|
||||
rel="stylesheet" /><script src="/snuggletex-webapp-1.2.2/includes/jquery.js" type="text/javascript"></script><script src="/snuggletex-webapp-1.2.2/includes/jquery-ui-1.7.2.custom.js"
|
||||
type="text/javascript"></script><script src="/snuggletex-webapp-1.2.2/includes/webapp.js" type="text/javascript"></script><title>SnuggleTeX - ASCIIMathML Enrichment Demo</title><script src="/snuggletex-webapp-1.2.2/includes/ASCIIMathML.js" type="text/javascript"></script><script src="/snuggletex-webapp-1.2.2/includes/ASCIIMathMLwidget.js"
|
||||
type="text/javascript"></script></head>
|
||||
<body id="asciiMathMLUpConversionDemo">
|
||||
<table border="0" cellpadding="0" cellspacing="0" id="header" width="100%">
|
||||
<tr>
|
||||
<td align="left" id="logo" valign="top"><a class="headertext" href="http://www.ed.ac.uk"><img alt="The University of Edinburgh" height="84"
|
||||
src="/snuggletex-webapp-1.2.2/includes/uoe_logo.jpg"
|
||||
width="84" /></a></td>
|
||||
<td align="left">
|
||||
<h3>THE UNIVERSITY of EDINBURGH</h3>
|
||||
<h1>SCHOOL OF PHYSICS AND ASTRONOMY</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1 id="location"><a href="/snuggletex-webapp-1.2.2">SnuggleTeX (1.2.2)</a></h1>
|
||||
<div id="content">
|
||||
<div id="skipnavigation"><a href="#maincontent">Skip Navigation</a></div>
|
||||
<div id="navigation">
|
||||
<div id="navinner">
|
||||
<h2>About SnuggleTeX</h2>
|
||||
<ul>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/overview-and-features.html">Overview & Features</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/use-cases.html">Why Use SnuggleTeX?</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/license.html">License</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/release-notes.html">Release Notes</a></li>
|
||||
</ul>
|
||||
<h2>Demos & Samples</h2>
|
||||
<ul>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/MathInputDemo">Simple Math Input Demo</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/FullLaTeXInputDemo">Full LaTeX Input Demo</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/UpConversionDemo">MathML Semantic Enrichment Demo</a></li>
|
||||
<li><a class="selected" href="/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo">ASCIIMathML Enrichment Demo</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/web-output-samples.html">Web Output Samples</a></li>
|
||||
</ul>
|
||||
<h2>User Guide</h2>
|
||||
<ul>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/getting-snuggletex.html">Getting SnuggleTeX</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/software-requirements.html">Software Requirements</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/your-classpath.html">Setting up Your ClassPath</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/examples.html">Examples</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/basic-usage.html">Basic Usage</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/inputs.html">Parsing LaTeX Inputs</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/xml-or-dom-output.html">Creating XML String or DOM Outputs</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/web-output.html">Creating Web Pages</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/error-reporting.html">Error Reporting</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/supported-latex.html">Supported LaTeX</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/advanced-usage.html">Advanced Usage</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/semantic-enrichment.html">Semantic Enrichment</a></li>
|
||||
<li><a href="/snuggletex-webapp-1.2.2/documentation/migrating-from-older-versions.html">Migrating from older versions</a></li>
|
||||
<li><a href="http://snuggletex.sourceforge.net/maven/apidocs/index.html">API Documentation<span class="extlink"> </span></a></li>
|
||||
<li><a href="http://snuggletex.sourceforge.net/maven/xref/index.html">Source Code Cross-Reference<span class="extlink"> </span></a></li>
|
||||
</ul>
|
||||
<h2>SnuggleTeX Project Links</h2>
|
||||
<ul>
|
||||
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=221375">Download from SourceForge.net<span class="extlink"> </span></a></li>
|
||||
<li><a href="http://sourceforge.net/projects/snuggletex/">SnuggleTeX on SourceForge.net<span class="extlink"> </span></a></li>
|
||||
<li><a href="http://snuggletex.sourceforge.net/maven/">SnuggleTeX Maven Developer Reports<span class="extlink"> </span></a></li>
|
||||
<li><a href="https://www.wiki.ed.ac.uk/display/Physics/SnuggleTeX">SnuggleTeX Wiki<span class="extlink"> </span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="maincontent">
|
||||
<div id="popup"></div>
|
||||
<div id="maininner">
|
||||
<h2>ASCIIMathML Enrichment Demo</h2>
|
||||
<h3>Input</h3>
|
||||
<p>
|
||||
This demo is similar to the
|
||||
<a href="/snuggletex-webapp-1.2.2/UpConversionDemo">MathML Semantic Enrichnment Demo</a>
|
||||
but uses
|
||||
<a href="http://www1.chapman.edu/~jipsen/asciimath.html">ASCIIMathML</a> as
|
||||
an alternative input format, which provides real-time feedback as you
|
||||
type but can often generate MathML with odd semantics in it.
|
||||
SnuggleTeX includes some functionality that can to convert this raw MathML into
|
||||
something equivalent to its own MathML output, thereby allowing you to
|
||||
<a href="/snuggletex-webapp-1.2.2/documentation/semantic-enrichment.html">semantically enrich</a> it in
|
||||
certain simple cases, making ASCIIMathML a possibly viable input format
|
||||
for simple semantic maths.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
To try the demo, simply enter some some ASCIIMathML into the box below.
|
||||
You should see a real time preview of this while you type.
|
||||
Then hit <tt>Go!</tt> to use SnuggleTeX to semantically enrich your
|
||||
input.
|
||||
|
||||
</p>
|
||||
<form action="/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo" class="input"
|
||||
method="post">
|
||||
<div class="inputBox">
|
||||
ASCIIMath Input:
|
||||
<input id="asciiMathInput" name="asciiMathInput" type="text" value="" /><input id="asciiMathML" name="asciiMathML" type="hidden" /><input type="submit" value="Go!" /></div>
|
||||
</form>
|
||||
<h3>Live Preview</h3>
|
||||
<p>
|
||||
This is a MathML rendering of your input, generated by ASCIIMathML as you type.
|
||||
|
||||
</p>
|
||||
<div class="result">
|
||||
<div id="preview"> </div>
|
||||
</div>
|
||||
<p>
|
||||
This is the underlying MathML source generated by ASCIIMathML, again updated in real time.
|
||||
|
||||
</p>
|
||||
<div class="result"><pre id="previewSource"> </pre></div><script type="text/javascript">
|
||||
registerASCIIMathMLInputWidget('asciiMathInput', 'preview', 'asciiMathML', 'previewSource');
|
||||
var inputChanged = false;
|
||||
// Hide any existing output stuff in page on first change, as it will no longer be in sync
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#asciiMathInput').bind('keydown', function() {
|
||||
if (!inputChanged) jQuery('.outputContainer').css('visibility', 'hidden');
|
||||
inputChanged = true;
|
||||
});
|
||||
});
|
||||
</script><div class="outputContainer">
|
||||
<h3>Enhanced Presentation MathML</h3>
|
||||
<p>
|
||||
This shows the result of attempting to enrich the raw Presentation MathML
|
||||
generated by ASCIIMathML:
|
||||
|
||||
</p><pre class="result"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mn>2</mn>
|
||||
</math></pre><h3>Content MathML</h3>
|
||||
<p>
|
||||
This shows the result of an attempted
|
||||
<a href="documentation/content-mathml.html">conversion to Content MathML</a>:
|
||||
|
||||
</p><pre class="result"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<cn>2</cn>
|
||||
</math></pre><h3>Maxima Input Form</h3>
|
||||
<p>
|
||||
This shows the result of an attempted
|
||||
<a href="documentation/maxima-input.html">conversion to Maxima Input syntax</a>:
|
||||
|
||||
</p><pre class="result">2</pre><h3>MathML Parallel Markup</h3>
|
||||
<p>
|
||||
This shows the enhanced Presentation MathML with other forms encapsulated
|
||||
as annotations:
|
||||
|
||||
</p><pre class="result"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics>
|
||||
<mn>2</mn>
|
||||
<annotation-xml encoding="MathML-Content">
|
||||
<cn>2</cn>
|
||||
</annotation-xml>
|
||||
<annotation encoding="ASCIIMathInput"/>
|
||||
<annotation encoding="Maxima">2</annotation>
|
||||
</semantics>
|
||||
</math></pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="copyright">
|
||||
<p>
|
||||
SnuggleTeX Release 1.2.2 —
|
||||
<a href="/snuggletex-webapp-1.2.2/documentation/release-notes.html">Release Notes</a><br />
|
||||
Copyright © 2009
|
||||
<a href="http://www.ph.ed.ac.uk">The School of Physics and Astronomy</a>,
|
||||
<a href="http://www.ed.ac.uk">The University of Edinburgh</a>.
|
||||
<br />
|
||||
For more information, contact
|
||||
<a href="http://www.ph.ed.ac.uk/elearning/contacts/#dmckain">David McKain</a>.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
The University of Edinburgh is a charitable body, registered in Scotland,
|
||||
with registration number SC005336.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -10,6 +10,7 @@ import os
|
||||
import random
|
||||
import unittest
|
||||
import textwrap
|
||||
import mock
|
||||
|
||||
from . import test_system
|
||||
|
||||
@@ -186,7 +187,6 @@ class ImageResponseTest(ResponseTest):
|
||||
|
||||
class SymbolicResponseTest(unittest.TestCase):
|
||||
def test_sr_grade(self):
|
||||
raise SkipTest() # This test fails due to dependencies on a local copy of snuggletex-webapp. Until we have figured that out, we'll just skip this test
|
||||
symbolicresponse_file = os.path.dirname(__file__) + "/test_files/symbolicresponse.xml"
|
||||
test_lcp = lcp.LoncapaProblem(open(symbolicresponse_file).read(), '1', system=test_system)
|
||||
correct_answers = {'1_2_1': 'cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]',
|
||||
@@ -264,14 +264,25 @@ class SymbolicResponseTest(unittest.TestCase):
|
||||
}
|
||||
wrong_answers = {'1_2_1': '2',
|
||||
'1_2_1_dynamath': '''
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle displaystyle="true">
|
||||
<mn>2</mn>
|
||||
</mstyle>
|
||||
</math>''',
|
||||
}
|
||||
self.assertEquals(test_lcp.grade_answers(correct_answers).get_correctness('1_2_1'), 'correct')
|
||||
self.assertEquals(test_lcp.grade_answers(wrong_answers).get_correctness('1_2_1'), 'incorrect')
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle displaystyle="true">
|
||||
<mn>2</mn>
|
||||
</mstyle>
|
||||
</math>''',
|
||||
}
|
||||
|
||||
import requests
|
||||
d = os.path.dirname(__file__)
|
||||
correct_snuggletex_response = open(os.path.join(d, "test_files/snuggletex_correct.html")).read().decode('utf8')
|
||||
wrong_snuggletex_response = open(os.path.join(d, "test_files/snuggletex_wrong.html")).read().decode('utf8')
|
||||
|
||||
with mock.patch.object(requests, 'post') as mock_post:
|
||||
mock_post.return_value.text = correct_snuggletex_response
|
||||
self.assertEquals(test_lcp.grade_answers(correct_answers).get_correctness('1_2_1'), 'correct')
|
||||
|
||||
with mock.patch.object(requests, 'post') as mock_post:
|
||||
mock_post.return_value.text = wrong_snuggletex_response
|
||||
self.assertEquals(test_lcp.grade_answers(wrong_answers).get_correctness('1_2_1'), 'incorrect')
|
||||
|
||||
|
||||
class OptionResponseTest(ResponseTest):
|
||||
|
||||
Reference in New Issue
Block a user