1
0
Fork 0
forked from github/pelican

Log warnings about files that would have been processed by disabled readers

This commit is contained in:
boxydog 2024-06-17 08:11:21 -05:00
commit f19de98b9e
7 changed files with 119 additions and 13 deletions

View file

@ -29,6 +29,7 @@ from typing import (
)
import dateutil.parser
from watchfiles import Change
try:
from zoneinfo import ZoneInfo
@ -39,7 +40,6 @@ from markupsafe import Markup
if TYPE_CHECKING:
from pelican.contents import Content
from pelican.readers import Readers
from pelican.settings import Settings
logger = logging.getLogger(__name__)
@ -797,9 +797,8 @@ def order_content(
def wait_for_changes(
settings_file: str,
reader_class: type[Readers],
settings: Settings,
):
) -> set[tuple[Change, str]]:
content_path = settings.get("PATH", "")
theme_path = settings.get("THEME", "")
ignore_files = {
@ -924,3 +923,13 @@ def temporary_locale(
locale.setlocale(lc_category, temp_locale)
yield
locale.setlocale(lc_category, orig_locale)
def file_suffix(path: str) -> str:
"""Return the suffix of a filename in a path."""
_, ext = os.path.splitext(os.path.basename(path))
ret = ""
if len(ext) > 1:
# drop the ".", e.g., "exe", not ".exe"
ret = ext[1:]
return ret