From 688a25eb832c87e3a57a33a37ba74a3640524bda Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Tue, 2 Jun 2020 19:48:43 +0200 Subject: [PATCH] Fix #67 --- src/data/keyword.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/data/keyword.cpp b/src/data/keyword.cpp index d618ad3e..6f4efbc6 100644 --- a/src/data/keyword.cpp +++ b/src/data/keyword.cpp @@ -502,7 +502,7 @@ String expand_keywords(const String& tagged_str, vector const& mat if (is_tag(it, end, " const& mat skip_tags_for_keyword(false, true); if (it == end) break; // is there a match here? - if (atom == 0) // don't expand keywords that are inside tags - while (match_it != matches.end() && match_it->pos <= untagged_pos) { - if (match_it->pos > untagged_pos) { - ++match_it; - continue; - } - // try to expand - auto [match,new_it] = expand_keyword(it, end, *match_it, expand_type, out, options); - if (match) { - untagged_pos += untagged_length(it,new_it); - it = new_it; - ++match_it; - goto after_match; - } else { - ++match_it; + if (atom == 0) { + // don't expand keywords that are inside tags + while (match_it != matches.end() && match_it->pos <= untagged_pos) { + if (match_it->pos > untagged_pos) { + ++match_it; + continue; + } + // try to expand + auto [match,new_it] = expand_keyword(it, end, *match_it, expand_type, out, options); + if (match) { + untagged_pos += untagged_length(it,new_it); + it = new_it; + ++match_it; + goto after_match; + } else { + ++match_it; + } } } // No match, so there is at least one character not part of a keyword