You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "cvaliente (via GitHub)" <gi...@apache.org> on 2023/06/30 04:48:40 UTC

[GitHub] [airflow] cvaliente commented on a diff in pull request #32042: Render list items in rendered fields view

cvaliente commented on code in PR #32042:
URL: https://github.com/apache/airflow/pull/32042#discussion_r1247431541


##########
airflow/www/utils.py:
##########
@@ -546,20 +547,35 @@ def pygment_html_render(s, lexer=lexers.TextLexer):
     return highlight(s, lexer(), HtmlFormatter(linenos=True))
 
 
-def render(obj, lexer):
+def render(obj: Any, lexer: Lexer, handler: Optional[Callable[[Any], str]] = None):
     """Render a given Python object with a given Pygments lexer."""
-    out = ""
+
     if isinstance(obj, str):
-        out = Markup(pygment_html_render(obj, lexer))
-    elif isinstance(obj, (tuple, list)):
+        return Markup(pygment_html_render(obj, lexer))
+
+    if isinstance(obj, (tuple, list)):
+        out = ""
         for i, text_to_render in enumerate(obj):
+            if lexer == lexers.PythonLexer:

Review Comment:
   fixed, thanks :) 



##########
airflow/www/utils.py:
##########
@@ -546,20 +547,35 @@ def pygment_html_render(s, lexer=lexers.TextLexer):
     return highlight(s, lexer(), HtmlFormatter(linenos=True))
 
 
-def render(obj, lexer):
+def render(obj: Any, lexer: Lexer, handler: Optional[Callable[[Any], str]] = None):
     """Render a given Python object with a given Pygments lexer."""
-    out = ""
+
     if isinstance(obj, str):
-        out = Markup(pygment_html_render(obj, lexer))
-    elif isinstance(obj, (tuple, list)):
+        return Markup(pygment_html_render(obj, lexer))
+
+    if isinstance(obj, (tuple, list)):

Review Comment:
   fixed, thanks :) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org