Formats extracted data into HTML for web news articles.
(data, skip_issues_set=None)
| 310 | |
| 311 | |
| 312 | def format_html(data, skip_issues_set=None): |
| 313 | """Formats extracted data into HTML for web news articles.""" |
| 314 | if skip_issues_set is None: |
| 315 | skip_issues_set = set() |
| 316 | # Removed local import html, using global one |
| 317 | |
| 318 | if not data.get('version'): |
| 319 | return "<p>Error: Version not found in parsed data.</p>" |
| 320 | |
| 321 | version = data['version'] |
| 322 | # Use relative paths for web article links |
| 323 | release_url = ( |
| 324 | f"/docs/pgadmin4/{version}/" |
| 325 | f"release_notes_{version.replace('.', '_')}.html" |
| 326 | ) |
| 327 | download_url = "/download" |
| 328 | |
| 329 | filtered_features = [ |
| 330 | item for item in data.get('features', []) |
| 331 | if item.get('issue') not in skip_issues_set |
| 332 | ] |
| 333 | filtered_bugs = [ |
| 334 | item for item in data.get('bugs_housekeeping', []) |
| 335 | if item.get('issue') not in skip_issues_set |
| 336 | ] |
| 337 | num_features = len(filtered_features) |
| 338 | num_bugs_housekeeping = len(filtered_bugs) |
| 339 | |
| 340 | output = ( |
| 341 | f"<p>The pgAdmin Development Team is pleased to announce " |
| 342 | f"pgAdmin 4 version {version}. " |
| 343 | ) |
| 344 | output += ( |
| 345 | f"This release of pgAdmin 4 includes " |
| 346 | f"{pluralize(num_features, 'new feature')} and " |
| 347 | f"{pluralize(num_bugs_housekeeping, 'bug fix', 'bug fixes')}/" |
| 348 | f"housekeeping change" |
| 349 | f"{'s' if num_bugs_housekeeping != 1 else ''}. " |
| 350 | ) |
| 351 | output += ( |
| 352 | f'For more details, please see the ' |
| 353 | f'<a href="{release_url}">release notes</a>.</p>\n' |
| 354 | ) |
| 355 | output += "<p>Notable changes in this release include:</p>\n" |
| 356 | |
| 357 | if filtered_features: |
| 358 | output += "<p><strong>Features:</strong></p>\n<ul>\n" |
| 359 | for item in filtered_features: |
| 360 | desc = html.escape(item.get('description', 'N/A').strip()) |
| 361 | # Link logic removed, keep bolding for features in news format |
| 362 | output += f" <li><strong>{desc}.</strong></li>\n" |
| 363 | output += "</ul>\n" |
| 364 | |
| 365 | if filtered_bugs: |
| 366 | output += "<p><strong>Bugs/Housekeeping:</strong></p>\n<ul>\n" |
| 367 | for item in filtered_bugs: |
| 368 | desc = html.escape(item.get('description', 'N/A').strip()) |
| 369 | # Link logic removed, no bolding for bugs in news format |
no test coverage detected