|
@@ -142,6 +142,7 @@ layout: default
|
|
|
return iterateArray(modules);
|
|
|
}
|
|
|
|
|
|
+ // returns HTML version of Builder content
|
|
|
function displayBuilderHTML() {
|
|
|
var output = "";
|
|
|
var mainArray = builderArray();
|
|
@@ -163,7 +164,33 @@ layout: default
|
|
|
}
|
|
|
return arrayHTML(mainArray);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ // returns Markdown version of Builder content
|
|
|
+ function displayBuilderMD() {
|
|
|
+ var mainArray = builderArray();
|
|
|
+ var indentLevel = 0;
|
|
|
+ function arrayMD(thisArray) {
|
|
|
+ var thisOutput = "";
|
|
|
+ if (thisArray.length > 0) {
|
|
|
+ for (var i = 0; i < thisArray.length; i++) {
|
|
|
+ var item = thisArray[i];
|
|
|
+ for (var x = 0; x < indentLevel; x++) {
|
|
|
+ thisOutput += " ";
|
|
|
+ }
|
|
|
+ thisOutput += "* **" + item[0] + "** ";
|
|
|
+ thisOutput += item[1] + "\n";
|
|
|
+ if (item[2].length > 0) {
|
|
|
+ indentLevel++;
|
|
|
+ thisOutput += arrayMD(item[2]);
|
|
|
+ indentLevel--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return thisOutput;
|
|
|
+ }
|
|
|
+ return arrayMD(mainArray);
|
|
|
+ }
|
|
|
|
|
|
// end RuleBuilder functions
|
|
|
|
|
@@ -219,12 +246,14 @@ layout: default
|
|
|
// RuleBuilder sections
|
|
|
if (builderEmpty()) {
|
|
|
document.getElementById("rule-builder").style.display = "none";
|
|
|
+ } else {
|
|
|
+ document.getElementById("builder-field").innerHTML = displayBuilderHTML();
|
|
|
+ document.getElementById("module-input").style.border = "none";
|
|
|
}
|
|
|
if (document.contains(document.getElementById("custom-field-container"))) {
|
|
|
document.getElementById("custom-field-container").remove();
|
|
|
}
|
|
|
document.getElementById("module-menu").style.display = "none";
|
|
|
- document.getElementById("builder-field").innerHTML = displayBuilderHTML();
|
|
|
// RuleWriter: Remove headers of empty sections
|
|
|
var sections = document.getElementsByClassName("section");
|
|
|
for (var i = 0; i < sections.length; i++) {
|
|
@@ -240,8 +269,6 @@ layout: default
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // Handle links
|
|
|
- // TKTK
|
|
|
// Handle author link
|
|
|
var authorName = document.getElementById("author-text").value;
|
|
|
var authorURL = document.getElementById("author-url").value;
|
|
@@ -272,6 +299,7 @@ layout: default
|
|
|
classDisplayAll("delete-module","inline");
|
|
|
// builder handling
|
|
|
document.getElementById("rule-builder").style.display = "block";
|
|
|
+ document.getElementById("module-input").style.border = "";
|
|
|
document.getElementById("builder-field").innerHTML = "";
|
|
|
// author handling
|
|
|
document.getElementById("authorship-result").style.display = "none";
|
|
@@ -323,12 +351,16 @@ layout: default
|
|
|
var filename = 'GOVERNANCE.md';
|
|
|
// First, add title, whether there is one or not
|
|
|
var content = '# '+ document.getElementById('communityname').innerHTML + '\n\n';
|
|
|
- content = content.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
+ content = stripHTML(content);
|
|
|
+ // Add Builder content
|
|
|
+ if (!builderEmpty()) {
|
|
|
+ content += displayBuilderMD() + "\n\n";
|
|
|
+ }
|
|
|
// Now, begin adding other elements
|
|
|
var elements = document.getElementsByClassName('output');
|
|
|
for (var i = 1; i < elements.length; i++) {
|
|
|
var thisBit = elements[i].innerHTML;
|
|
|
- thisBit = thisBit.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
+ thisBit = stripHTML(thisBit);
|
|
|
if (thisBit != "") {
|
|
|
if (elements[i].classList.contains("subhead")) {
|
|
|
// Before printing subhead, make sure it's not empty
|
|
@@ -531,8 +563,7 @@ layout: default
|
|
|
|
|
|
<div id="module-input"
|
|
|
ondrop="drop(event)" ondragover="allowDrop(event)">
|
|
|
- <span class="question" id="drag-directions">
|
|
|
- </span>
|
|
|
+ <span class="question" id="drag-directions">Browse modules with the tool button and drag them here.</span>
|
|
|
</div>
|
|
|
|
|
|
<div id="builder-field">
|
|
@@ -734,8 +765,6 @@ layout: default
|
|
|
Feedback
|
|
|
</button>
|
|
|
|
|
|
- <div class="question">Publish and Export are not yet available for the RuleBuilder</div>
|
|
|
-
|
|
|
</article>
|
|
|
|
|
|
|