Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable copy button for signatures #2577

Merged
merged 3 commits into from Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
Expand Up @@ -95,7 +95,6 @@ open class HtmlRenderer(
}
node.dci.kind in setOf(ContentKind.Symbol) -> div("symbol $additionalClasses") {
childrenCallback()
if (node.hasStyle(TextStyle.Monospace)) copyButton()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only real change in this PR. The rest is either formatting or to make tests pass

}
node.hasStyle(TextStyle.BreakableAfter) -> {
span { childrenCallback() }
Expand Down Expand Up @@ -472,9 +471,9 @@ open class HtmlRenderer(
div {
it.build(this, pageContext, sourceSetRestriction)
}
if (it is ContentLink && !anchorDestination.isNullOrBlank()) buildAnchorCopyButton(
anchorDestination
)
if (it is ContentLink && !anchorDestination.isNullOrBlank()) {
buildAnchorCopyButton(anchorDestination)
}
}
}
}
Expand Down
Expand Up @@ -58,7 +58,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": (", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": (", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -77,7 +77,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": (", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": (", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -96,7 +96,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -115,7 +115,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": (param: ", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": (param: ", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -141,7 +141,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
"fun <", A("T"), "> ",
A("f"), "(): (param1:", A("T"),
", param2: ", Span("@", A("Fancy")), " () -> ", A("Unit"),
") -> ", A("String"), Span(),
") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -160,7 +160,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -179,7 +179,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -198,7 +198,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": suspend ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": suspend ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -217,7 +217,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
"val ", A("nF"), ": suspend (param: ", A("Int"), ") -> ", A("String"), Span(),
"val ", A("nF"), ": suspend (param: ", A("Int"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -249,8 +249,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
A("Boolean"),
") -> ",
A("String"),
Span(),
ignoreSpanWithTokenStyle = true
ignoreSpanWithTokenStyle = true
)
}
}
Expand All @@ -275,7 +274,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-java-class/index.html").lastSignature().match(
"open var ", A("javaFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
"open var ", A("javaFunction"), ": (", A("Integer"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -301,7 +300,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-java-class/index.html").lastSignature().match(
"open var ", A("kotlinFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
"open var ", A("kotlinFunction"), ": (", A("Integer"), ") -> ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down
Expand Up @@ -54,7 +54,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[2]
property.match(
"var ", A("a"), ":", A("Int"), Span(),
"var ", A("a"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -68,7 +68,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[1]
property.match(
"open var ", A("a"), ":", A("Int"), Span(),
"open var ", A("a"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -102,7 +102,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[2]
property.match(
"val ", A("a"), ":", A("Int"), Span(),
"val ", A("a"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -113,7 +113,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[1]
property.match(
"open val ", A("a"), ":", A("Int"), Span(),
"open val ", A("a"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -149,7 +149,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
setterFunction.match(
"open fun ", A("setA"), "(", Parameters(
Parameter("a: ", A("Int"))
), ")", Span(),
), ")",
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -162,7 +162,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
setterFunction.match(
"open fun ", A("setA"), "(", Parameters(
Parameter("a: ", A("Int"))
), ")", Span(),
), ")",
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -199,21 +199,21 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val getterLookalikeFunction = signatures[2]
getterLookalikeFunction.match(
"open fun ", A("getA"), "():", A("Int"), Span(),
"open fun ", A("getA"), "():", A("Int"),
ignoreSpanWithTokenStyle = true
)

val setterLookalikeFunction = signatures[3]
setterLookalikeFunction.match(
"open fun ", A("setA"), "(", Parameters(
Parameter("a: ", A("Int"))
), ")", Span(),
), ")",
ignoreSpanWithTokenStyle = true
)

val property = signatures[4]
property.match(
"var ", A("a"), ":", A("Int"), Span(),
"var ", A("a"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -245,7 +245,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[1]
property.match(
"open var ", A("variable"), ": ", Span("String"), Span(),
"open var ", A("variable"), ": ", Span("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -280,7 +280,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[2]
property.match(
"var ", A("variable"), ": ", A("String"), Span(),
"var ", A("variable"), ": ", A("String"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -294,15 +294,15 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val getter = signatures[1]
getter.match(
"fun ", A("getVariable"), "(): ", Span("String"), Span(),
"fun ", A("getVariable"), "(): ", Span("String"),
ignoreSpanWithTokenStyle = true
)

val setter = signatures[2]
setter.match(
"fun ", A("setVariable"), "(", Parameters(
Parameter("value: ", Span("String"))
), ")", Span(),
), ")",
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -360,7 +360,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[2]
property.match(
"protected var ", A("protectedGetterAndProtectedSetter"), ":", A("Int"), Span(),
"protected var ", A("protectedGetterAndProtectedSetter"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand All @@ -371,7 +371,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[1]
property.match(
"protected open var ", A("protectedGetterAndProtectedSetter"), ":", A("Int"), Span(),
"protected open var ", A("protectedGetterAndProtectedSetter"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down Expand Up @@ -421,7 +421,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {

val property = signatures[2]
property.match(
"protected var ", A("protectedProperty"), ":", A("Int"), Span(),
"protected var ", A("protectedProperty"), ":", A("Int"),
ignoreSpanWithTokenStyle = true
)
}
Expand Down