diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-05-17 11:55:50 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:23 -0500 |
commit | f0c9477a4bf36b3c1b46ae2166d5c28317cb13d6 (patch) | |
tree | ce55f4b195f5bfbdef90ef94ba042d717667cdcd /app/lib | |
parent | 21c37307034cfea888b8227fbf5f031872207ff3 (diff) |
compact `i:am` signatures when there are no newlines or block starters
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/bangtags.rb | 10 |
1 files changed, 7 insertions, 3 deletions
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] |