1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-09-24 11:28:23 +02:00

Merge branch 'master' into clipboard

This commit is contained in:
Martin Donath 2017-05-16 21:07:26 +02:00 committed by GitHub
commit db397f3151
6 changed files with 37 additions and 12 deletions

View File

@ -1,3 +1,7 @@
mkdocs-material-1.6.3 (2017-05-16)
* Fixed #329: Broken source stats for private or unknown GitHub repos
mkdocs-material-1.6.2 (2017-05-15)
* Fixed #316: Fatal error for git clone on Windows

View File

@ -12,11 +12,19 @@ To determine the currently installed version, use the following command:
``` sh
pip show mkdocs-material | grep -E ^Version
# Version 1.6.2
# Version 1.6.3
```
## Changelog
### 1.6.3 <small> _ May 16, 2017</small>
* Fixed [#329][329]: Broken source stats for private or unknown GitHub repos
[329]: https://github.com/squidfunk/mkdocs-material/issues/329
### 1.6.2 <small> _ May 15, 2017</small>
* Fixed [#316][316]: Fatal error for git clone on Windows
* Fixed [#320][320]: Chrome 58 creates double underline for `abbr` tags
* Fixed [#323][323]: Ligatures rendered inside code blocks

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@
{% else %}
<link rel="shortcut icon" href="{{ base_url }}/assets/images/favicon.png">
{% endif %}
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-1.6.2">
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-1.6.3">
{% endblock %}
{% block htmltitle %}
{% if page and page.meta.title %}
@ -149,7 +149,7 @@
{% endblock %}
</div>
{% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-876a5cae0c.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-6b4ff16fa7.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>

View File

@ -1,6 +1,6 @@
{
"name": "mkdocs-material",
"version": "1.6.2",
"version": "1.6.3",
"description": "A Material Design theme for MkDocs",
"keywords": [
"mkdocs",

View File

@ -32,15 +32,22 @@ export default class GitHub extends Abstract {
* Retrieve repository information from GitHub
*
* @constructor
*
* @property {string} name_ - Name of the repository
*
* @param {(string|HTMLAnchorElement)} el - Selector or HTML element
*/
constructor(el) {
super(el)
/* Adjust base URL to reach API endpoints and remove trailing slash */
this.base_ = this.base_
.replace("github.com/", "api.github.com/repos/")
.replace(/\/$/, "")
/* Extract user and repository name from URL, as we have to query for all
repositories, to omit 404 errors for private repositories */
const [, user, name] = /^.+github\.com\/([^\/]+)\/([^\/]+).*$/
.exec(this.base_)
/* Initialize base URL and repository name */
this.base_ = `https://api.github.com/users/${user}/repos`
this.name_ = name
}
/**
@ -52,10 +59,13 @@ export default class GitHub extends Abstract {
return fetch(this.base_)
.then(response => response.json())
.then(data => {
return [
`${this.format_(data.stargazers_count)} Stars`,
`${this.format_(data.forks_count)} Forks`
]
const repo = data.find(item => item.name === this.name_)
return repo
? [
`${this.format_(repo.stargazers_count)} Stars`,
`${this.format_(repo.forks_count)} Forks`
]
: []
})
}
}