diff --git a/doc/parameter_view/parameters.js b/doc/parameter_view/parameters.js index 8a64f1b2352..df63823570a 100644 --- a/doc/parameter_view/parameters.js +++ b/doc/parameter_view/parameters.js @@ -20,6 +20,7 @@ demangleStrings(); +reorderList(); function demangleStrings() { mangledStrings = document.getElementsByClassName("mangled"); @@ -83,3 +84,58 @@ for (i = 0; i < coll.length; i++) { } }); } + +function sortTopNodes(ClassType) { + var list, i, switching, shouldSwitch; + list = document.getElementById("ParameterList"); + switching = true; + + /* Make a loop that will continue until + no switching has been done: */ + while (switching) { + // Start by saying: no switching is done: + switching = false; + children = list.children; + // parameters = children.getElementbyClassName("parameter"); + + // Loop through all list items: + for (i = 0; i < (children.length - 1); i++) { + if (children[i].children[0].classList.contains(ClassType) && children[i+1].children[0].classList.contains(ClassType)) { + // Start by saying there should be no switching: + shouldSwitch = false; + /* Check if the next item should + switch place with the current item: */ + if (children[i].children[0].innerHTML.toLowerCase() > children[i + 1].children[0].innerHTML.toLowerCase()) { + /* If next item is alphabetically lower than current item, + mark as a switch and break the loop: */ + shouldSwitch = true; + break; + } + } + } + + if (shouldSwitch) { + /* If a switch has been marked, make the switch + and mark the switch as done: */ + children[i].parentNode.insertBefore(children[i + 1], children[i]); + switching = true; + } + } +} + +function reorderList() { + var list, i; + list = document.getElementById("ParameterList"); + + /* Move parameters to the front */ + children = list.children; + + for (i = 0; i < children.length; i++) { + if (children[i].children[0].classList.contains("parameter")) { + children[i].parentNode.insertBefore(children[i], children[0]); + } + } + + sortTopNodes("parameter"); + sortTopNodes("subsection"); +} diff --git a/doc/parameter_view/parameters.xsl b/doc/parameter_view/parameters.xsl index 50b367ecc80..88f492c9eeb 100644 --- a/doc/parameter_view/parameters.xsl +++ b/doc/parameter_view/parameters.xsl @@ -12,12 +12,15 @@

ASPECT input parameters +

+ +
- -
+