From e668f7f5384dd99543a923d29f71e76a4932dd44 Mon Sep 17 00:00:00 2001 From: Daiyi Peng Date: Tue, 10 Dec 2024 12:35:20 -0800 Subject: [PATCH] Tune HTML views for message and schema. 1) Message to use normal font size. 2) Schema to escape characters in HTML. PiperOrigin-RevId: 704808683 --- langfun/core/message.py | 1 - langfun/core/message_test.py | 1 - langfun/core/structured/schema.py | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/langfun/core/message.py b/langfun/core/message.py index bc2d5cd..9d18e0e 100644 --- a/langfun/core/message.py +++ b/langfun/core/message.py @@ -769,7 +769,6 @@ def _html_tree_view_css_styles(cls) -> list[str]: padding: 20px; margin: 10px 5px 10px 5px; font-style: italic; - font-size: 1.1em; white-space: pre-wrap; border: 1px solid #EEE; border-radius: 5px; diff --git a/langfun/core/message_test.py b/langfun/core/message_test.py index cdaeae5..21cfa0b 100644 --- a/langfun/core/message_test.py +++ b/langfun/core/message_test.py @@ -380,7 +380,6 @@ def test_html_style(self): padding: 20px; margin: 10px 5px 10px 5px; font-style: italic; - font-size: 1.1em; white-space: pre-wrap; border: 1px solid #EEE; border-radius: 5px; diff --git a/langfun/core/structured/schema.py b/langfun/core/structured/schema.py index efae2b9..ad30c23 100644 --- a/langfun/core/structured/schema.py +++ b/langfun/core/structured/schema.py @@ -201,7 +201,7 @@ def _html_tree_view_content( ): return pg.Html.element( 'div', - [self.schema_str(protocol='python')], + [pg.Html.escape(self.schema_str(protocol='python'))], css_classes=['lf-schema-definition'] ).add_style( """