Detect absolute URL’s in the extra_* path.#92
Conversation
mkdocs/themes/readthedocs/base.html
Outdated
There was a problem hiding this comment.
Is this intended to simply be {% else %}? What's the 'media' in path check for?
There was a problem hiding this comment.
Yea, sorry. That was cruft left over from testing locally.
There was a problem hiding this comment.
It'd be nice if this wasn't done in the HTML templates; doing it this way means every theme needs to handle this if we want them to have feature-parity.
There was a problem hiding this comment.
Agreed. I stuck it there because we are doing the base_url logic there as
well. I agree we could pre-process the URL's in the list and just include
them in the template as a single variable.
On Fri, May 30, 2014 at 11:23 AM, Jim Porter notifications@github.com
wrote:
In mkdocs/themes/readthedocs/base.html:
@@ -11,13 +11,20 @@
{% for path in extra_css %} - - {% if '//' in path %} - - {% elif 'media' in path %}It'd be nice if this wasn't done in the HTML templates; doing it this way
means every theme needs to handle this if we want them to have
feature-parity.—
Reply to this email directly or view it on GitHub
https://github.com/tomchristie/mkdocs/pull/92/files#r13242790.
Eric Holscher
Maker of the internet residing in Portland, Or
http://ericholscher.com
|
Went ahead and added this as a util function. Not sure if it fits in with the code-base or style perfectly. It seems like we should probably be using the urlparse module for this, but every time I've worked with it I want to stab something :) I'm not sure if we want to support protocol-less things (eg. "media.cdn.org/foo.js") -- this code is naive and will include that as a local URL. |
|
would love to see Mkdocs support for Readthedocs... |
|
I believe this should be merge-able now, if anyone would care to take a look. |
mkdocs/utils.py
Outdated
There was a problem hiding this comment.
Can you import urlparse from mkdocs.compat?
There was a problem hiding this comment.
Yup, we should always keep version-branching code in compat.
|
I'm not even sure it's worth waiting for that tiny nitpick, but it would be good to remain consitent. I'll wait and see if you happen to have time to update, otherwise I think this is good to merge. |
|
Updated |
|
Thanks! Looks like a linting error is breaking the Travis run tho' :( |
|
Last try? :) |
|
Shouldn't this be updating According to grep, mkdocs and readthedocs are the only themes that support |
|
Thanks @edbrannin -- updated the default theme too :) |
|
Rad. |
Detect absolute URL’s in the extra_* path.
Since mkdocs/mkdocs#92 for mkdocs/mkdocs#91, an extra_javascript item does not necessarily have to end in *.js; e.g. in enola-dev/enola#669 I have a extra_javascript: - https://unpkg.com/mustache@latest, which this flags up as wrong - although it's not (it works great); ergo it's better to remove this constraint.
Since mkdocs/mkdocs#92 for mkdocs/mkdocs#91, an extra_javascript item does not necessarily have to end in *.js; e.g. in enola-dev/enola#669 I have a extra_javascript: - https://unpkg.com/mustache@latest, which this flags up as wrong - although it's not (it works great); ergo it's better to remove this constraint.
refs #91