From f0c9477a4bf36b3c1b46ae2166d5c28317cb13d6 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Fri, 17 May 2019 11:55:50 -0500 Subject: compact `i:am` signatures when there are no newlines or block starters --- app/lib/bangtags.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index d7a39710b..95d398fff 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -461,7 +461,7 @@ class Bangtags account.save - status.text = @chunks.join('') + status.text = @chunks.join status.save postprocess_after_save @@ -476,9 +476,13 @@ class Bangtags name = @vars['_they:are'] next if name.blank? description = @vars["_they:are:#{name}"] - next if description.blank? || @chunks.last(5).any? {|c| c.include?('—')} + next if description.blank? || @chunks.last(5).join.include?('—') status.local_only = true if Status::LOCAL_ONLY_TOKENS.match?(@chunks.last) - @chunks << "\n\n[right]— #{description}\u200c[/right]" + if @chunks.first(5).any? { |c| c.strip.match?(/[\r\n]/) || c.lstrip.match?(/^(?:[>#]|```|---|\* |\d+\)|\[\wi+)/) } + @chunks << "\n\n[right]— #{description}\u200c[/right]" + else + @chunks << " [rfloat]— #{description}[/rfloat]" + end when 'media' media_idx = post_cmd[1] media_cmd = post_cmd[2] -- cgit