File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/main/kotlin/me/proxer/app/ui/view/bbcode/prototype Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,15 @@ object ColorPrototype : BBPrototype {
21
21
)
22
22
23
23
private val availableColorsForRegex = availableColors.joinToString(" |" ) { it.first }
24
+ private val colorsForRegex = " (#[A-Fa-f0-9]{6}|#[A-Fa-f0-9]{8}|$availableColorsForRegex )"
24
25
25
- override val startRegex = Regex (" \\ s*color\\ s*=\\ s*(#[A-Fa-f0-9]{6}|#[A-Fa-f0-9]{8}|$availableColorsForRegex )\\ s*" ,
26
- RegexOption .IGNORE_CASE )
26
+ override val startRegex = Regex (" \\ s*color\\ s*=\\ s*\" ?$colorsForRegex \" ?\\ s*" , RegexOption .IGNORE_CASE )
27
27
28
28
override val endRegex = Regex (" /\\ s*color\\ s*" , RegexOption .IGNORE_CASE )
29
29
30
30
override fun construct (code : String , parent : BBTree ): BBTree {
31
- val value = code.substringAfter(" =" ).trim()
31
+ val value = code.substringAfter(" =" ).trim().replace(" \" " , " " )
32
+
32
33
val color = when (value.startsWith(" #" )) {
33
34
true -> Color .parseColor(value)
34
35
false -> availableColors.find { it.first == value }?.second
Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ import me.proxer.app.ui.view.bbcode.tree.SizeTree
8
8
*/
9
9
object SizePrototype : BBPrototype {
10
10
11
- override val startRegex = Regex (" \\ s*size\\ s*=\\ s*[1-6]\\ s*" , RegexOption .IGNORE_CASE )
11
+ override val startRegex = Regex (" \\ s*size\\ s*=\\ s*\" ? [1-6]\" ? \\ s*" , RegexOption .IGNORE_CASE )
12
12
override val endRegex = Regex (" /\\ s*size\\ s*" , RegexOption .IGNORE_CASE )
13
13
14
14
override fun construct (code : String , parent : BBTree ): BBTree {
15
- val value = code.substringAfter(" =" ).trim().getOrNull(0 )
15
+ val value = code.substringAfter(" =" ).trim().replace( " \" " , " " ). getOrNull(0 )
16
16
17
17
return when (value) {
18
18
' 1' -> SizeTree (0.4f , parent)
You can’t perform that action at this time.
0 commit comments