1
0
Fork 0
forked from github/pelican

readers: Add 'static' to the base Reader's extensions

Instead of just being a base class, we can use it to parse static
files.  It won't actually do any parsing, but we will get path
metadata extraction from read_file, and this will make the
StaticGenerator implementation simpler.
This commit is contained in:
W. Trevor King 2013-01-04 15:57:58 -05:00
commit f147d9ec4a

View file

@ -44,6 +44,7 @@ METADATA_PROCESSORS = {
class Reader(object):
enabled = True
file_extensions = ['static']
extensions = None
def __init__(self, settings):
@ -54,6 +55,12 @@ class Reader(object):
return METADATA_PROCESSORS[name](value, self.settings)
return value
def read(self, source_path):
"No-op parser"
content = None
metadata = {}
return content, metadata
class _FieldBodyTranslator(HTMLTranslator):
@ -311,7 +318,7 @@ class AsciiDocReader(Reader):
EXTENSIONS = {}
for cls in Reader.__subclasses__():
for cls in [Reader] + Reader.__subclasses__():
for ext in cls.file_extensions:
EXTENSIONS[ext] = cls