mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
truncate_cells_html now affects URLs too, refs #1805
This commit is contained in:
parent
ff9c87197d
commit
d0737e4de5
8 changed files with 68 additions and 14 deletions
|
|
@ -24,6 +24,7 @@ from datasette.utils import (
|
|||
path_with_removed_args,
|
||||
path_with_replaced_args,
|
||||
to_css_class,
|
||||
truncate_url,
|
||||
urlsafe_components,
|
||||
value_as_boolean,
|
||||
)
|
||||
|
|
@ -966,8 +967,11 @@ async def display_columns_and_rows(
|
|||
display_value = markupsafe.Markup(" ")
|
||||
elif is_url(str(value).strip()):
|
||||
display_value = markupsafe.Markup(
|
||||
'<a href="{url}">{url}</a>'.format(
|
||||
url=markupsafe.escape(value.strip())
|
||||
'<a href="{url}">{truncated_url}</a>'.format(
|
||||
url=markupsafe.escape(value.strip()),
|
||||
truncated_url=markupsafe.escape(
|
||||
truncate_url(value.strip(), truncate_cells)
|
||||
),
|
||||
)
|
||||
)
|
||||
elif column in table_metadata.get("units", {}) and value != "":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue