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

RSPEC tag links for context when browsing recipes #112

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ class RecipeMarkdownGenerator : Runnable {
val docLink =
docBaseUrl + recipeDescriptor.name.lowercase(Locale.getDefault()).removePrefix("org.openrewrite.")
.replace('.', '/')
.replace("$", "usd") // needed for refaster templates + gitbook as we have started using $ in our recipe descriptors :(
.replace(
"$",
"usd"
) // needed for refaster templates + gitbook as we have started using $ in our recipe descriptors :(

val recipeSource = recipeDescriptor.source.toString()
var isImperative = true
Expand Down Expand Up @@ -777,7 +780,13 @@ class RecipeMarkdownGenerator : Runnable {
writeln("### Tags")
newLine()
for (tag in recipeDescriptor.tags) {
writeln("* $tag")
if (tag.lowercase().startsWith("rspec-s")) {
writeln("* [$tag](https://sonarsource.github.io/rspec/#/rspec/${tag.substring(6)})")
} else if (tag.lowercase().startsWith("rspec-")) {
writeln("* [$tag](https://sonarsource.github.io/rspec/#/rspec/S${tag.substring(6)})")
} else {
writeln("* $tag")
}
}
newLine()
}
Expand Down Expand Up @@ -837,7 +846,7 @@ class RecipeMarkdownGenerator : Runnable {
"[${match.value}](/reference/method-patterns.md)"
}
// Add valid options to description
if (option.valid?.isNotEmpty()?: false) {
if (option.valid?.isNotEmpty() ?: false) {
description += " Valid options: " + option.valid?.joinToString { "`$it`" }
}
// Preserve table cell formatting for multiline examples
Expand Down
Loading