From a575f185613af2eee84716a002742c760508db1c Mon Sep 17 00:00:00 2001 From: zuevval Date: Mon, 2 Aug 2021 14:03:48 +0300 Subject: [PATCH] #296 implement XML representation for symbols --- .../learnbraille/data/entities/ToXmlTest.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/com/github/braillesystems/learnbraille/data/entities/ToXmlTest.kt b/app/src/test/java/com/github/braillesystems/learnbraille/data/entities/ToXmlTest.kt index 42e96a8d..79b1f97a 100644 --- a/app/src/test/java/com/github/braillesystems/learnbraille/data/entities/ToXmlTest.kt +++ b/app/src/test/java/com/github/braillesystems/learnbraille/data/entities/ToXmlTest.kt @@ -7,7 +7,9 @@ import org.junit.Test import com.github.braillesystems.learnbraille.data.entities.BrailleDot.F import com.github.braillesystems.learnbraille.data.entities.BrailleDot.E +import com.github.braillesystems.learnbraille.res.MarkerType import com.github.braillesystems.learnbraille.res.golubinaIntroLessons +import com.github.braillesystems.learnbraille.res.SymbolType import java.io.File internal val testLessons by lessons { @@ -25,7 +27,21 @@ internal fun toXml(brailleDots: BrailleDots): HtmlText { } internal fun toXml(material: Material): HtmlText { - return "TODO" // TODO (not easy) + val sectionType = mapOf( + SymbolType.ru to "RussianSymbols", + SymbolType.digit to "Numbers", + SymbolType.math to "ArithmeticSymbols", + SymbolType.special to "Signs", + SymbolType.greek to "TODO", // TODO + SymbolType.latin to "TODO" // TODO + ) + with(material.data) { + val result = when (this) { + is Symbol -> "${sectionType[this.type]}:${this.char}" + is MarkerSymbol -> "TODO" // TODO consult @braille-systems/ios-development + } + return "

$result

" + } } internal fun breaksToParagraphs(xmlBody: HtmlText): HtmlText {