mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
[WIP] Read content selectively
This commit is contained in:
parent
7a26f509df
commit
990f69cfca
2 changed files with 17 additions and 7 deletions
|
|
@ -808,13 +808,21 @@ class StaticGenerator(Generator):
|
|||
if self._is_potential_source_path(f):
|
||||
continue
|
||||
|
||||
static = self.readers.read_file(
|
||||
base_path=self.path, path=f, content_class=Static,
|
||||
fmt='static', context=self.context,
|
||||
preread_signal=signals.static_generator_preread,
|
||||
preread_sender=self,
|
||||
context_signal=signals.static_generator_context,
|
||||
context_sender=self)
|
||||
try:
|
||||
static = self.readers.read_file(
|
||||
base_path=self.path, path=f, content_class=Static,
|
||||
fmt='static', context=self.context,
|
||||
preread_signal=signals.static_generator_preread,
|
||||
preread_sender=self,
|
||||
context_signal=signals.static_generator_context,
|
||||
context_sender=self)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
self._add_failed_source_path(f, static=True)
|
||||
continue
|
||||
|
||||
self.staticfiles.append(static)
|
||||
self.add_source_path(static, static=True)
|
||||
self._update_context(('staticfiles',))
|
||||
|
|
|
|||
|
|
@ -537,6 +537,8 @@ class Readers(FileStampDataCacher):
|
|||
|
||||
path = os.path.abspath(os.path.join(base_path, path))
|
||||
source_path = posixize_path(os.path.relpath(path, base_path))
|
||||
if 'READ_SELECTED' in self.settings and self.settings['READ_SELECTED'] not in source_path:
|
||||
raise ValueError(f"Skipping {source_path}")
|
||||
logger.debug(
|
||||
'Read file %s -> %s',
|
||||
source_path, content_class.__name__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue