diff --git a/src/main/java/li/cil/oc/api/machine/Callback.java b/src/main/java/li/cil/oc/api/machine/Callback.java
index 64bf4858b..45781d145 100644
--- a/src/main/java/li/cil/oc/api/machine/Callback.java
+++ b/src/main/java/li/cil/oc/api/machine/Callback.java
@@ -88,6 +88,14 @@ public @interface Callback {
* more importantly you should document the expected parameters and return
* type here.
*
+ * Important: the recommended format is either
+ * function(arg:type[, optionArg:type]):resultType -- Description.
+ * or
+ * function(arg:type[, optionArg:type]):resultType; Description.
+ * where the argument list can be of any format (as long as it doesn't contain
+ * further braces), and the return type is optional. These two formats are
+ * recognized by OC's NEI component documentation plugin. If you use a
+ * different format, the doc string will be used as-is.
*/
String doc() default "";
diff --git a/src/main/scala/li/cil/oc/util/mods/NEI.scala b/src/main/scala/li/cil/oc/util/mods/NEI.scala
index 963a3784d..b78d9d05e 100644
--- a/src/main/scala/li/cil/oc/util/mods/NEI.scala
+++ b/src/main/scala/li/cil/oc/util/mods/NEI.scala
@@ -55,6 +55,8 @@ class DocumentationHandler(val pages: Option[Array[String]]) extends IUsageHandl
private val DocPattern = """^function(\([^)]*\)[^-]*) -- (.*)$""".r
+ private val VexPattern = """^function(\([^)]*\)[^-]*); (.*)$""".r
+
private def wrap(line: String, width: Int) = GuiDraw.fontRenderer.listFormattedStringToWidth(line, width)
override def getUsageHandler(input: String, ingredients: AnyRef*): IUsageHandler = {
@@ -67,8 +69,9 @@ class DocumentationHandler(val pages: Option[Array[String]]) extends IUsageHandl
val doc = callback.annotation.doc
if (Strings.isNullOrEmpty(doc)) name
else {
- val (signature, documentation) = DocPattern findFirstIn doc match {
- case Some(DocPattern(head, tail)) => (name + head, tail)
+ val (signature, documentation) = doc match {
+ case DocPattern(head, tail) => (name + head, tail)
+ case VexPattern(head, tail) => (name + head, tail)
case _ => (name, doc)
}
wrap(signature, 160).map(EnumChatFormatting.BLACK.toString + _).mkString("\n") +