Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow alternate stylesheets #1764
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shimizukawa
Mar 10, 2015
Member
You can provide _static/custom.css and write the following codes into "conf.py":
def setup(app):
app.add_stylesheet('custom.css')
refs: http://sphinx-doc.org/extdev/appapi.html#sphinx.application.Sphinx.add_stylesheet
|
You can provide
refs: http://sphinx-doc.org/extdev/appapi.html#sphinx.application.Sphinx.add_stylesheet |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Jellby
Mar 11, 2015
Contributor
I'm afraid that doesn't help. That only adds a standard stylesheet:
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
But I want to add something like:
<link rel="alternate stylesheet" href="../_static/custom.css" type="text/css" title="Plain" />
(note the different "rel" and "title" attributes.) I'm creating my own modified theme and I'd like to override the css() macro in basic/layout.html, but I cannot because it's not defined or used inside a "block". Another solution, of course, would be to extend the add_stylesheet syntax (and modify the template) to allow specifying "rel" and "title" attributes.
|
I'm afraid that doesn't help. That only adds a standard stylesheet:
But I want to add something like:
(note the different "rel" and "title" attributes.) I'm creating my own modified theme and I'd like to override the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shimizukawa
Mar 11, 2015
Member
Hum.. I think it'll be resolved if
- a,
add_styleseet()accepts attributes likerel="alternate stylesheet"andtitle="Plain" - b, css() jinja2 macro is defined in some named block (if it is possible)
For now, as you mentioned, these features are not implemented.
|
Hum.. I think it'll be resolved if
For now, as you mentioned, these features are not implemented. |
shimizukawa
added
html
proposal
good first issue
labels
Mar 11, 2015
shimizukawa
added this to the 1.4 milestone
Mar 11, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lehmannro
Mar 11, 2015
Contributor
You can currently do something like this with the extrahead block, see eg. the pyramid theme for an example.
As for the API, I think rel= is not necessary as it should default to alternate stylesheet if a title is given. I'm not sure what you mean by (b); css_files should just be an list of objects/tuples having a path and an optional title instead of a list of bare path strings.
|
You can currently do something like this with the As for the API, I think |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Jellby
Mar 11, 2015
Contributor
The extrahead block may help.
Even with the default as alternate stylesheet if a title is given, it should be possible to provide a title and just stylesheet too. The (b) solution means simply allowing an override of the css() macro, which is currently not possible.
|
The Even with the default as |
Jellby commentedMar 10, 2015
I would like to add some alternate stylesheets in a sphinx theme, as described here: http://alistapart.com/article/alternate/
This requires only specifying some "rel" and "title" attributes in the elements, but this part is hardcoded in sphinx/themes/basic/layout.html. I can add more stylesheets, but not specify the attributes. As far as I understand from the jinja documentation the "css()" macro cannot be overridden by child templates, because it's not inside a block.
So, this would, I guess, be easily fixed by adding a block to the parent template, such that I can redefine the "css()" macro, or use a different custom one.