Skip to content

Commit

Permalink
Fixed knit warnings (unresolved refs) and guide typos
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Jun 29, 2018
1 parent 1f74a2d commit 0c090ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
5 changes: 3 additions & 2 deletions coroutines-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ The first four elements are added to the buffer and the sender suspends when try

Ticker channel is a special rendezvous channel that produces `Unit` every time given delay passes since last consumption from this channel.
Though it may seem to be useless standalone, it is a useful building block to create complex time-based [produce]
pipelines and operators that do windowing and other time-dependend processing.
pipelines and operators that do windowing and other time-dependent processing.
Ticker channel can be used in [select] to perform "on tick" action.

To create such channel use a factory method [ticker].
Expand Down Expand Up @@ -1716,7 +1716,7 @@ Next element is ready in 50ms after consumer pause in 150ms: kotlin.Unit
Note that [ticker] is aware of possible consumer pauses and, by default, adjusts next produced element
delay if a pause occurs, trying to maintain a fixed rate of produced elements.

Optionally, a `mode` parameters equal to [TickerMode.FIXED_DELAY] can be specified to maintain a fixed
Optionally, a `mode` parameter equal to [TickerMode.FIXED_DELAY] can be specified to maintain a fixed
delay between elements.

### Channels are fair
Expand Down Expand Up @@ -2499,6 +2499,7 @@ Channel was closed
[Channel()]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-channel.html
[ticker]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/ticker.html
[ReceiveChannel.cancel]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-receive-channel/cancel.html
[TickerMode.FIXED_DELAY]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-ticker-mode/-f-i-x-e-d_-d-e-l-a-y.html
[actor]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/actor.html
[ReceiveChannel.onReceive]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-receive-channel/on-receive.html
[ReceiveChannel.onReceiveOrNull]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-receive-channel/on-receive-or-null.html
Expand Down
12 changes: 7 additions & 5 deletions integration/kotlinx-coroutines-jdk8/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Module kotlinx-coroutines-jdk8

Integration with JDK8 [`CompletableFuture`][java.util.concurrent.CompletableFuture] (Android API level 24).
Integration with JDK8 [CompletableFuture] (Android API level 24).

Coroutine builders:

| **Name** | **Result** | **Scope** | **Description**
| -------- | ---------- | ---------- | ---------------
| [future] | [CompletableFuture][java.util.concurrent.CompletableFuture] | [CoroutineScope] | Returns a single value with the future result
| **Name** | **Result** | **Scope** | **Description**
| -------- | ------------------- | ---------------- | ---------------
| [future] | [CompletableFuture] | [CoroutineScope] | Returns a single value with the future result

Extension functions:

Expand Down Expand Up @@ -47,7 +47,9 @@ that makes it especially bad choice for coroutine-based Kotlin code.

# Package kotlinx.coroutines.experimental.future

Integration with JDK8 [`CompletableFuture`][java.util.concurrent.CompletableFuture] (Android API level 24).
Integration with JDK8 [CompletableFuture] (Android API level 24).

[CompletableFuture]: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html

<!--- MODULE kotlinx-coroutines-core -->
<!--- INDEX kotlinx.coroutines.experimental -->
Expand Down
17 changes: 12 additions & 5 deletions knit/src/Knit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const val LINES_START_UNORDERED_PREDICATE = "LINES_START_UNORDERED"
const val LINES_START_PREDICATE = "LINES_START"

val API_REF_REGEX = Regex("(^|[ \\]])\\[([A-Za-z0-9_().]+)\\]($|[^\\[\\(])")
val LINK_DEF_REGEX = Regex("^\\[([A-Za-z0-9_().]+)\\]: .*")

fun main(args: Array<String>) {
if (args.isEmpty()) {
Expand Down Expand Up @@ -187,10 +188,16 @@ fun knit(markdownFileName: String): Boolean {
tocLines += " ".repeat(i - 2) + "* [$name](#${makeSectionRef(name)})"
continue@mainLoop
}
for (match in API_REF_REGEX.findAll(inLine)) {
val apiRef = ApiRef(lineNumber, match.groups[2]!!.value)
allApiRefs += apiRef
remainingApiRefNames += apiRef.name
val linkDefMatch = LINK_DEF_REGEX.matchEntire(inLine)
if (linkDefMatch != null) {
val name = linkDefMatch.groups[1]!!.value
remainingApiRefNames -= name
} else {
for (match in API_REF_REGEX.findAll(inLine)) {
val apiRef = ApiRef(lineNumber, match.groups[2]!!.value)
allApiRefs += apiRef
remainingApiRefNames += apiRef.name
}
}
knitRegex?.find(inLine)?.let { knitMatch ->
val fileName = knitMatch.groups[1]!!.value
Expand Down Expand Up @@ -409,7 +416,7 @@ data class ApiIndexKey(

val apiIndexCache: MutableMap<ApiIndexKey, Map<String, List<String>>> = HashMap()

val REF_LINE_REGEX = Regex("<a href=\"([a-z/.\\-]+)\">([a-zA-z.]+)</a>")
val REF_LINE_REGEX = Regex("<a href=\"([a-z_/.\\-]+)\">([a-zA-z.]+)</a>")
val INDEX_HTML = "/index.html"
val INDEX_MD = "/index.md"
val FUNCTIONS_SECTION_HEADER = "### Functions"
Expand Down
3 changes: 2 additions & 1 deletion reactive/coroutines-guide-reactive.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Finally

<!--- TEST -->

With an explicit `openSubscription` we should [cancel][SubscriptionReceiveChannel.cancel] the corresponding
With an explicit `openSubscription` we should [cancel][ReceiveChannel.cancel] the corresponding
subscription to unsubscribe from the source. There is no need to invoke `cancel` explicitly -- under the hood
`consume` does that for us.
The installed
Expand Down Expand Up @@ -1067,6 +1067,7 @@ coroutines for complex pipelines with fan-in and fan-out between multiple worker
[produce]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/produce.html
[consumeEach]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/consume-each.html
[ReceiveChannel]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-receive-channel/index.html
[ReceiveChannel.cancel]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-receive-channel/cancel.html
[SendChannel.send]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-send-channel/send.html
[BroadcastChannel]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-broadcast-channel/index.html
[ConflatedBroadcastChannel]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental.channels/-conflated-broadcast-channel/index.html
Expand Down

0 comments on commit 0c090ed

Please sign in to comment.