Skip to content

Commit

Permalink
Immediate rendering
Browse files Browse the repository at this point in the history
Render service response immediately, without to serialize it to a form field.
  • Loading branch information
physikerwelt committed Oct 12, 2017
1 parent 83eb5fb commit d3e8d7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
6 changes: 3 additions & 3 deletions src/main/resources/config/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ server:
port: 8080 # default server port, if not set otherwise

# Math AST Renderer - Main URL
mast.url: http://math.citeplag.org
mast.url: https://vmext.wmflabs.org

# the use of the latexml online service (via url) is optional
# if service is not found or configured properly fallback is the local latexml installation
latexml:
active: true
url: http://gw125.iu.xsede.org:8888 # set a url if you want the option of the online service
url: https://drmf-latexml.wmflabs.org/ # set a url if you want the option of the online service
params: # parameters for the online service
whatsin: math
whatsout: math
Expand Down Expand Up @@ -39,4 +39,4 @@ latexml:
# Mathoid - alternative Latex to MathML converter
mathoid:
active: true
url: http://drmf-mathoid.wmflabs.org
url: https://drmf-mathoid.wmflabs.org/mml
4 changes: 2 additions & 2 deletions src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<tr>
<td>Step 1:</td>
<td>
<input type="button" id="cvt1" onclick="convertLatex();renderAST();" value="Convert LaTeXML">
<input type="button" id="cvt1" onclick="convertLatex()" value="Convert LaTeXML">
&nbsp;or&nbsp;
<input type="button" id="cvt2" onclick="convertLatexMathoid();renderAST()" value="Convert Mathoid">
<input type="button" id="cvt2" onclick="convertLatexMathoid()" value="Convert Mathoid">
</td>
</tr>
</table>
Expand Down
28 changes: 6 additions & 22 deletions src/main/resources/static/mini-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/** Math AST URL */
var mastUrl = "http://math.citeplag.org";
var mastUrl = "https://vmext.wmflabs.org";

/** simple asynchronoues http client */
var HttpClient = function() {
Expand Down Expand Up @@ -61,6 +61,7 @@ function convertLatex() {
client.post("/math", formData1, function(serviceRep) {
var json = JSON.parse(serviceRep);
document.getElementById("mathml1").value = json.result;
renderAST(json.result);
log("conversion of latex field 1 finished");
});

Expand All @@ -76,15 +77,16 @@ function convertLatexMathoid() {
formData1.append("latex", document.getElementById("latex1").value);
client.post("/math/mathoid", formData1, function(mathml) {
document.getElementById("mathml1").value = mathml;
renderAST(mathml);
});


};



function renderAST() {
var mathml = document.getElementById("mathml1").value;
function renderAST(mathml) {
//var mathml = document.getElementById("mathml1").value;
var url = mastUrl + '/widgets/formula-ast-widget.js';

// prepare widget data
Expand All @@ -99,24 +101,6 @@ function renderAST() {
container.appendChild(scriptTag);
};

function renderCompare() {
var mathml1 = document.getElementById("mathml1").value;
var sim = document.getElementById("sim").value;
var url = mastUrl + '/widgets/formula-similarity-widget.js';

// prepare widget data
var scriptTag = document.createElement('script');
scriptTag.setAttribute('src', url);
scriptTag.setAttribute('reference_mathml', mathml1);
scriptTag.setAttribute('similarities', sim);
scriptTag.crossOrigin = 'anonymous';

// add script
log("start to render comparison")
var container = document.getElementById("ast")
container.innerHTML = "";
container.appendChild(scriptTag);
};

/**
* Request of the configuration from the backend.
Expand Down Expand Up @@ -145,7 +129,7 @@ function loadExample() {
document.getElementById("latex1").value = json.latex1;
document.getElementById("mathml1").value = json.mathml1;
log("Example loaded");
renderAST();
renderAST(json.mathml1);
});
}

Expand Down

0 comments on commit d3e8d7e

Please sign in to comment.