From 2eb805e47505388c0e47102e9257f6f79681e699 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 9 Mar 2017 17:47:09 +0300 Subject: Create HTML based format for kotlin-website --- core/testdata/format/website-html/dataTags/jre7.kt | 11 ++++ core/testdata/format/website-html/dataTags/js.kt | 11 ++++ core/testdata/format/website-html/dataTags/jvm.kt | 11 ++++ .../dataTags/multiplatform.package.html | 63 ++++++++++++++++++++++ .../website-html/dataTagsInGroupNode/jre7.kt | 0 .../format/website-html/dataTagsInGroupNode/js.kt | 8 +++ .../format/website-html/dataTagsInGroupNode/jvm.kt | 9 ++++ .../dataTagsInGroupNode/multiplatform.html | 38 +++++++++++++ .../dataTagsInGroupNode/multiplatform.package.html | 33 ++++++++++++ core/testdata/format/website-html/dropImport.html | 11 ++++ core/testdata/format/website-html/dropImport.kt | 12 +++++ .../format/website-html/newLinesInImportList.html | 12 +++++ .../format/website-html/newLinesInImportList.kt | 12 +++++ .../format/website-html/newLinesInSamples.html | 19 +++++++ .../format/website-html/newLinesInSamples.kt | 19 +++++++ .../format/website-html/overloadGroup.html | 18 +++++++ core/testdata/format/website-html/overloadGroup.kt | 15 ++++++ core/testdata/format/website-html/returnTag.html | 9 ++++ core/testdata/format/website-html/returnTag.kt | 11 ++++ core/testdata/format/website-html/sample.html | 21 ++++++++ core/testdata/format/website-html/sample.kt | 16 ++++++ .../format/website-html/sampleWithAsserts.html | 12 +++++ .../format/website-html/sampleWithAsserts.kt | 15 ++++++ 23 files changed, 386 insertions(+) create mode 100644 core/testdata/format/website-html/dataTags/jre7.kt create mode 100644 core/testdata/format/website-html/dataTags/js.kt create mode 100644 core/testdata/format/website-html/dataTags/jvm.kt create mode 100644 core/testdata/format/website-html/dataTags/multiplatform.package.html create mode 100644 core/testdata/format/website-html/dataTagsInGroupNode/jre7.kt create mode 100644 core/testdata/format/website-html/dataTagsInGroupNode/js.kt create mode 100644 core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt create mode 100644 core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html create mode 100644 core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html create mode 100644 core/testdata/format/website-html/dropImport.html create mode 100644 core/testdata/format/website-html/dropImport.kt create mode 100644 core/testdata/format/website-html/newLinesInImportList.html create mode 100644 core/testdata/format/website-html/newLinesInImportList.kt create mode 100644 core/testdata/format/website-html/newLinesInSamples.html create mode 100644 core/testdata/format/website-html/newLinesInSamples.kt create mode 100644 core/testdata/format/website-html/overloadGroup.html create mode 100644 core/testdata/format/website-html/overloadGroup.kt create mode 100644 core/testdata/format/website-html/returnTag.html create mode 100644 core/testdata/format/website-html/returnTag.kt create mode 100644 core/testdata/format/website-html/sample.html create mode 100644 core/testdata/format/website-html/sample.kt create mode 100644 core/testdata/format/website-html/sampleWithAsserts.html create mode 100644 core/testdata/format/website-html/sampleWithAsserts.kt (limited to 'core/testdata') diff --git a/core/testdata/format/website-html/dataTags/jre7.kt b/core/testdata/format/website-html/dataTags/jre7.kt new file mode 100644 index 000000000..d21b8d7b4 --- /dev/null +++ b/core/testdata/format/website-html/dataTags/jre7.kt @@ -0,0 +1,11 @@ +package foo + +@SinceKotlin("1.1") +fun jre7New() {} + +fun jre7() {} + +fun shared() {} + +@SinceKotlin("1.1") +fun sharedNew() {} \ No newline at end of file diff --git a/core/testdata/format/website-html/dataTags/js.kt b/core/testdata/format/website-html/dataTags/js.kt new file mode 100644 index 000000000..b22d70886 --- /dev/null +++ b/core/testdata/format/website-html/dataTags/js.kt @@ -0,0 +1,11 @@ +package foo + +@SinceKotlin("1.1") +fun jsNew() {} + +fun js() {} + +fun shared() {} + +@SinceKotlin("1.1") +fun sharedNew() {} \ No newline at end of file diff --git a/core/testdata/format/website-html/dataTags/jvm.kt b/core/testdata/format/website-html/dataTags/jvm.kt new file mode 100644 index 000000000..02d042261 --- /dev/null +++ b/core/testdata/format/website-html/dataTags/jvm.kt @@ -0,0 +1,11 @@ +package foo + +@SinceKotlin("1.1") +fun jvmNew() {} + +fun jvm() {} + +fun shared() {} + +@SinceKotlin("1.1") +fun sharedNew() {} \ No newline at end of file diff --git a/core/testdata/format/website-html/dataTags/multiplatform.package.html b/core/testdata/format/website-html/dataTags/multiplatform.package.html new file mode 100644 index 000000000..0430c6f2e --- /dev/null +++ b/core/testdata/format/website-html/dataTags/multiplatform.package.html @@ -0,0 +1,63 @@ +
test / foo
+

