Skip to content

Commit 7dc24d6

Browse files
authored
Fixed triple slashes in cards macro (#3295)
1 parent 04f596e commit 7dc24d6

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

main.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
from mkdocs.utils import meta
88
from typing import List
99

10+
def _absolute_page_url(site, language, version, *parts):
11+
return 'https://' + '/'.join((site, language, version) + parts)
12+
13+
1014
CARDS_TEMPLATE = """
1115
<div class="card-wrapper">
1216
<div>
@@ -109,25 +113,12 @@ def cards(pages, columns=1, style="cards", force_version=False):
109113
elif re.search(".html$", path):
110114
html = True
111115
content = open("docs/%s" % path, "r").read()
112-
page = 'https:/' + '/'.join((
113-
'/',
114-
site,
115-
language,
116-
version,
117-
page
118-
))
116+
page = _absolute_page_url(site, language, version, page)
119117
else:
120118
html = False
121119
path = path.rstrip('/')
122120
content = open("docs/%s.md" % path, "r").read()
123-
page = 'https:/' + '/'.join((
124-
'/',
125-
site,
126-
language,
127-
version,
128-
path,
129-
hash
130-
))
121+
page = _absolute_page_url(site, language, version, path, hash)
131122

132123
if html:
133124
match = re.search("<meta property=\"og:title\" content=\"(.*)\"", content, re.MULTILINE)

0 commit comments

Comments
 (0)