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) mkdocs-material-1.6.2 (2017-05-15)
* Fixed #316: Fatal error for git clone on Windows * 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 ``` sh
pip show mkdocs-material | grep -E ^Version pip show mkdocs-material | grep -E ^Version
# Version 1.6.2 # Version 1.6.3
``` ```
## Changelog ## 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 [#316][316]: Fatal error for git clone on Windows
* Fixed [#320][320]: Chrome 58 creates double underline for `abbr` tags * Fixed [#320][320]: Chrome 58 creates double underline for `abbr` tags
* Fixed [#323][323]: Ligatures rendered inside code blocks * 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 %} {% else %}
<link rel="shortcut icon" href="{{ base_url }}/assets/images/favicon.png"> <link rel="shortcut icon" href="{{ base_url }}/assets/images/favicon.png">
{% endif %} {% 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 %} {% endblock %}
{% block htmltitle %} {% block htmltitle %}
{% if page and page.meta.title %} {% if page and page.meta.title %}
@ -149,7 +149,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% 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> <script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>

View File

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

View File

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