Merge branch 'master' into feature/clipboard-js-integration

This commit is contained in:
squidfunk 2017-05-31 15:31:17 +02:00
commit 13cd1d1a26
9 changed files with 61 additions and 34 deletions

View File

@ -1,3 +1,7 @@
mkdocs-material-1.6.4 (2017-05-24)
* Fixed #337: JavaScript error for GitHub organization URLs
mkdocs-material-1.6.3 (2017-05-16) mkdocs-material-1.6.3 (2017-05-16)
* Fixed #329: Broken source stats for private or unknown GitHub repos * Fixed #329: Broken source stats for private or unknown GitHub repos

View File

@ -360,6 +360,11 @@ extra:
A new entry at the bottom of the table of contents is generated that is linking A new entry at the bottom of the table of contents is generated that is linking
to the comments section. The necessary JavaScript is automatically included. to the comments section. The necessary JavaScript is automatically included.
!!! warning "Requirements"
`site_url` value must be set in `mkdocs.yml` for the Discus integration to
load properly.
[17]: https://disqus.com [17]: https://disqus.com
### Localization ### Localization

View File

@ -12,11 +12,17 @@ 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.3 # Version 1.6.4
``` ```
## Changelog ## Changelog
### 1.6.4 <small> _ May 24, 2017</small>
* Fixed [#337][337]: JavaScript error for GitHub organization URLs
[337]: https://github.com/squidfunk/mkdocs-material/issues/337
### 1.6.3 <small> _ May 16, 2017</small> ### 1.6.3 <small> _ May 16, 2017</small>
* Fixed [#329][329]: Broken source stats for private or unknown GitHub repos * Fixed [#329][329]: Broken source stats for private or unknown GitHub repos

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.3"> <meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-1.6.4">
{% 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-1a4408fe3b.js"></script> <script src="{{ base_url }}/assets/javascripts/application-3f3f3473e5.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.3", "version": "1.6.4",
"description": "A Material Design theme for MkDocs", "description": "A Material Design theme for MkDocs",
"keywords": [ "keywords": [
"mkdocs", "mkdocs",
@ -76,7 +76,7 @@
"gulp-sourcemaps": "^2.4.0", "gulp-sourcemaps": "^2.4.0",
"gulp-stylelint": "^3.7.0", "gulp-stylelint": "^3.7.0",
"gulp-svgmin": "^1.2.3", "gulp-svgmin": "^1.2.3",
"gulp-uglify": "^2.0.0", "gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.8", "gulp-util": "^3.0.8",
"js-cookie": "^2.1.3", "js-cookie": "^2.1.3",
"lunr": "^2.0.2", "lunr": "^2.0.2",

View File

@ -43,7 +43,6 @@ export default class Abstract {
const ref = (typeof el === "string") const ref = (typeof el === "string")
? document.querySelector(el) ? document.querySelector(el)
: el : el
if (!(ref instanceof HTMLAnchorElement)) if (!(ref instanceof HTMLAnchorElement))
throw new ReferenceError throw new ReferenceError
this.el_ = ref this.el_ = ref

View File

@ -40,14 +40,17 @@ export default class GitHub extends Abstract {
constructor(el) { constructor(el) {
super(el) super(el)
/* Extract user and repository name from URL, as we have to query for all /* Extract user (and repository name) from URL, as we have to query for all
repositories, to omit 404 errors for private repositories */ repositories, to omit 404 errors for private repositories */
const [, user, name] = /^.+github\.com\/([^\/]+)\/([^\/]+).*$/ const matches = /^.+github\.com\/([^\/]+)\/?([^\/]+)?.*$/
.exec(this.base_) .exec(this.base_)
if (matches && matches.length === 3) {
const [, user, name] = matches
/* Initialize base URL and repository name */ /* Initialize base URL and repository name */
this.base_ = `https://api.github.com/users/${user}/repos` this.base_ = `https://api.github.com/users/${user}/repos`
this.name_ = name this.name_ = name
}
} }
/** /**
@ -59,13 +62,25 @@ 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 => {
const repo = data.find(item => item.name === this.name_) if (!(data instanceof Array))
return repo throw new TypeError
? [
`${this.format_(repo.stargazers_count)} Stars`, /* Display number of stars and forks, if repository is given */
`${this.format_(repo.forks_count)} Forks` if (this.name_) {
const repo = data.find(item => item.name === this.name_)
return repo
? [
`${this.format_(repo.stargazers_count)} Stars`,
`${this.format_(repo.forks_count)} Forks`
]
: []
/* Display number of repositories, otherwise */
} else {
return [
`${data.length} Repositories`
] ]
: [] }
}) })
} }
} }

