Construct a markdown link, adjusting the URL for the given language code if needed.
(
url: str,
text: str,
title: str | None,
attributes: str | None,
lang_code: str,
)
| 285 | |
| 286 | |
| 287 | def _construct_markdown_link( |
| 288 | url: str, |
| 289 | text: str, |
| 290 | title: str | None, |
| 291 | attributes: str | None, |
| 292 | lang_code: str, |
| 293 | ) -> str: |
| 294 | """ |
| 295 | Construct a markdown link, adjusting the URL for the given language code if needed. |
| 296 | """ |
| 297 | url = _add_lang_code_to_url(url, lang_code) |
| 298 | |
| 299 | if title: |
| 300 | link = f'[{text}]({url} "{title}")' |
| 301 | else: |
| 302 | link = f"[{text}]({url})" |
| 303 | |
| 304 | if attributes: |
| 305 | link += f"{{{attributes}}}" |
| 306 | |
| 307 | return link |
| 308 | |
| 309 | |
| 310 | def replace_markdown_links( |
no test coverage detected