Hi, I was wondering if there is a template DSL fun...
# kontributors
b
Hi, I was wondering if there is a template DSL function to generate `@throws`in the docs. I have checked
Templates.kt
and
MemberBuilder.kt
files but couldn't find a function for that.
Copy code
val f_chunked = fn("chunked(size: Int)") {
        include(Iterables, Sequences, CharSequences)
    } builder {
        since("1.2")
        doc {
            """
            Splits this ${f.collection} into a ${f.mapResult} of ${f.snapshotResult.pluralize()} each not exceeding the given [size].

            The last ${f.snapshotResult} in the resulting ${f.mapResult} may have less ${f.element.pluralize()} than the given [size].

            @param size the number of elements to take in each ${f.snapshotResult}, must be positive and can be greater than the number of elements in this ${f.collection}.
            """
        }
        sample("samples.collections.Collections.Transformations.chunked")
        specialFor(Iterables) { returns("List<List<T>>") }
        specialFor(Sequences) { returns("Sequence<List<T>>") }
        specialFor(CharSequences) { returns("List<String>") }

        sequenceClassification(intermediate, stateful)

        body { "return windowed(size, size, partialWindows = true)" }
    }
For example, this code snippet above generates this
Copy code
/**
 * Splits this char sequence into several char sequences each not exceeding the given [size]
 * and applies the given [transform] function to an each.
 * 
 * @return list of results of the [transform] applied to an each char sequence.
 * 
 * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.
 * You should not store it or allow it to escape in some way, unless you made a snapshot of it.
 * The last char sequence may have less characters than the given [size].
 * 
 * @param size the number of elements to take in each char sequence, must be positive and can be greater than the number of elements in this char sequence.
 * 
 * @sample samples.text.Strings.chunkedTransform
 */
@SinceKotlin("1.2")
public fun <R> CharSequence.chunked(size: Int, transform: (CharSequence) -> R): List<R> {
    return windowed(size, size, partialWindows = true, transform = transform)
}
How can I generate
@throws something
after the
@sample
part.