feat: 全ての絵文字が収録されるように

This commit is contained in:
usbharu 2024-01-05 14:24:50 +09:00
parent 9bf3248757
commit af496662b3
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
1 changed files with 20 additions and 3 deletions

View File

@ -50,11 +50,22 @@ class EmojiPlugin : Plugin<Project> {
else -> { else -> {
val description = s.substringAfterLast("E").substringAfter(" ") val description = s.substringAfterLast("E").substringAfter(" ")
val status = s.substringAfter(";").substringBefore("#").trim() val status = s.substringAfter(";").substringBefore("#").trim()
if (!description.contains("skin tone") && !status.contains("unqualified")) { if (true) {
val code = val code =
s.substringBefore(";").replace(Regex(" +"), " ").trim() s.substringBefore(";").replace(Regex(" +"), " ").trim()
val char = s.substringAfter("# ").substringBefore(" ").trim() val char = s.substringAfter("# ").substringBefore(" ").trim()
val statusString = when(status){
"fully-qualified" -> "Status.FULLY_QUALIFIED"
"unqualified" -> "Status.UNAUALIFIED"
"minimally-qualified" -> "Status.MINIMALLY_QUALIFIED"
else -> {
break
}
}
enumList.put( enumList.put(
description, description,
Emoji( Emoji(
@ -96,7 +107,7 @@ class EmojiPlugin : Plugin<Project> {
.replace("Ô", "O") .replace("Ô", "O")
.replace("Ç", "C") .replace("Ç", "C")
.replace(Regex("_+"), "_") .replace(Regex("_+"), "_")
}(\"$group\",\"$subgroup\",\"$code\",\"$char\",\"$description\")" }(\"$group\",\"$subgroup\",\"$code\",\"$char\",\"$description\",$statusString)"
) )
) )
} }
@ -111,7 +122,7 @@ class EmojiPlugin : Plugin<Project> {
} }
val map = emojis.map { val map = emojis.map {
"enum class ${it.key}(override val group:String,override val subgroup:String,override val code:String,override val char:String,override val description:String):UnicodeEmoji{\n" + "enum class ${it.key}(override val group:String,override val subgroup:String,override val code:String,override val char:String,override val description:String,val status:Status):UnicodeEmoji{\n" +
"${ "${
it.value.map { it.value }.joinToString( it.value.map { it.value }.joinToString(
",\n" ",\n"
@ -131,6 +142,12 @@ interface UnicodeEmoji {
val description: String val description: String
} }
enum class Status{
FULLY_QUALIFIED,
UNAUALIFIED,
MINIMALLY_QUALIFIED
}
object Emojis { object Emojis {
val allEmojis:MutableList<UnicodeEmoji> = mutableListOf<UnicodeEmoji>() val allEmojis:MutableList<UnicodeEmoji> = mutableListOf<UnicodeEmoji>()
init { init {