Generate a generic EN and ZH draft for any update type.
(update: dict)
| 259 | |
| 260 | |
| 261 | def generate_generic_draft(update: dict) -> tuple[str, str]: |
| 262 | """Generate a generic EN and ZH draft for any update type.""" |
| 263 | name = update.get("name", "Unknown Source") |
| 264 | url = update.get("url", "") |
| 265 | category = update.get("category", "unknown") |
| 266 | detected_at = update.get("detected_at", datetime.now().isoformat())[:10] |
| 267 | note = update.get("note", "") |
| 268 | |
| 269 | en_content = f"""--- |
| 270 | title: Regulatory Update - {name} ({detected_at}) |
| 271 | draft: true |
| 272 | source: {url} |
| 273 | category: {category} |
| 274 | detected_at: {detected_at} |
| 275 | --- |
| 276 | |
| 277 | # Regulatory Update: {name} |
| 278 | |
| 279 | > **Draft**: Auto-generated from update detection. Requires human review before merging. |
| 280 | |
| 281 | **Category**: `{category}` |
| 282 | **Source**: [{name}]({url}) |
| 283 | **Detected**: {detected_at} |
| 284 | **Note**: {note} |
| 285 | |
| 286 | ::: warning Review Required |
| 287 | This draft was auto-generated. Please review the source URL and update |
| 288 | the relevant documentation pages before merging. |
| 289 | ::: |
| 290 | """ |
| 291 | |
| 292 | zh_content = f"""--- |
| 293 | title: 法规更新 - {name} ({detected_at}) |
| 294 | draft: true |
| 295 | source: {url} |
| 296 | category: {category} |
| 297 | detected_at: {detected_at} |
| 298 | --- |
| 299 | |
| 300 | # 法规更新:{name} |
| 301 | |
| 302 | > **草稿**:自动生成,合并前需人工审核。 |
| 303 | |
| 304 | **类别**:`{category}` |
| 305 | **来源**:[{name}]({url}) |
| 306 | **检测时间**:{detected_at} |
| 307 | **说明**:{note} |
| 308 | |
| 309 | ::: warning 需要审核 |
| 310 | 此草稿为自动生成。请审核来源 URL 并在合并前更新相关文档页面。 |
| 311 | ::: |
| 312 | """ |
| 313 | return en_content, zh_content |
| 314 | |
| 315 | |
| 316 | # --------------------------------------------------------------------------- |