View File

@ -1128,7 +1128,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
dependencies: dependencies:
delayed-stream "~1.0.0" delayed-stream "~1.0.0"
commander@2.9.x, commander@^2.9.0: commander@2.9.x, commander@^2.9.0, commander@~2.9.0:
version "2.9.0" version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
dependencies: dependencies:
@ -1565,11 +1565,7 @@ ecc-jsbn@~0.1.1:
dependencies: dependencies:
jsbn "~0.1.0" jsbn "~0.1.0"
electron-to-chromium@^1.2.3: electron-to-chromium@^1.2.3, electron-to-chromium@^1.3.9:
version "1.2.4"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.2.4.tgz#9751cbea89fa120bf88c226ba41eb8d0b6f1b597"
electron-to-chromium@^1.3.9:
version "1.3.10" version "1.3.10"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.10.tgz#63d62b785471f0d8dda85199d64579de8a449f08" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.10.tgz#63d62b785471f0d8dda85199d64579de8a449f08"
@ -2454,17 +2450,16 @@ gulp-svgmin@^1.2.3:
gulp-util "^3.0.4" gulp-util "^3.0.4"
svgo "^0.7.0" svgo "^0.7.0"
gulp-uglify@^2.0.0: gulp-uglify@^3.0.0:
version "2.0.1" version "3.0.0"
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-2.0.1.tgz#e8cfb831014fc9ff2e055e33785861830d499365" resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca"
dependencies: dependencies:
gulplog "^1.0.0" gulplog "^1.0.0"
has-gulplog "^0.1.0" has-gulplog "^0.1.0"
lodash "^4.13.1" lodash "^4.13.1"
make-error-cause "^1.1.1" make-error-cause "^1.1.1"
through2 "^2.0.0" through2 "^2.0.0"
uglify-js "2.7.5" uglify-js "^3.0.5"
uglify-save-license "^0.4.1"
vinyl-sourcemaps-apply "^0.2.0" vinyl-sourcemaps-apply "^0.2.0"
gulp-util@^3, gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.4, gulp-util@^3.0.6, gulp-util@^3.0.7, gulp-util@^3.0.8, gulp-util@~3.0.0: gulp-util@^3, gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.4, gulp-util@^3.0.6, gulp-util@^3.0.7, gulp-util@^3.0.8, gulp-util@~3.0.0:
@ -5444,7 +5439,7 @@ typedarray@^0.0.6:
version "0.0.6" version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
uglify-js@2.7.5, uglify-js@2.7.x, uglify-js@^2.7.5, uglify-js@~2.7.3: uglify-js@2.7.x, uglify-js@^2.7.5, uglify-js@~2.7.3:
version "2.7.5" version "2.7.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8"
dependencies: dependencies:
@ -5453,9 +5448,12 @@ uglify-js@2.7.5, uglify-js@2.7.x, uglify-js@^2.7.5, uglify-js@~2.7.3:
uglify-to-browserify "~1.0.0" uglify-to-browserify "~1.0.0"
yargs "~3.10.0" yargs "~3.10.0"
uglify-save-license@^0.4.1: uglify-js@^3.0.5:
version "0.4.1" version "3.0.11"
resolved "https://registry.yarnpkg.com/uglify-save-license/-/uglify-save-license-0.4.1.tgz#95726c17cc6fd171c3617e3bf4d8d82aa8c4cce1" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.0.11.tgz#81f594b9a24dad76e39da92f8f06e5b3bc8c2e11"
dependencies:
commander "~2.9.0"
source-map "~0.5.1"
uglify-to-browserify@~1.0.0: uglify-to-browserify@~1.0.0:
version "1.0.2" version "1.0.2"