Skip to content

Commit 7d9eaba

Browse files
committed
fix url format
1 parent 0851d3d commit 7d9eaba

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

bmsdna/table_rendering/md2excel.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ def markdown_to_excel(
8282
if m := re_markdown_image.match(col):
8383
ws.insert_image(offset_rows + row, col_ind, m.group(2))
8484
elif m := re_markdown_link.match(col):
85-
ws.write_url(offset_rows + row, col_ind, m.group(1), string=m.group(2))
85+
url = m.group(2)
86+
text = m.group(1)
87+
if "://" in text and "://" not in url:
88+
text, url = url, text
89+
90+
ws.write_url(offset_rows + row, col_ind, url, string=text)
8691
elif (
8792
col.startswith("# ")
8893
or col.startswith("## ")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "bmsdna-table-rendering"
3-
version = "0.3.8"
3+
version = "0.3.9"
44
description = ""
55
authors = [{ name = "Adrian Ehrsam", email = "adrian.ehrsam@bmsuisse.ch" }]
66
dependencies = [

tests/test_md2excel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Wir haben hier einen Text
44
5-
[https://google.com]( - Ein link)
5+
[ - Ein link](https://google.com)
66
77
| Month | Savings |
88
| -------- | ------- |

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)