-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GitHub stars don't work if the repo_url ends with a /
#1
Comments
Fixed in master, I will wait some days for potential bugs to push out 0.1.1. Sadly, the jinja template engine is not very flexible. I wanted to omit adding further variables to the # Custom filter method
def regex_replace(s, find, replace):
"""A non-optimal implementation of a regex filter"""
return re.sub(find, replace, s)
jinja_environment.filters['regex_replace'] = regex_replace from http://stackoverflow.com/questions/12791216/how-do-i-use-regular-expressions-in-jinja2 I don't want to do it in Javascript, because then it depends on the client, so i fixed it like this: {% if repo_name == 'GitHub' %}
{% set repo_id = repo_url | replace('https://github.com/', '') %}
{% if repo_id[-1:] == '/' %}
{% set repo_id = repo_id[:-1] %}
{% endif %}
{% endif %} Any better ideas on this? |
That looks like a good fix for now. We probably do want to make themes more flexible at some point, but that starts to overlap with a plugin API. I hadn't really considered plugins from a theme point of view before but there is general discussion here: mkdocs/mkdocs#206 |
adding Trivy to open source user list
If the repo_url ends with a slash, like it does in the MkDocs mkdocs.yml the GitHub stars don't work.
We could simply just remove this from the mkdocs.yml, but it would be nice if it worked either way. It took me a few minutes to figure out where the problem was.
The text was updated successfully, but these errors were encountered: