refactor sphinx.io; SphinxFileInput can expect that app argument is always available

This commit is contained in:
Takeshi KOMIYA 2017-11-15 11:34:52 +09:00
parent a0200ad499
commit aa4fd0e1b7

View File

@ -141,10 +141,11 @@ class SphinxFileInput(FileInput):
def read(self):
# type: () -> unicode
data = FileInput.read(self)
if self.app:
arg = [data]
self.app.emit('source-read', self.env.docname, arg)
data = arg[0]
# emit source-read event
arg = [data]
self.app.emit('source-read', self.env.docname, arg)
data = arg[0]
parser = self.app.registry.get_source_parser(self.source_path)
docinfo, data = split_docinfo(data)