From 362d73444488dc2a6953312c435aacdf651f6e1e Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Thu, 23 May 2019 14:12:00 +0200 Subject: [PATCH] Merge Source.apply and Source.from docs (#606) --- akka-docs/src/main/paradox/.htaccess | 3 ++- .../stream/operators/Source-or-Flow/apply.md | 24 ------------------- .../paradox/stream/operators/Source/from.md | 10 ++++---- .../main/paradox/stream/operators/index.md | 4 ++-- project/StreamOperatorsIndexGenerator.scala | 11 +++++++-- 5 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 akka-docs/src/main/paradox/stream/operators/Source-or-Flow/apply.md diff --git a/akka-docs/src/main/paradox/.htaccess b/akka-docs/src/main/paradox/.htaccess index 9c3579c943..48549c1204 100644 --- a/akka-docs/src/main/paradox/.htaccess +++ b/akka-docs/src/main/paradox/.htaccess @@ -16,9 +16,10 @@ RedirectMatch 301 ^(.*)/stream/stages-overview\.html$ $1/stream/operators/index. RedirectMatch 301 ^(.*)/agents\.html$ $1/project/migration-guide-2.5.x-2.6.x.html RedirectMatch 301 ^(.*)/typed-actors\.html$ $1/project/migration-guide-2.5.x-2.6.x.html#typedactor - RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/balance\.html$ $1/stream/operators/Balance.html RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/broadcast\.html$ $1/stream/operators/Broadcast.html RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/partition\.html$ $1/stream/operators/Partition.html RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/unzip\.html$ $1/stream/operators/unzip.html RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/UnzipWith\.html$ $1/stream/operators/UnzipWith.html + +RedirectMatch 301 ^(.*)/stream/operators/Source-or-Flow/apply\.html$ $1/stream/operators/Source/from.html diff --git a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/apply.md b/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/apply.md deleted file mode 100644 index c737afe35e..0000000000 --- a/akka-docs/src/main/paradox/stream/operators/Source-or-Flow/apply.md +++ /dev/null @@ -1,24 +0,0 @@ -# apply - -Stream the values of an `immutable.Seq`. - -@ref[Source operators](../index.md#source-operators) - -@@@ div { .group-scala } -## Signature - -@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #apply } -@@@ - -## Description - -Stream the values of an `immutable.Seq`. - -@@@div { .callout } - -**emits** the next value of the seq - -**completes** when the last element of the seq has been emitted - -@@@ - diff --git a/akka-docs/src/main/paradox/stream/operators/Source/from.md b/akka-docs/src/main/paradox/stream/operators/Source/from.md index 17f7ed9d09..516e3d85ad 100644 --- a/akka-docs/src/main/paradox/stream/operators/Source/from.md +++ b/akka-docs/src/main/paradox/stream/operators/Source/from.md @@ -1,6 +1,6 @@ -# from +# @scala[apply]@java[from] -Stream the values of an `Iterable`. +Stream the values of an @scala[`immutable.Seq`]@java[`Iterable`]. @ref[Source operators](../index.md#source-operators) @@ -9,14 +9,14 @@ Stream the values of an `Iterable`. ## Signature -@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/javadsl/Source.scala) { #from } +@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #apply } @@@ ## Description -Stream the values of an `Iterable`. Make sure the `Iterable` is immutable or at least not modified after being used -as a source. Otherwise the stream may fail with `ConcurrentModificationException` or other more subtle errors may occur. +Stream the values of an @scala[`immutable.Seq`]@java[`Iterable`]. @java[Make sure the `Iterable` is immutable or at least not modified after being used +as a source. Otherwise the stream may fail with `ConcurrentModificationException` or other more subtle errors may occur.] @@@div { .callout } diff --git a/akka-docs/src/main/paradox/stream/operators/index.md b/akka-docs/src/main/paradox/stream/operators/index.md index 4811a35e29..95016d0cbc 100644 --- a/akka-docs/src/main/paradox/stream/operators/index.md +++ b/akka-docs/src/main/paradox/stream/operators/index.md @@ -16,7 +16,7 @@ These built-in sources are available from @scala[`akka.stream.scaladsl.Source`] |Source|@ref[cycle](Source/cycle.md)|Stream iterator in cycled manner.| |Source|@ref[empty](Source/empty.md)|Complete right away without ever emitting any elements.| |Source|@ref[failed](Source/failed.md)|Fail directly with a user specified exception.| -|Source|@ref[from](Source/from.md)|Stream the values of an `Iterable`.| +|Source|@ref[@scala[apply]@java[from]](Source/from.md)|Stream the values of an @scala[`immutable.Seq`]@java[`Iterable`].| |Source|@ref[fromCompletionStage](Source/fromCompletionStage.md)|Send the single value of the `CompletionStage` when it completes and there is demand.| |Source|@ref[fromFuture](Source/fromFuture.md)|Send the single value of the `Future` when it completes and there is demand.| |Source|@ref[fromFutureSource](Source/fromFutureSource.md)|Streams the elements of the given future source once it successfully completes.| @@ -334,7 +334,7 @@ For more background see the @ref[Error Handling in Streams](../stream-error.md) * [queue](Source/queue.md) * [unfoldResource](Source/unfoldResource.md) * [unfoldResourceAsync](Source/unfoldResourceAsync.md) -* [from](Source/from.md) +* [@scala[apply]@java[from]](Source/from.md) * [range](Source/range.md) * [concat](Source-or-Flow/concat.md) * [prepend](Source-or-Flow/prepend.md) diff --git a/project/StreamOperatorsIndexGenerator.scala b/project/StreamOperatorsIndexGenerator.scala index dc4acf3091..1c8968c17d 100644 --- a/project/StreamOperatorsIndexGenerator.scala +++ b/project/StreamOperatorsIndexGenerator.scala @@ -202,7 +202,9 @@ object StreamOperatorsIndexGenerator extends AutoPlugin { lines .map(_._2) .sortBy(_._2) - .map { case (element, method, md, description) => s"""|$element|@ref[$method]($md)|$description|""" } + .map { case (element, method, md, description) => + s"""|$element|@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")