Build proper HTML documentation

This commit is contained in:
Felix Krause 2016-01-13 22:43:12 +01:00
parent 46acdc3ccd
commit 26eb38c5c8
1 changed files with 27 additions and 0 deletions

View File

@ -82,12 +82,15 @@
</div>
</article>
<script type="text/javascript">
<<<<<<< HEAD
function setTextContent(element, text) {
while (element.firstChild!==null) {
element.removeChild(element.firstChild); // remove all existing content
}
element.appendChild(document.createTextNode(text));
}
=======
>>>>>>> Build proper HTML documentation
function parse() {
var r = new XMLHttpRequest();
var params = "style=" + encodeURIComponent(document.querySelector(
@ -102,6 +105,7 @@
var result = JSON.parse(r.responseText);
switch(result.code) {
case 0:
<<<<<<< HEAD
setTextContent(output, result.output);
output.style.color = "black";
break;
@ -113,16 +117,39 @@
break;
case 2:
setTextContent(output, "Presenter error:\n" + result.message);
=======
output.innerText = result.output;
output.style.color = "black";
break;
case 1:
output.innerText = "Parser error at line " + result.line +
", column " + result.column + ":\n" + result.message +
"\n\n" + result.detail;
output.style.color = "orange";
break;
case 2:
output.innerText = "Presenter error:\n" + result.message;
>>>>>>> Build proper HTML documentation
output.style.color = "orange";
break;
}
} else if (r.status == 0) {
<<<<<<< HEAD
setTextContent(output,
"YAML parser server does not seem to be available.");
output.style.color = "red";
} else {
setTextContent(output, "Status: " + r.status +
"\nException occurred on server:\n\n" + r.responseText);
=======
output.innerText =
"YAML parser server does not seem to be available.";
output.style.color = "red";
} else {
output.innerText = "Status: " + r.status +
"\nException occurred on server:\n\n" +
r.responseText;
>>>>>>> Build proper HTML documentation
output.style.color = "red";
}
}