Test site supports before= and after= search parameters.

They add text before/after the math. Example use: testing baseline alignment.
This commit is contained in:
Eddie Kohler
2017-07-18 11:14:08 -04:00
parent 050905f804
commit e7658ccd76

View File

@@ -30,6 +30,30 @@ function init() {
macroString += "&" + match[0].substr(1);
}
// The `before` search parameter puts normal text before the math.
// The `after` search parameter puts normal text after the math.
// Example use: testing baseline alignment.
if (/(?:^\?|&)(?:before|after)=/.test(window.location.search)) {
var mathContainer = math;
mathContainer.id = "math-container";
if ((match = /(?:^\?|&)before=([^&]*)/.exec(window.location.search))) {
var child = document.createTextNode(decodeURIComponent(match[1]));
mathContainer.appendChild(child);
macroString += "&" + match[0].substr(1);
}
math = document.createElement("span");
math.id = "math";
mathContainer.appendChild(math);
if ((match = /(?:^\?|&)after=([^&]*)/.exec(window.location.search))) {
var child = document.createTextNode(decodeURIComponent(match[1]));
mathContainer.appendChild(child);
macroString += "&" + match[0].substr(1);
}
}
reprocess();
function setSearch() {