diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:01:57 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:01:57 +0000 |
commit | 64769040d196139ecb1a70883b923bb3d86327f8 (patch) | |
tree | 77dc031614745bb406dbd90cea9a082a1b5cdd54 /cros_utils/html_tools.py | |
parent | 94cf0e3aac8620e8d9a3eb6356f6229293ac5a59 (diff) | |
parent | 40214b48188358a80b7478bfff21d4814dd9177c (diff) | |
download | toolchain-utils-64769040d196139ecb1a70883b923bb3d86327f8.tar.gz |
Snap for 10453563 from 40214b48188358a80b7478bfff21d4814dd9177c to mainline-extservices-releaseaml_ext_341716000aml_ext_341620040aml_ext_341518010aml_ext_341414010aml_ext_341317010aml_ext_341131030aml_ext_341027030android14-mainline-extservices-release
Change-Id: Ic68e29ad0fec09d765a40aed7465d9f33d38ef8d
Diffstat (limited to 'cros_utils/html_tools.py')
-rw-r--r-- | cros_utils/html_tools.py | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/cros_utils/html_tools.py b/cros_utils/html_tools.py index 688955ff..202bef05 100644 --- a/cros_utils/html_tools.py +++ b/cros_utils/html_tools.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2019 The Chromium OS Authors. All rights reserved. +# Copyright 2019 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -7,7 +7,8 @@ def GetPageHeader(page_title): - return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + return ( + """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> @@ -32,64 +33,68 @@ function displayRow(id){ </head> <body> -""" % page_title +""" + % page_title + ) def GetListHeader(): - return '<ul>' + return "<ul>" def GetListItem(text): - return '<li>%s</li>' % text + return "<li>%s</li>" % text def GetListFooter(): - return '</ul>' + return "</ul>" def GetList(items): - return '<ul>%s</ul>' % ''.join(['<li>%s</li>' % item for item in items]) + return "<ul>%s</ul>" % "".join(["<li>%s</li>" % item for item in items]) def GetParagraph(text): - return '<p>%s</p>' % text + return "<p>%s</p>" % text def GetFooter(): - return '</body>\n</html>' + return "</body>\n</html>" def GetHeader(text, h=1): - return '<h%s>%s</h%s>' % (h, text, h) + return "<h%s>%s</h%s>" % (h, text, h) def GetTableHeader(headers): - row = ''.join(['<th>%s</th>' % header for header in headers]) - return '<table><tr>%s</tr>' % row + row = "".join(["<th>%s</th>" % header for header in headers]) + return "<table><tr>%s</tr>" % row def GetTableFooter(): - return '</table>' + return "</table>" def FormatLineBreaks(text): - return text.replace('\n', '<br/>') + return text.replace("\n", "<br/>") def GetTableCell(text): - return '<td>%s</td>' % FormatLineBreaks(str(text)) + return "<td>%s</td>" % FormatLineBreaks(str(text)) def GetTableRow(columns): - return '<tr>%s</tr>' % '\n'.join([GetTableCell(column) for column in columns]) + return "<tr>%s</tr>" % "\n".join( + [GetTableCell(column) for column in columns] + ) def GetTable(headers, rows): - table = [GetTableHeader(headers)] - table.extend([GetTableRow(row) for row in rows]) - table.append(GetTableFooter()) - return '\n'.join(table) + table = [GetTableHeader(headers)] + table.extend([GetTableRow(row) for row in rows]) + table.append(GetTableFooter()) + return "\n".join(table) def GetLink(link, text): - return "<a href='%s'>%s</a>" % (link, text) + return "<a href='%s'>%s</a>" % (link, text) |