Permalink
Browse files

Minor doc changes

  • Loading branch information...
LadyCailin committed Nov 9, 2017
1 parent 9e9ded6 commit 08761ec46ea4c1bb4b18bc002bdb7de8f9bc7f60
@@ -1252,7 +1252,8 @@ public String docs() {
+ " Called when a block fades, melts or disappears based on world conditions."
+ " {oldblock: The block before the fades (an array with keys 'type' and 'data') |"
+ " newblock: The block after the fades (an array with keys 'type' and 'data') |"
+ " location: the location of the block that will fade}";
+ " location: the location of the block that will fade}"
+ " {}";
}
@Override
@@ -858,10 +858,12 @@ public boolean useSpecialExec() {
+ "foreach(@array as @value){\n"
+ "\tmsg(@value);\n"
+ "}"),
/*
// This is actually borked in real code, so it needs to be fixed. In the meantime, whatever, just remove the example.
new ExampleScript("Using \"as\" keyword, with a key", "@array = array(1, 2, 3);\n"
+ "foreach(@array as @key: @value){\n"
+ "\tmsg(@key . ': ' . @value);\n"
+ "}"),
+ "}"),*/
new ExampleScript("With else clause", "@array = array() # Note empty array\n"
+ "foreach(@value in @array){\n"
+ "\tmsg(@value);\n"
@@ -703,7 +703,7 @@ public MutabilityData(String name, String description) {
public final List<MutabilityData> mutability;
private static final Pattern EVENT_PATTERN = Pattern.compile("\\{(.*?)\\} *?(.*?) *?\\{(.*?)\\} *?\\{(.*?)\\}");
public EventDocInfo(String docs) {
public EventDocInfo(String docs, String eventName) {
Matcher m = EVENT_PATTERN.matcher(docs);
if(m.find()) {
description = m.group(2).trim();
@@ -726,7 +726,7 @@ public EventDocInfo(String docs) {
mutability.add(new MutabilityData(d[0], d.length > 1 ? d[1] : ""));
}
} else {
throw new RuntimeException("Invalid data");
throw new RuntimeException("Invalid data from " + eventName + ": " + docs);
}
}
}
@@ -22,9 +22,7 @@
import com.laytonsmith.core.functions.FunctionBase;
import com.laytonsmith.core.functions.FunctionList;
import com.laytonsmith.core.natives.interfaces.Mixed;
import com.laytonsmith.core.natives.interfaces.MixedInterfaceRunner;
import com.laytonsmith.tools.docgen.DocGen;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -110,7 +108,7 @@ public static void main(String [] args) {
try {
Map<String, Object> event = new TreeMap<>();
event.put("name", e.getName());
DocGen.EventDocInfo edi = new DocGen.EventDocInfo(e.docs());
DocGen.EventDocInfo edi = new DocGen.EventDocInfo(e.docs(), e.getName());
event.put("desc", edi.description);
Map<String, String> ed = new TreeMap<>();
for (DocGen.EventDocInfo.EventData edd : edi.eventData) {
@@ -51,7 +51,6 @@
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -1262,7 +1261,7 @@ private void generateFunctionDocs(Function f, DocGen.DocInfo docs) {
for (Optimizable.OptimizationOption option : options) {
list.add("[[../../Optimizer#" + option.name() + "|" + option.name() + "]]");
}
optimizationMessage = StringUtils.Join(list, " <br /> Œ");
optimizationMessage = StringUtils.Join(list, " <br /> ");
}
page.append(optimizationMessage);
page.append("\n|}");

0 comments on commit 08761ec

Please sign in to comment.