Skip to content

Commit

Permalink
#296 implement XML representation for symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
zuevval committed Aug 2, 2021
1 parent 32abc4d commit a575f18
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 "<p>$result</p>"
}
}

internal fun breaksToParagraphs(xmlBody: HtmlText): HtmlText {
Expand Down

0 comments on commit a575f18

Please sign in to comment.