Generate EN and ZH draft Markdown for NMPA/CMDE updates.
(update: dict)
| 205 | |
| 206 | |
| 207 | def generate_nmpa_draft(update: dict) -> tuple[str, str]: |
| 208 | """Generate EN and ZH draft Markdown for NMPA/CMDE updates.""" |
| 209 | name = update.get("name", "Unknown Source") |
| 210 | url = update.get("url", "") |
| 211 | detected_at = update.get("detected_at", datetime.now().isoformat())[:10] |
| 212 | |
| 213 | en_content = f"""--- |
| 214 | title: NMPA/CMDE Updates ({detected_at}) |
| 215 | draft: true |
| 216 | source: {url} |
| 217 | detected_at: {detected_at} |
| 218 | --- |
| 219 | |
| 220 | # NMPA/CMDE Regulatory Updates |
| 221 | |
| 222 | > **Draft**: Auto-generated from update detection. Requires human review before merging. |
| 223 | |
| 224 | Potential updates detected from [{name}]({url}). |
| 225 | |
| 226 | ::: tip Source |
| 227 | [CMDE Guidance Principles](https://www.cmde.org.cn/flfg/zdyz/) |
| 228 | ::: |
| 229 | |
| 230 | ::: warning Review Required |
| 231 | This draft was auto-generated. Please manually check the source URL for new |
| 232 | guidance principles and update `docs/en/nmpa/guidance.md` accordingly. |
| 233 | ::: |
| 234 | """ |
| 235 | |
| 236 | zh_content = f"""--- |
| 237 | title: NMPA/CMDE 更新 ({detected_at}) |
| 238 | draft: true |
| 239 | source: {url} |
| 240 | detected_at: {detected_at} |
| 241 | --- |
| 242 | |
| 243 | # NMPA/CMDE 法规更新 |
| 244 | |
| 245 | > **草稿**:自动生成,合并前需人工审核。 |
| 246 | |
| 247 | 从 [{name}]({url}) 检测到潜在更新。 |
| 248 | |
| 249 | ::: tip 来源 |
| 250 | [CMDE 指导原则](https://www.cmde.org.cn/flfg/zdyz/) |
| 251 | ::: |
| 252 | |
| 253 | ::: warning 需要审核 |
| 254 | 此草稿为自动生成。请手动检查来源 URL 中的新指导原则, |
| 255 | 并相应更新 `docs/zh/nmpa/guidance.md`。 |
| 256 | ::: |
| 257 | """ |
| 258 | return en_content, zh_content |
| 259 | |
| 260 | |
| 261 | def generate_generic_draft(update: dict) -> tuple[str, str]: |