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

Add support for per-suffix parsers #1747

Merged
merged 1 commit into from
Mar 8, 2015

Conversation

mwoehlke
Copy link
Contributor

This adds the ability to do something like parsers = {'.md': 'markdown.parsers'} to use markdown.parsers.Parser to parse .md files. Custom parsers specified in this manner are only used to parse files matching the suffix; otherwise the default (reST) parser is used.

This should help with #825, by allowing for a mixture of reST and MD.

Override 'read' method in SphinxStandaloneReader to consider the suffix
of the file being processed and potentially choose to use a different
parser. Add 'parsers' argument to constructor taking a dictionary of
suffixes to names of parsers to use for the suffix, as provided by a
configuration variable of the same name.

This adds the ability to do something like:

    parsers = {'.md': 'markdown.parsers'}

...to use markdown.parsers.Parser to parse .md files. Note that the
custom parser is ONLY used to parse files matching the suffix; otherwise
the default (reST) parser is used.
@shimizukawa
Copy link
Member

LGTM.
@birkenfeld how about you?

@birkenfeld
Copy link
Member

Should be combined with changes from Eric, I think.

@mwoehlke-kitware
Copy link

Should be combined with changes from Eric, I think.

@birkenfeld, can you be more specific? Is this something you would like for me to do?

@birkenfeld
Copy link
Member

I have another fork with more changes that I think build on this PR. I'll have to look at it once I'm home though.

@birkenfeld
Copy link
Member

Here: master...ericholscher:parsers

Basically, I'd also like this to work like the template_bridge setting, where you give the name of the module and class, so that the class does not have to be called Parser.

@shimizukawa
Copy link
Member

I guess it's time to release. @birkenfeld any progress?

@birkenfeld
Copy link
Member

Give me the weekend... :)

@shimizukawa
Copy link
Member

Sure! Thanks for your weekend ;)

@birkenfeld birkenfeld merged commit cacf381 into sphinx-doc:master Mar 8, 2015
@birkenfeld
Copy link
Member

I think it works as I'd like it to now.

Markdown support can now be done entirely in an extension until we include it in 1.4.

@cekees cekees mentioned this pull request Apr 22, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants