Skip to content

Commit b71980e

Browse files
mnonnenmachersschuberth
authored andcommitted
docs(website): Use YAML instead of JSON for plugin configs
ORT configuration files use YAML instead of JSON, so use YAML for the example configs for plugins. Signed-off-by: Martin Nonnenmacher <[email protected]>
1 parent 0f156a5 commit b71980e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

buildSrc/src/main/kotlin/GeneratePluginDocsTask.kt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ abstract class GeneratePluginDocsTask : DefaultTask() {
9999
// Write example configuration.
100100
appendLine("### Example")
101101
appendLine()
102-
appendLine("```json")
103-
appendLine("{")
104-
appendLine(" \"${descriptor["id"]}\": {")
102+
appendLine("```yaml")
103+
appendLine("${descriptor["id"]}:")
105104

106105
fun appendOptions(options: List<Map<*, *>>) {
107106
options.forEachIndexed { index, option ->
@@ -110,31 +109,24 @@ abstract class GeneratePluginDocsTask : DefaultTask() {
110109
val isStringValue =
111110
(type == "SECRET" || type == "STRING" || type == "STRING_LIST") && defaultValue != null
112111

113-
append(" \"${option["name"]}\": ")
112+
append(" ${option["name"]}: ")
114113
if (isStringValue) append("\"")
115114
append(defaultValue)
116115
if (isStringValue) append("\"")
117-
if (index < options.size - 1) append(",")
118116
appendLine()
119117
}
120118
}
121119

122120
if (options.isNotEmpty()) {
123-
appendLine(" \"options\": {")
121+
appendLine(" options:")
124122
appendOptions(options)
125-
append(" }")
126-
if (secrets.isNotEmpty()) append(",")
127-
appendLine()
128123
}
129124

130125
if (secrets.isNotEmpty()) {
131-
appendLine(" \"secrets\": {")
126+
appendLine(" secrets:")
132127
appendOptions(secrets)
133-
appendLine(" }")
134128
}
135129

136-
appendLine(" }")
137-
appendLine("}")
138130
appendLine("```")
139131
appendLine()
140132
appendLine("### Options")

0 commit comments

Comments
 (0)