mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-18 14:47:15 +00:00
refresh language codes
This commit is contained in:
parent
217e977f0d
commit
a812c2dd2f
@ -78,12 +78,14 @@ private fun printLanguageCodeAndTags(
|
|||||||
indents: String = " "
|
indents: String = " "
|
||||||
): String = if (tag.subtags.isEmpty()) {
|
): String = if (tag.subtags.isEmpty()) {
|
||||||
"""${indents}${baseClassSerializerAnnotationName}
|
"""${indents}${baseClassSerializerAnnotationName}
|
||||||
${indents}object ${tag.title} : ${parent ?.title ?: baseClassName}() { override val code: String = "${tag.tag}" }"""
|
${indents}object ${tag.title} : ${parent ?.title ?: baseClassName}() { override val code: String = "${tag.tag}"; override val withoutDialect: String get() = ${parent ?.title ?.let { "$it.code" } ?: "code"} }"""
|
||||||
} else {
|
} else {
|
||||||
"""
|
"""
|
||||||
${indents}${baseClassSerializerAnnotationName}
|
${indents}${baseClassSerializerAnnotationName}
|
||||||
${indents}sealed class ${tag.title} : ${parent ?.title ?: baseClassName}() {
|
${indents}sealed class ${tag.title} : ${parent ?.title ?: baseClassName}() {
|
||||||
${indents} override val code: String = "${tag.tag}"
|
${indents} override val code: String = "${tag.tag}"
|
||||||
|
${indents} override val withoutDialect: String
|
||||||
|
${indents} get() = code
|
||||||
|
|
||||||
${tag.subtags.joinToString("\n") { printLanguageCodeAndTags(it, tag, "${indents} ") }}
|
${tag.subtags.joinToString("\n") { printLanguageCodeAndTags(it, tag, "${indents} ") }}
|
||||||
|
|
||||||
@ -104,11 +106,14 @@ import kotlinx.serialization.Serializable
|
|||||||
${baseClassSerializerAnnotationName}
|
${baseClassSerializerAnnotationName}
|
||||||
sealed class $baseClassName {
|
sealed class $baseClassName {
|
||||||
abstract val code: String
|
abstract val code: String
|
||||||
|
abstract val withoutDialect: String
|
||||||
|
|
||||||
${tags.joinToString("\n") { printLanguageCodeAndTags(it, indents = " ") } }
|
${tags.joinToString("\n") { printLanguageCodeAndTags(it, indents = " ") } }
|
||||||
|
|
||||||
$baseClassSerializerAnnotationName
|
$baseClassSerializerAnnotationName
|
||||||
data class $unknownBaseClassName (override val code: String) : $baseClassName()
|
data class $unknownBaseClassName (override val code: String) : $baseClassName() {
|
||||||
|
override val withoutDialect: String = code.takeWhile { it != '-' }
|
||||||
|
}
|
||||||
|
|
||||||
override fun toString() = code
|
override fun toString() = code
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user