mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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:
parent
90822de962
commit
f147d9ec4a
1 changed files with 8 additions and 1 deletions
|
|
@ -44,6 +44,7 @@ METADATA_PROCESSORS = {
|
||||||
|
|
||||||
class Reader(object):
|
class Reader(object):
|
||||||
enabled = True
|
enabled = True
|
||||||
|
file_extensions = ['static']
|
||||||
extensions = None
|
extensions = None
|
||||||
|
|
||||||
def __init__(self, settings):
|
def __init__(self, settings):
|
||||||
|
|
@ -54,6 +55,12 @@ class Reader(object):
|
||||||
return METADATA_PROCESSORS[name](value, self.settings)
|
return METADATA_PROCESSORS[name](value, self.settings)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def read(self, source_path):
|
||||||
|
"No-op parser"
|
||||||
|
content = None
|
||||||
|
metadata = {}
|
||||||
|
return content, metadata
|
||||||
|
|
||||||
|
|
||||||
class _FieldBodyTranslator(HTMLTranslator):
|
class _FieldBodyTranslator(HTMLTranslator):
|
||||||
|
|
||||||
|
|
@ -311,7 +318,7 @@ class AsciiDocReader(Reader):
|
||||||
|
|
||||||
EXTENSIONS = {}
|
EXTENSIONS = {}
|
||||||
|
|
||||||
for cls in Reader.__subclasses__():
|
for cls in [Reader] + Reader.__subclasses__():
|
||||||
for ext in cls.file_extensions:
|
for ext in cls.file_extensions:
|
||||||
EXTENSIONS[ext] = cls
|
EXTENSIONS[ext] = cls
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue