Skip to content

Commit

Permalink
Make tuncate_mid tool flatten string
Browse files Browse the repository at this point in the history
  • Loading branch information
ejohb committed Jan 20, 2025
1 parent 9dd77e2 commit 6f749f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion fmtr/tools/string_tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
from collections import namedtuple

import re
from string import Formatter
from typing import List

Expand Down Expand Up @@ -86,6 +87,7 @@ def truncate_mid(text, length=None, sep=ELLIPSIS):
Truncate a string to `length` characters in the middle
"""
text = flatten(text)
if len(text) <= length or not length:
return text
half_length = (length - 3) // 2
Expand Down
2 changes: 1 addition & 1 deletion fmtr/tools/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.10
1.0.11

0 comments on commit 6f749f0

Please sign in to comment.