diff --git a/common/parser.go b/common/parser.go index dd7bbf94..69b5f9e9 100644 --- a/common/parser.go +++ b/common/parser.go @@ -219,6 +219,7 @@ func PreparseMessage(msg string) string { 'u': []string{""}, 'b': []string{"", "lockquote"}, 'i': []string{""}, + //'p': []string{""}, 'g': []string{""}, // Quick and dirty fix for Grammarly } var buildLitMatch = func(tag string) func(*TagToAction, bool, int, []rune) (int, string) { @@ -266,6 +267,7 @@ func PreparseMessage(msg string) string { &TagToAction{"lockquote", buildLitMatch("blockquote"), 0, false}, }, 'i': []*TagToAction{&TagToAction{"", buildLitMatch("em"), 0, false}}, + //'p': []*TagToAction{&TagToAction{"", buildLitMatch2("\n\n", ""), 0, false}}, 'g': []*TagToAction{ &TagToAction{"", func(act *TagToAction, open bool, i int, runes []rune) (int, string) { if open { @@ -290,7 +292,13 @@ func PreparseMessage(msg string) string { // TODO: Implement a less literal parser for i := 0; i < len(runes); i++ { char := runes[i] - if char == '&' && peekMatch(i, "lt;", runes) { + // TODO: Make the slashes escapable too in case someone means to use a literaly slash, maybe as an example of how to escape elements? + if char == '\\' { + if peekMatch(i, "<", runes) { + msg += "&" + i++ + } + } else if char == '&' && peekMatch(i, "lt;", runes) { var ok bool i, ok = tryStepForward(i, 4, runes) if !ok { diff --git a/extend/guilds/plugin_guilds.go b/extend/guilds/plugin_guilds.go index 2b8d51af..ecb0b31c 100644 --- a/extend/guilds/plugin_guilds.go +++ b/extend/guilds/plugin_guilds.go @@ -113,8 +113,7 @@ func installGuilds(plugin *common.Plugin) error { qgen.DBTableColumn{"rank", "int", 0, false, false, "0"}, /* 0: Member. 1: Mod. 2: Admin. */ qgen.DBTableColumn{"posts", "int", 0, false, false, "0"}, /* Per-Group post count. Should we do some sort of score system? */ qgen.DBTableColumn{"joinedAt", "datetime", 0, false, false, ""}, - }, - []qgen.DBTableKey{}, + }, nil, ) if err != nil { return err diff --git a/parser_test.go b/parser_test.go index f097f44e..5ed85ae3 100644 --- a/parser_test.go +++ b/parser_test.go @@ -73,10 +73,18 @@ func TestPreparser(t *testing.T) { msgList.Add("", "") msgList.Add("", "") msgList.Add("", "") + msgList.Add("", "") + msgList.Add("", "") msgList.Add("<>", "<></>") msgList.Add("<>", "</><>") msgList.Add("<>", "<>") msgList.Add("", "</>") + msgList.Add("

hi

", "hi") + msgList.Add("

", "") + msgList.Add("
hi
", "
hi
") + msgList.Add("
hi
", "
hi
") + msgList.Add("
hi
", "
<meow>hi</meow>
") + msgList.Add("\\
hi
", "<blockquote>hi</blockquote>") msgList.Add("@", "@") msgList.Add("@Admin", "@1") msgList.Add("@Bah", "@Bah")