Package foo

+

Functions

+ + + + + + + + + + + + + + + + + + + +
+jre7 + +
fun jre7(): Unit
+ +
+jre7New + +
fun jre7New(): Unit
+ +
+js + +
fun js(): Unit
+ +
+jsNew + +
fun jsNew(): Unit
+ +
+jvm + +
fun jvm(): Unit
+ +
+jvmNew + +
fun jvmNew(): Unit
+ +
+shared + +
fun shared(): Unit
+ +
+sharedNew + +
fun sharedNew(): Unit
+ +
diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/jre7.kt b/core/testdata/format/website-html/dataTagsInGroupNode/jre7.kt new file mode 100644 index 000000000..e69de29bb diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/js.kt b/core/testdata/format/website-html/dataTagsInGroupNode/js.kt new file mode 100644 index 000000000..045f3f0d6 --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/js.kt @@ -0,0 +1,8 @@ +package pack + +class Some { + + fun magic() { + + } +} \ No newline at end of file diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt b/core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt new file mode 100644 index 000000000..57f36742e --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt @@ -0,0 +1,9 @@ +package pack + +class SomeCoolJvmClass { + fun magic() { + + } +} + +typealias Some = SomeCoolJvmClass \ No newline at end of file diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html new file mode 100644 index 000000000..bca7d36d9 --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html @@ -0,0 +1,38 @@ +
test / pack / Some
+

Some

+

typealias Some = SomeCoolJvmClass
+

Platform and version requirements: JVM

+
+

+

class Some
+

Platform and version requirements: JS

+

Constructors

+ + + + + + + +
+<init> + +
Some()
+ +
+

Functions

+ + + + + + + +
+magic + +
fun magic(): Unit
+ +
+
+

diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html new file mode 100644 index 000000000..985f9f04b --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html @@ -0,0 +1,33 @@ +
test / pack
+

Package pack

+

Types

+ + + + + + + +
+Some + +
class Some
+ +
+SomeCoolJvmClass + +
class SomeCoolJvmClass
+ +
+

Type Aliases

+ + + + + +
+Some + +
typealias Some = SomeCoolJvmClass
+ +
diff --git a/core/testdata/format/website-html/dropImport.html b/core/testdata/format/website-html/dropImport.html new file mode 100644 index 000000000..cfcb8cd5e --- /dev/null +++ b/core/testdata/format/website-html/dropImport.html @@ -0,0 +1,11 @@ +
test / foo
+

foo

