Merge Source.apply and Source.from docs (#606)

This commit is contained in:
Arnout Engelen 2019-05-23 14:12:00 +02:00
parent e5d9ce8cd3
commit 362d734444
No known key found for this signature in database
GPG key ID: BB8C0F854A1E2105
5 changed files with 18 additions and 34 deletions

View file

@ -202,7 +202,9 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
lines
.map(_._2)
.sortBy(_._2)
.map { case (element, method, md, description) => s"""|$element|<a name="${method.toLowerCase}"></a>@ref[$method]($md)|$description|""" }
.map { case (element, method, md, description) =>
s"""|$element|<a name="${method.toLowerCase}"></a>@ref[${methodToShow(method)}]($md)|$description|"""
}
.mkString("\n")
)
@ -217,12 +219,17 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
"# Operators\n\n" +
tables +
"\n\n@@@ index\n\n" +
groupedDefs.map { case (_, method, md) => s"* [$method]($md)" }.mkString("\n") + "\n\n@@@\n"
groupedDefs.map { case (_, method, md) => s"* [${methodToShow(method)}]($md)" }.mkString("\n") + "\n\n@@@\n"
if (!file.exists || IO.read(file) != content) IO.write(file, content)
Seq(file)
}
def methodToShow(method: String): String = method match {
case "from" => "@scala[apply]@java[from]"
case other => other
}
def getDetails(file: File): (String, String) = try {
val contents = IO.read(file)
val lines = contents.split("\\r?\\n")