MCPcopy
hub / github.com/django/django / calculate_truncate_chars_length

Function calculate_truncate_chars_length

django/utils/text.py:89–96  ·  view source on GitHub ↗
(length, replacement)

Source from the content-addressed store, hash-verified

87
88
89def calculate_truncate_chars_length(length, replacement):
90 truncate_len = length
91 for char in add_truncation_text("", replacement):
92 if not unicodedata.combining(char):
93 truncate_len -= 1
94 if truncate_len == 0:
95 break
96 return truncate_len
97
98
99class TruncateHTMLParser(HTMLParser):

Callers 2

__init__Method · 0.85
_text_charsMethod · 0.85

Calls 1

add_truncation_textFunction · 0.85

Tested by

no test coverage detected