Mobrovac has submitted this change and it was merged.
Change subject: Put the mathoid-style headers to the complete endpoint response
as well
......................................................................
Put the mathoid-style headers to the complete endpoint response as well
Change-Id: Iee4cb549ec1b2fd539de4fb0bcaa5aaff9760df5
---
M routes/mathoid.js
M spec.yaml
2 files changed, 21 insertions(+), 20 deletions(-)
Approvals:
Mobrovac: Looks good to me, approved
jenkins-bot: Verified
diff --git a/routes/mathoid.js b/routes/mathoid.js
index 9082237..e319cdd 100644
--- a/routes/mathoid.js
+++ b/routes/mathoid.js
@@ -18,16 +18,19 @@
/* The response headers for different render types */
-var outHeaders = {
- svg: {
- 'content-type': 'image/svg+xml'
- },
- png: {
- 'content-type': 'image/png'
- },
- mml: {
- 'content-type': 'application/mathml+xml'
- }
+var outHeaders = function(data) {
+ return {
+ svg: {
+ 'content-type': 'image/svg+xml'
+ },
+ png: {
+ 'content-type': 'image/png'
+ },
+ mml: {
+ 'content-type': 'application/mathml+xml',
+ 'x-mathoid-style': data.mathoidStyle
+ }
+ };
};
@@ -63,8 +66,8 @@
if (chem) {
type = "inline-TeX";
}
- if ((!app.conf.no_check && /^TeX|inline-TeX$/.test(type)) || info ) {
- feedback = texvcInfo.feedback(q,{usemhchem: chem});
+ if ((!app.conf.no_check && /^TeX|inline-TeX$/.test(type)) || info) {
+ feedback = texvcInfo.feedback(q, {usemhchem: chem});
// XXX properly handle errors here!
if (feedback.success) {
sanitizedTex = feedback.checked || '';
@@ -107,7 +110,7 @@
if (sanitizedTex !== undefined) {
data.sanetex = sanitizedTex;
}
- if (speech){
+ if (speech) {
data.speech = data.speakText;
}
switch (outFormat) {
@@ -115,22 +118,19 @@
res.json(data).end();
break;
case 'complete':
- Object.keys(outHeaders).forEach(function (outType) {
+ var headers = outHeaders(data);
+ Object.keys(headers).forEach(function (outType) {
if (data[outType]) {
data[outType] = {
- headers: outHeaders[outType],
+ headers: headers[outType],
body: data[outType]
};
}
});
res.json(data).end();
break;
- case 'mml':
- res.set(Object.assign({}, outHeaders.mml, {'x-mathoid-style':
data.mathoidStyle}));
- res.send(data.mml).end();
- break;
default:
- res.set(outHeaders[outFormat]);
+ res.set(outHeaders(data)[outFormat]);
res.send(data[outFormat]).end();
}
});
diff --git a/spec.yaml b/spec.yaml
index a69250d..6688c5d 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -101,6 +101,7 @@
mml:
headers:
content-type: application/mathml+xml
+ x-mathoid-style: /.+/
body: /.+/
- title: mass-energy equivalence (svg)
request:
--
To view, visit https://gerrit.wikimedia.org/r/271046
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iee4cb549ec1b2fd539de4fb0bcaa5aaff9760df5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/mathoid
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits