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