Add sphinx.parsers.Parser class; a base class for new parsers #2207

Merged
merged 2 commits into from Jan 17, 2016

Conversation

Projects
None yet
3 participants
@tk0miya
Member

tk0miya commented Dec 31, 2015

Since 1.3, Sphinx supports additional parsers.
But, it accepts docutils parsers simply. So the parsers could not read any configurations and environments. I can not even call warn() to show error messages.

To improve that situation, I would like to add sphinx.parsers.Parser as a base class for Sphinx parsers.
The class inherits docutils.parsers.Parser and implements set_application() in addition.
It enables subclasses to read configurations, to access environments and to logging.

@birkenfeld

This comment has been minimized.

Show comment
Hide comment
@birkenfeld

birkenfeld Jan 1, 2016

Member

+1

Might need some documentation updates?

Member

birkenfeld commented Jan 1, 2016

+1

Might need some documentation updates?

@tk0miya

This comment has been minimized.

Show comment
Hide comment
@tk0miya

tk0miya Jan 2, 2016

Member

Thank you for comment. I updated docs.
Can I merge this into master?

Member

tk0miya commented Jan 2, 2016

Thank you for comment. I updated docs.
Can I merge this into master?

sphinx/parsers.py
+
+ A Base class for additional parsers.
+
+ :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.

This comment has been minimized.

@shimizukawa

shimizukawa Jan 17, 2016

Member

2015 -> 2016

@shimizukawa

shimizukawa Jan 17, 2016

Member

2015 -> 2016

+ Emit a informational message. (Same as :meth:`sphinx.application.Sphinx.info()`)
+ """
+
+ def set_application(self, app):

This comment has been minimized.

@shimizukawa

shimizukawa Jan 17, 2016

Member

This method should have docstring to be displayed in API reference.

For example:

"""set_application will be called from Sphinx to set app and other instance variables

:param sphinx.application.Sphinx app: Sphinx application object
"""
@shimizukawa

shimizukawa Jan 17, 2016

Member

This method should have docstring to be displayed in API reference.

For example:

"""set_application will be called from Sphinx to set app and other instance variables

:param sphinx.application.Sphinx app: Sphinx application object
"""
@shimizukawa

This comment has been minimized.

Show comment
Hide comment
@shimizukawa

shimizukawa Jan 17, 2016

Member

+1 with nits.

Member

shimizukawa commented Jan 17, 2016

+1 with nits.

@shimizukawa shimizukawa added this to the 1.4 milestone Jan 17, 2016

tk0miya added a commit that referenced this pull request Jan 17, 2016

Merge pull request #2207 from tk0miya/baseclass_for_parsers
Add sphinx.parsers.Parser class; a base class for new parsers

@tk0miya tk0miya merged commit cf5e138 into sphinx-doc:master Jan 17, 2016

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

tk0miya added some commits Dec 31, 2015

Add sphinx.parsers.Parser class; a base class for new parsers
The class inherits ``docutils.parsers.Parser`` and implements ``set_application()`` in addition.
It enables subclasses to read configurations, to access environments and to logging.
@tk0miya

This comment has been minimized.

Show comment
Hide comment
@tk0miya

tk0miya Jan 17, 2016

Member

Thank you for reviewing. I merged it.

Member

tk0miya commented Jan 17, 2016

Thank you for reviewing. I merged it.

tk0miya added a commit that referenced this pull request Jan 17, 2016

@tk0miya tk0miya deleted the tk0miya:baseclass_for_parsers branch Jan 17, 2016

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