Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access name of reader in template #1102

Closed
DonDebonair opened this issue Sep 27, 2013 · 10 comments
Closed

Access name of reader in template #1102

DonDebonair opened this issue Sep 27, 2013 · 10 comments

Comments

@DonDebonair
Copy link
Contributor

Is there a way to know what reader is used in a template? I'd like to conditionally include a certain CSS file based on what reader is used. For instance: include the css file only if we're dealing with a Restructured text article, but not if the source is Markdown.

Is this in any way possible?

@almet
Copy link
Member

almet commented Sep 30, 2013

That seems a job for a plugin.

Currently, I don't think we have a signal which does that, but it can
be added quite easily. Such a signal would be thrown just after reading
the content of a file with a reader.

Then, the plugin can add any meadata to the article which could be used
by the theme.

@DonDebonair
Copy link
Contributor Author

I don't think templates should depend on certain plugins being installed. Especially for functionality that should be accessible for every template in the first place :) Pelican makes use of Docutils for it's RST reading/parsing. Docutils requires the inclusion of a certain stylesheet for proper rendering of the output HTML. Because Pelican supports multiple readers (Markdown for instance), the RST stylesheet should not be included in every page/article. It seems logical that if Pelican supports/uses Docutils and Docutils requires the stylesheet, Pelican should offer a way to include it conditionally!

@almet
Copy link
Member

almet commented Oct 1, 2013

then we would need to add a metadata by the reader.

@DonDebonair
Copy link
Contributor Author

That would be the right course of action I think :) I can try and whip something up, but I don't know when I'll have the time. Sometime next week at the earliest.

@justinmayer
Copy link
Member

Hello Daan. Just wanted to check in... Any update on your progress with this issue?

@justinmayer
Copy link
Member

Hey Daan. How is it going so far? Any updates?

@DonDebonair
Copy link
Contributor Author

I must confess I totally forgot about that! Will try to put something together, hopefully this week.

@justinmayer
Copy link
Member

Hey @dandydev. Just following up regarding this issue. Any updates?

@DonDebonair
Copy link
Contributor Author

Gosh, I really feel bad about this! I totally forgot to look into it. Anyways, I wipped something up here: #1323 Hope that's to your liking!

@DonDebonair
Copy link
Contributor Author

This issue was fixed and merged in #1323, so I guess it can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants