From cc9d11576282e3d73d5330fa0854e315342a3071 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 21 Aug 2020 11:12:08 +0200 Subject: [PATCH] InlineTags: Handle case of #a#b as two tags --- lib/core/processors/inline_tags.dart | 5 ++++- test/processors/inline_tags_test.dart | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/core/processors/inline_tags.dart b/lib/core/processors/inline_tags.dart index b7fcfa5a..eb29c89c 100644 --- a/lib/core/processors/inline_tags.dart +++ b/lib/core/processors/inline_tags.dart @@ -19,7 +19,10 @@ class InlineTagsProcessor { tag = tag.substring(0, tag.length - 1); } - tags.add(tag); + var all = tag.split('#'); + for (var t in all) { + tags.add(t.trim()); + } } } diff --git a/test/processors/inline_tags_test.dart b/test/processors/inline_tags_test.dart index 9aa9d9bb..3352802f 100644 --- a/test/processors/inline_tags_test.dart +++ b/test/processors/inline_tags_test.dart @@ -21,7 +21,15 @@ void main() { expect(tags, {'tag'}); }); - // #a#b should be counted as two tags + test('#a#b should be counted as two tags', () { + var body = "Hi there #a#b"; + + var p = InlineTagsProcessor(); + var tags = p.extractTags(body); + + expect(tags, {'a', 'b'}); + }); + // + should work as a prefix // @ should work as a prefix // test for tags with non-ascii words