@@ -2,6 +2,7 @@ package org.openrewrite
22
33import com.github.difflib.DiffUtils
44import com.github.difflib.patch.Patch
5+ import org.openrewrite.RecipeMarkdownGenerator.Companion.getRecipePath
56import org.openrewrite.config.RecipeDescriptor
67import org.openrewrite.RecipeMarkdownGenerator.Companion.useAndApply
78import org.openrewrite.RecipeMarkdownGenerator.Companion.writeln
@@ -29,7 +30,7 @@ class RecipeMarkdownWriter(val recipeContainedBy: MutableMap<String, MutableSet<
2930 val formattedRecipeDescription = getFormattedRecipeDescription(recipeDescriptor.description)
3031 val formattedLongRecipeName = recipeDescriptor.name.replace(" _" .toRegex(), " \\\\ _" ).trim()
3132
32- val recipeMarkdownPath = outputPath.resolve(RecipeMarkdownGenerator . getRecipePath(recipeDescriptor) + " .md" )
33+ val recipeMarkdownPath = outputPath.resolve(getRecipePath(recipeDescriptor) + " .md" )
3334 Files .createDirectories(recipeMarkdownPath.parent)
3435 Files .newBufferedWriter(recipeMarkdownPath, StandardOpenOption .CREATE ).useAndApply {
3536 write(
@@ -543,36 +544,20 @@ import TabItem from '@theme/TabItem';
543544 <TabItem value="recipe-list" label="Recipe List" >
544545 """ .trimIndent()
545546 )
546- val recipeDepth = RecipeMarkdownGenerator . getRecipePath(recipeDescriptor).chars().filter { ch: Int -> ch == ' /' .code }.count()
547+ val recipeDepth = getRecipePath(recipeDescriptor).chars().filter { ch: Int -> ch == ' /' .code }.count()
547548 val pathToRecipesBuilder = StringBuilder ()
548549 for (i in 0 until recipeDepth) {
549550 pathToRecipesBuilder.append(" ../" )
550551 }
551552 val pathToRecipes = pathToRecipesBuilder.toString()
552553
553- // These recipes contain other recipes that are not parseable.
554- // Until we support this - let's remove links for these recipes.
555- // https://github.com/openrewrite/rewrite-spring/issues/601
556- val recipesThatShouldHaveLinksRemoved = listOf (
557- " org.openrewrite.java.spring.boot2.MigrateDatabaseCredentials" ,
558- " org.openrewrite.java.spring.PropertiesToKebabCase"
559- )
560-
561554 for (recipe in recipeDescriptor.recipeList) {
562555 // https://github.com/openrewrite/rewrite-docs/issues/250
563556 if (recipe.displayName == " Precondition bellwether" ) {
564557 continue
565558 }
566559
567- if (recipesThatShouldHaveLinksRemoved.contains(recipeDescriptor.name)) {
568- writeln(" * ${recipe.displayNameEscaped()} " )
569- } else {
570- writeln(
571- " * [" + recipe.displayNameEscaped() + " ](" + pathToRecipes + RecipeMarkdownGenerator .getRecipePath(
572- recipe
573- ) + " )"
574- )
575- }
560+ writeln(" * [${recipe.displayNameEscaped()} ]($pathToRecipes " + getRecipePath(recipe) + " )" )
576561
577562 if (recipe.options.isNotEmpty()) {
578563 for (option in recipe.options) {
@@ -622,7 +607,7 @@ import TabItem from '@theme/TabItem';
622607 """ .trimIndent()
623608 )
624609 recipeContainedBy
625- .map { " * [${it.displayNameEscaped()} ](/recipes/${RecipeMarkdownGenerator . getRecipePath(it)} .md)" }
610+ .map { " * [${it.displayNameEscaped()} ](/recipes/${getRecipePath(it)} .md)" }
626611 .toSet()
627612 .sorted()
628613 .forEach { recipe -> writeln(recipe) }
0 commit comments