Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main.py: cards: get right version from abs_url #271

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def cards(pages, columns=1, style="cards", force_version=False):
canonical = current_page.canonical_url
url_parts = re.search("//([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/", canonical)
(site, project, edition, language, version) = url_parts.groups()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

site is not really useful. Those two lines should be removed, and site removed below from the rebuilt URLs passed to the cards.

url_parts = re.search("^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/", absolute_url)
(project, edition, language, version) = url_parts.groups()
version = force_version or version

if isinstance(pages, str):
Expand Down Expand Up @@ -87,4 +89,4 @@ def cards(pages, columns=1, style="cards", force_version=False):
)
)

return """<div class="%s col-%s">%s</div>""" % (style, columns, "\n".join(cards))
return """<div class="%s col-%s">%s %s %s</div>""" % (style, columns, "\n".join(cards), current_page.abs_url, current_page.canonical_url)
adriendupuis marked this conversation as resolved.
Show resolved Hide resolved
Loading