+ +
fun foo(): Unit
+
import some.*
+
+fun main(args: Array) {
+//sampleStart
+
+//sampleEnd
+}
diff --git a/core/testdata/format/website-html/dropImport.kt b/core/testdata/format/website-html/dropImport.kt new file mode 100644 index 000000000..7b8d9f4e8 --- /dev/null +++ b/core/testdata/format/website-html/dropImport.kt @@ -0,0 +1,12 @@ +import samples.* +import some.* + +/** + * @sample example1 + */ +fun foo() { +} + +fun example1() { + +} \ No newline at end of file diff --git a/core/testdata/format/website-html/newLinesInImportList.html b/core/testdata/format/website-html/newLinesInImportList.html new file mode 100644 index 000000000..4862b314e --- /dev/null +++ b/core/testdata/format/website-html/newLinesInImportList.html @@ -0,0 +1,12 @@ +
test / foo
+

foo

+ +
fun foo(): Unit
+
import same.*
+import some.*
+
+fun main(args: Array) {
+//sampleStart
+
+//sampleEnd
+}
diff --git a/core/testdata/format/website-html/newLinesInImportList.kt b/core/testdata/format/website-html/newLinesInImportList.kt new file mode 100644 index 000000000..836d9f6f0 --- /dev/null +++ b/core/testdata/format/website-html/newLinesInImportList.kt @@ -0,0 +1,12 @@ +import same.* +import some.* + +/** + * @sample example1 + */ +fun foo() { +} + +fun example1() { + +} \ No newline at end of file diff --git a/core/testdata/format/website-html/newLinesInSamples.html b/core/testdata/format/website-html/newLinesInSamples.html new file mode 100644 index 000000000..0babe1228 --- /dev/null +++ b/core/testdata/format/website-html/newLinesInSamples.html @@ -0,0 +1,19 @@ +
test / foo
+

foo

+ +
fun foo(): Unit
+

