mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-01 18:31:35 +00:00
Don't remove hashtags if post is only hashtags
This commit is contained in:
parent
36530e5db4
commit
21875a8e83
2 changed files with 22 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ function structure(text) {
|
|||
* Edit a structure in-place to remove trailing hashtags and separator characters.
|
||||
*/
|
||||
function removeTrailingHashtags(structured) {
|
||||
let original = structured.slice()
|
||||
let hasHashtags = structured.some(part => part.type === "hashtag")
|
||||
let seenHashtags = false
|
||||
|
||||
|
|
@ -111,6 +112,7 @@ function removeTrailingHashtags(structured) {
|
|||
|
||||
while (shouldRemoveLastPart()) {
|
||||
structured.pop()
|
||||
if (structured.length === 0) return original
|
||||
}
|
||||
|
||||
return structured
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue