Collapse long Constants block by default

This commit is contained in:
aNNiMON 2023-11-27 19:54:01 +02:00 committed by Victor Melnik
parent 3cafd29221
commit 779f4f9368

View File

@ -45,7 +45,8 @@ messages = {
"functions": {"en": "Functions", "ru": "Функции"}, "functions": {"en": "Functions", "ru": "Функции"},
"types": {"en": "Types", "ru": "Типы"}, "types": {"en": "Types", "ru": "Типы"},
"example": {"en": "Example", "ru": "Пример"}, "example": {"en": "Example", "ru": "Пример"},
"since": {"en": "Since", "ru": "Начиная с"} "since": {"en": "Since", "ru": "Начиная с"},
"elements": {"en": " elements", "ru": " элементов"}
} }
// Write modules pages to vuepress config // Write modules pages to vuepress config
@ -104,11 +105,13 @@ def writeConstants(f, constants, lang) {
} else { } else {
mapValues = constValue.substring(1, constValue.length - 1).split(", ") mapValues = constValue.substring(1, constValue.length - 1).split(", ")
if (mapValues.length >= 7) { if (mapValues.length >= 7) {
writeText(f, "\n\n```own\n{\n "); writeText(f, "\n\n::: details %d %s".sprintf(mapValues.length, messages.elements[lang]));
writeText(f, mapValues.joinToString(",\n ")); writeText(f, "\n\n```own:no-line-numbers\n{\n ");
writeText(f, "\n}\n```"); writeText(f, mapValues.joinToString(",\n "));
writeText(f, "\n}\n```");
writeText(f, "\n:::");
} else { } else {
writeText(f, "`%s`".sprintf(constValue)); writeText(f, "`%s`".sprintf(constValue));
} }
} }
writeLine(f, "") writeLine(f, "")