Jesus they're not BBCode... They're html and bbcode and markdown
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
/// Utility class to convert BBCode to Markdown for RimWorld mod descriptions
|
||||
library bbcode_converter;
|
||||
|
||||
import 'dart:math' as math;
|
||||
|
||||
class BBCodeConverter {
|
||||
@@ -21,10 +23,10 @@ class BBCodeConverter {
|
||||
// Fix unclosed tags - RimWorld descriptions often have unclosed tags
|
||||
final List<String> tagTypes = ['b', 'i', 'color', 'size', 'url', 'code', 'quote'];
|
||||
for (final tag in tagTypes) {
|
||||
final openCount = '[${tag}'.allMatches(result).length;
|
||||
final closeCount = '[/${tag}]'.allMatches(result).length;
|
||||
final openCount = '[$tag'.allMatches(result).length;
|
||||
final closeCount = '[/$tag]'.allMatches(result).length;
|
||||
if (openCount > closeCount) {
|
||||
result = result + '[/${tag}]' * (openCount - closeCount);
|
||||
result = result + '[/$tag]' * (openCount - closeCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user