From 75c3c1b56733ed8aabe301b552fd2f2e0b8e7c82 Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Tue, 11 May 2021 12:26:10 +0300 Subject: [PATCH] Both GITHUB MARKDOWN parsers removed README anchor links text. With this commit, we enable parsing of links text too, so that it is translatable and the links work in translation files too. --- openformats/formats/github_markdown.py | 6 ------ openformats/tests/formats/github_markdown/files/1_el.md | 4 ++-- openformats/tests/formats/github_markdown/files/1_tpl.md | 4 ++-- openformats/tests/formats/github_markdown_v2/files/1_el.md | 4 ++-- openformats/tests/formats/github_markdown_v2/files/1_tpl.md | 4 ++-- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/openformats/formats/github_markdown.py b/openformats/formats/github_markdown.py index 2422d565..0e58bfed 100644 --- a/openformats/formats/github_markdown.py +++ b/openformats/formats/github_markdown.py @@ -55,12 +55,6 @@ def string_handler(token, template): if match_header_line: return string.replace(match_header_line.group(), '') - # Extract Text from `[Text](link)` or `"[Text](link)"` lines - match_link = re.search(ensure_unicode(r'^"?\[(.+)\]\(.+\)"?$'), string) - if match_link: - # Get content between brackets - return match_link.groups()[0] - # Extract Text from `[Text]: link` or `"[Text]: link"` lines match_reference = re.search(ensure_unicode(r'^"?\[([^\[^\]]+)\]:.+"?$'), string) if match_reference: diff --git a/openformats/tests/formats/github_markdown/files/1_el.md b/openformats/tests/formats/github_markdown/files/1_el.md index 07097df1..c38b4ebc 100644 --- a/openformats/tests/formats/github_markdown/files/1_el.md +++ b/openformats/tests/formats/github_markdown/files/1_el.md @@ -153,8 +153,8 @@ el:This is a old version of the {{ site.data.variable.product }} documentation. ### el:Whole line as links in as list -- "[el:Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax)" -- [el:Working with advanced formatting](/articles/working-with-advanced-formatting) +- el:"[Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax)" +- el:[Working with advanced formatting](/articles/working-with-advanced-formatting) ### el:Whole line as links diff --git a/openformats/tests/formats/github_markdown/files/1_tpl.md b/openformats/tests/formats/github_markdown/files/1_tpl.md index 1371c581..cb4dfb9f 100644 --- a/openformats/tests/formats/github_markdown/files/1_tpl.md +++ b/openformats/tests/formats/github_markdown/files/1_tpl.md @@ -131,8 +131,8 @@ d6c6d7c6ae13b3b656339b51dbeb85ff_tr | 9441c042cb0b839e13ed95f55de0ee5c_tr ### fd90f0cdc5f649dd84d4e21ff33b5774_tr -- "[a69644fd392aad985de61e166dc8e8fd_tr](/articles/basic-writing-and-formatting-syntax)" -- [ed226cb95f3b637703501d9f4ddd3d68_tr](/articles/working-with-advanced-formatting) +- a69644fd392aad985de61e166dc8e8fd_tr +- ed226cb95f3b637703501d9f4ddd3d68_tr ### 18546b56cfde1b046b0372d31f6e7293_tr diff --git a/openformats/tests/formats/github_markdown_v2/files/1_el.md b/openformats/tests/formats/github_markdown_v2/files/1_el.md index ea9014d0..6a193c0a 100644 --- a/openformats/tests/formats/github_markdown_v2/files/1_el.md +++ b/openformats/tests/formats/github_markdown_v2/files/1_el.md @@ -166,8 +166,8 @@ el:This is a old version of the {{ site.data.variable.product }} documentation. ### el:Whole line as links in as list -- "[el:Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax)" -- [el:Working with advanced formatting](/articles/working-with-advanced-formatting) +- el:"[Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax)" +- el:[Working with advanced formatting](/articles/working-with-advanced-formatting) ### el:Whole line as links diff --git a/openformats/tests/formats/github_markdown_v2/files/1_tpl.md b/openformats/tests/formats/github_markdown_v2/files/1_tpl.md index d33ab0c7..e1fafd9e 100644 --- a/openformats/tests/formats/github_markdown_v2/files/1_tpl.md +++ b/openformats/tests/formats/github_markdown_v2/files/1_tpl.md @@ -148,8 +148,8 @@ aa5072eebea6f4364b4444a8a0f0f868_tr ### 33aa6de370798fadf155bbc16f7540c7_tr -- "[709c93c4918ef02a126bec2a7044dca2_tr](/articles/basic-writing-and-formatting-syntax)" -- [e4429365fc4b359487f20dc8957bdc97_tr](/articles/working-with-advanced-formatting) +- 709c93c4918ef02a126bec2a7044dca2_tr +- e4429365fc4b359487f20dc8957bdc97_tr ### a55e54225390bca0cdaa0c1d0a8d07d4_tr