MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / format_email_html

Function format_email_html

tools/release_converter.py:148–237  ·  view source on GitHub ↗

Formats the extracted data into HTML suitable for email.

(data, skip_issues_set=None)

Source from the content-addressed store, hash-verified

146
147
148def format_email_html(data, skip_issues_set=None):
149 """Formats the extracted data into HTML suitable for email."""
150 if skip_issues_set is None:
151 skip_issues_set = set()
152 if not data.get('version'):
153 return "<p>Error: Version not found in parsed data.</p>"
154
155 version = data['version']
156 release_url = (
157 f"https://www.pgadmin.org/docs/pgadmin4/{version}/"
158 f"release_notes_{version.replace('.', '_')}.html"
159 )
160 download_url = "https://www.pgadmin.org/download/"
161 website_url = "https://www.pgadmin.org/"
162
163 # Filter lists first based on skip_issues_set
164 filtered_features = [
165 item for item in data.get('features', [])
166 if item.get('issue') not in skip_issues_set
167 ]
168 filtered_bugs = [
169 item for item in data.get('bugs_housekeeping', [])
170 if item.get('issue') not in skip_issues_set
171 ]
172 num_features = len(filtered_features)
173 num_bugs_housekeeping = len(filtered_bugs)
174
175 # Build HTML output
176 output = """<style>
177 * {
178 font-size: 14px;
179 font-family: sans-serif;
180 }
181 li {
182 margin-bottom: 4px;
183 }
184 </style>"""
185 output += (
186 f"<p>The pgAdmin Development Team is pleased to announce "
187 f"pgAdmin 4 version {version}.</p>\n"
188 )
189 output += (
190 f"<p>This release of pgAdmin 4 includes "
191 f"{pluralize(num_features, 'new feature')} and "
192 f"{pluralize(num_bugs_housekeeping, 'bug fix', 'bug fixes')}/"
193 f"housekeeping change"
194 f"{'s' if num_bugs_housekeeping != 1 else ''}. "
195 )
196 output += (
197 f'For more details please see the release notes at:'
198 f'<p>&nbsp;&nbsp;&nbsp;&nbsp;'
199 f'<a href="{release_url}">{release_url}</a></p>\n'
200 )
201 output += (
202 '<p>pgAdmin is the leading Open Source graphical management '
203 'tool for PostgreSQL. For more information, please see</p>\n'
204 )
205 # Note: Removed '&#9;' (HTML tab) as it's non-standard; use CSS if needed

Callers 1

Calls 4

setFunction · 0.85
pluralizeFunction · 0.85
escapeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected