From 0550504d0175feb999228408d44a36b34ddbfd6a Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Fri, 9 Nov 2018 15:11:49 -0800 Subject: [PATCH] Fix descriptions in scaladocs for macro ndarray/sybmol APIs --- .../scala/org/apache/mxnet/APIDocGenerator.scala | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scala-package/macros/src/main/scala/org/apache/mxnet/APIDocGenerator.scala b/scala-package/macros/src/main/scala/org/apache/mxnet/APIDocGenerator.scala index bfa378ea9e95..64d665579d14 100644 --- a/scala-package/macros/src/main/scala/org/apache/mxnet/APIDocGenerator.scala +++ b/scala-package/macros/src/main/scala/org/apache/mxnet/APIDocGenerator.scala @@ -90,11 +90,20 @@ private[mxnet] object APIDocGenerator extends GeneratorBase { } def generateAPIDocFromBackend(func: Func, withParam: Boolean = true): String = { - val desc = func.desc.split("\n") - .mkString(" *
\n", "\n  * ", "  * 
\n") + def fixDesc(desc: String): String = { + var curDesc = desc + var prevDesc = "" + while ( curDesc != prevDesc ) { + prevDesc = curDesc + curDesc = curDesc.replace("[[", "`[ [").replace("]]", "] ]") + } + curDesc + } + val desc = fixDesc(func.desc).split("\n") + .mkString(" *\n * {{{\n *\n * ", "\n * ", "\n * }}}\n * ") val params = func.listOfArgs.map { absClassArg => - s" * @param ${absClassArg.safeArgName}\t\t${absClassArg.argDesc}" + s" * @param ${absClassArg.safeArgName}\t\t${fixDesc(absClassArg.argDesc)}" } val returnType = s" * @return ${func.returnType}"