Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mkdocs/structure/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import shutil
import warnings
from pathlib import PurePath
from typing import TYPE_CHECKING, Callable, Iterable, Iterator, Sequence
from typing import TYPE_CHECKING, Callable, Iterable, Iterator, Sequence, Optional
from urllib.parse import quote as urlquote

import jinja2.environment
Expand Down Expand Up @@ -193,6 +193,9 @@ class File:
inclusion: InclusionLevel = InclusionLevel.UNDEFINED
"""Whether the file will be excluded from the built site."""

generated_by: Optional[str] = None
"""Indicator for plugin developers to track which system created the File."""

@property
def src_path(self) -> str:
"""Same as `src_uri` (and synchronized with it) but will use backslashes on Windows. Discouraged."""
Expand Down Expand Up @@ -222,6 +225,7 @@ def __init__(
*,
dest_uri: str | None = None,
inclusion: InclusionLevel = InclusionLevel.UNDEFINED,
generated_by: Optional[str] = None,
) -> None:
self.page = None
self.src_path = path
Expand All @@ -233,6 +237,7 @@ def __init__(
self.abs_src_path = os.path.normpath(os.path.join(src_dir, self.src_uri))
self.abs_dest_path = os.path.normpath(os.path.join(dest_dir, self.dest_uri))
self.inclusion = inclusion
self.generated_by = generated_by

def __eq__(self, other) -> bool:
return (
Expand Down