+
+fun main(args: Array) {
+//sampleStart
+val words = listOf("a", "abc", "ab", "def", "abcd")
+val byLength = words.groupBy { it.length }
+
+println(byLength.keys) // [1, 3, 2, 4]
+println(byLength.values) // [[a], [abc, def], [ab], [abcd]]
+
+val mutableByLength: MutableMap<Int, MutableList<String>> = words.groupByTo(mutableMapOf()) { it.length }
+// same content as in byLength map, but the map is mutable
+println("mutableByLength == byLength is ${mutableByLength == byLength}") // true
+//sampleEnd
+}
diff --git a/core/testdata/format/website-html/newLinesInSamples.kt b/core/testdata/format/website-html/newLinesInSamples.kt new file mode 100644 index 000000000..ee49aefc7 --- /dev/null +++ b/core/testdata/format/website-html/newLinesInSamples.kt @@ -0,0 +1,19 @@ +fun groupBySample() { + val words = listOf("a", "abc", "ab", "def", "abcd") + val byLength = words.groupBy { it.length } + + assertPrints(byLength.keys, "[1, 3, 2, 4]") + assertPrints(byLength.values, "[[a], [abc, def], [ab], [abcd]]") + + val mutableByLength: MutableMap> = words.groupByTo(mutableMapOf()) { it.length } + // same content as in byLength map, but the map is mutable + assertTrue(mutableByLength == byLength) +} + + +/** + * @sample groupBySample + */ +fun foo() { + +} \ No newline at end of file diff --git a/core/testdata/format/website-html/overloadGroup.html b/core/testdata/format/website-html/overloadGroup.html new file mode 100644 index 000000000..2482f8fb6 --- /dev/null +++ b/core/testdata/format/website-html/overloadGroup.html @@ -0,0 +1,18 @@ + +

magic

+

+
fun magic(spell: String): Int
+

Parameters

+

+spell - The text of spell, often distributed on scrolls

+

ReturnSpell ID for future casts

+
+

+

+
fun magic(spell: Int): Int
+

Parameters

+

+spell - Spell ID of previously casted spell

+

ReturnSpell ID for future casts

+
+

diff --git a/core/testdata/format/website-html/overloadGroup.kt b/core/testdata/format/website-html/overloadGroup.kt new file mode 100644 index 000000000..5bc98e3d4 --- /dev/null +++ b/core/testdata/format/website-html/overloadGroup.kt @@ -0,0 +1,15 @@ +/** + * @param spell The text of spell, often distributed on scrolls + * @return Spell ID for future casts + */ +fun magic(spell: String): Int { + +} + +/** + * @param spell Spell ID of previously casted spell + * @return Spell ID for future casts + */ +fun magic(spell: Int): Int { + +} \ No newline at end of file diff --git a/core/testdata/format/website-html/returnTag.html b/core/testdata/format/website-html/returnTag.html new file mode 100644 index 000000000..922531307 --- /dev/null +++ b/core/testdata/format/website-html/returnTag.html @@ -0,0 +1,9 @@ + +

indexOf

+ +
fun Foo.indexOf(
    char: Char,
    startIndex: Int = 0,
    ignoreCase: Boolean = false
): Int
+

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

+

Parameters

+

+ignoreCase - true to ignore character case when matching a character. By default false.

+

ReturnsAn index of the first occurrence of char or -1 if none is found.

diff --git a/core/testdata/format/website-html/returnTag.kt b/core/testdata/format/website-html/returnTag.kt new file mode 100644 index 000000000..669c14f90 --- /dev/null +++ b/core/testdata/format/website-html/returnTag.kt @@ -0,0 +1,11 @@ +class Foo + +/** + * Returns the index within this string of the first occurrence of the specified character, starting from the specified [startIndex]. + * + * @param ignoreCase `true` to ignore character case when matching a character. By default `false`. + * @returns An index of the first occurrence of [char] or -1 if none is found. + */ +fun Foo.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int { + return -1 +} diff --git a/core/testdata/format/website-html/sample.html b/core/testdata/format/website-html/sample.html new file mode 100644 index 000000000..00646a113 --- /dev/null +++ b/core/testdata/format/website-html/sample.html @@ -0,0 +1,21 @@ + +

foo

+

+
fun foo(): Int
+

Groups elements of the original sequence by the key returned by the given keySelector function +applied to each element and returns a map where each group key is associated with a list of corresponding elements.

+

+
+fun main(args: Array) {
+//sampleStart
+if (true) {
+    println(property)
+}
+//sampleEnd
+}
+
+

+

+
fun foo(i: Int): Int
+
+

diff --git a/core/testdata/format/website-html/sample.kt b/core/testdata/format/website-html/sample.kt new file mode 100644 index 000000000..a664c2f52 --- /dev/null +++ b/core/testdata/format/website-html/sample.kt @@ -0,0 +1,16 @@ +/** + * Groups elements of the original sequence by the key returned by the given [keySelector] function + * applied to each element and returns a map where each group key is associated with a list of corresponding elements. + * @sample example1 + */ +fun foo(): Int { + return 0 +} + +fun foo(i: Int): Int { + return 1 +} + +fun example1(node: String) = if (true) { + println(property) +} diff --git a/core/testdata/format/website-html/sampleWithAsserts.html b/core/testdata/format/website-html/sampleWithAsserts.html new file mode 100644 index 000000000..012f91ab7 --- /dev/null +++ b/core/testdata/format/website-html/sampleWithAsserts.html @@ -0,0 +1,12 @@ + +

a

+ +
fun a(): String
+

+
+fun main(args: Array) {
+//sampleStart
+println(a()) // Hello, Work
+println("a() == b() is ${a() == b()}") // true
+//sampleEnd
+}
diff --git a/core/testdata/format/website-html/sampleWithAsserts.kt b/core/testdata/format/website-html/sampleWithAsserts.kt new file mode 100644 index 000000000..bb9732d5c --- /dev/null +++ b/core/testdata/format/website-html/sampleWithAsserts.kt @@ -0,0 +1,15 @@ +/** + * @sample sample + */ +fun a(): String { + return "Hello, Work" +} + +fun b(): String { + return "Hello, Rest" +} + +fun sample() { + assertPrints(a(), "Hello, Work") + assertTrue(a() == b()) +} \ No newline at end of file -- cgit v1.2.3