1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +01:00

Fixed #1: GitHub stars don't work if the repo_url ends with a '/'

This commit is contained in:
squidfunk 2016-02-10 14:09:30 +01:00
parent d67bfc0375
commit ee05f7d870
10 changed files with 28 additions and 15 deletions

View File

@ -1,3 +1,7 @@
mkdocs-material-0.x.x (2016-xx-xx) [in progress]
* Fixed #1: GitHub stars don't work if the repo_url ends with a '/'
mkdocs-material-0.1.0 (2016-02-09)
* Initial release

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,13 +39,19 @@
<link rel="icon" type="image/x-icon" href="{{ base_url }}/{{ icon }}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,700">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu+Mono">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-334f02ec.css">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-1f184bc3.css">
{% for path in extra_css %}
<link rel="stylesheet" href="{{ path }}">
{% endfor %}
{% block extrahead %}{% endblock %}
</head>
<body>
{% 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 %}
<div class="backdrop">
<div class="backdrop-paper"></div>
</div>
@ -98,7 +104,6 @@
</div>
</main>
<script src="{{ base_url }}/assets/javascripts/modernizr-79394028.js"></script>
{% set repo_id = repo_url | replace('https://github.com/', '') %}
<script>
var base_url = '{{ base_url }}';
var repo_id = '{{ repo_id }}';

View File

@ -1,6 +1,3 @@
{% if repo_name == 'GitHub' %}
{% set repo_id = repo_url | replace('https://github.com/', '') %}
{% endif %}
<nav aria-label="navigation">
<a href="{{ repo_url }}" class="project">
<div class="banner">

View File

@ -2,5 +2,5 @@
"assets/images/favicon.ico": "assets/images/favicon-e565ddfa.ico",
"assets/javascripts/application.js": "assets/javascripts/application-d84ecdee.js",
"assets/javascripts/modernizr.js": "assets/javascripts/modernizr-79394028.js",
"assets/stylesheets/application.css": "assets/stylesheets/application-334f02ec.css"
"assets/stylesheets/application.css": "assets/stylesheets/application-1f184bc3.css"
}

View File

@ -508,9 +508,9 @@ document.addEventListener('DOMContentLoaded', function() {
function(data, xhr) {
var count = data.stargazers_count;
if (count > 10000)
count = (count / 1000).toFixed(0) + "k";
count = (count / 1000).toFixed(0) + 'k';
else if (count > 1000)
count = (count / 1000).toFixed(1) + "k";
count = (count / 1000).toFixed(1) + 'k';
/* Set number of stars */
var stars = document.querySelector('.repo-stars .count');

View File

@ -82,6 +82,18 @@
</head>
<body>
<!--
Sadly the jinja template engine is not very flexible - it doesn't support
regular expressions out-of-the-box. Since there might be a slash at the
end of the repository name, we just do a string comparison and kill it.
-->
{% 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 %}
<!-- Backdrop -->
<div class="backdrop">
<div class="backdrop-paper"></div>
@ -170,7 +182,6 @@
<script src="{{ base_url }}/assets/javascripts/modernizr.js"></script>
<!-- Theme-related and custom javascripts -->
{% set repo_id = repo_url | replace('https://github.com/', '') %}
<script>
var base_url = '{{ base_url }}';
var repo_id = '{{ repo_id }}';

View File

@ -1,7 +1,3 @@
{% if repo_name == 'GitHub' %}
{% set repo_id = repo_url | replace('https://github.com/', '') %}
{% endif %}
<!-- Navigation -->
<nav aria-label="navigation">