Skip to content

File

LogseqFile class to process Logseq files.

Classes:

Name Description
MaskedBlocks

Class to hold masked blocks data.

LogseqFile

A class to represent a Logseq file.

MaskedBlocks(content: str = '', blocks: dict[str, str] = dict()) dataclass

Class to hold masked blocks data.

Methods:

Name Description
unmask_blocks

Restore the original content by replacing placeholders with their blocks.

unmask_blocks() -> None

Restore the original content by replacing placeholders with their blocks.

LogseqFile(path_input: InitVar[Path], data: dict[str, Any] = dict(), masked: MaskedBlocks = MaskedBlocks(), node: NodeType = NodeType(), is_hls: bool = False) dataclass

A class to represent a Logseq file.

Methods:

Name Description
__post_init__

Initialize the LogseqFile object.

__hash__

Return the hash of the LogseqFile based on its path.

__eq__

Check equality based on the file path.

__lt__

Compare LogseqFile objects based on their file names.

process

Process the Logseq file to extract metadata and content.

init_file_data

Extract metadata from a file.

process_content_data

Process content data to extract various elements like backlinks, tags, and properties.

extract_data_pairs

Extract data pairs from the Logseq file.

extract_data

Extract data from the Logseq file.

mask_blocks

Mask code blocks and other patterns in the content.

extract_primary_data

Extract primary data from the content.

check_has_backlinks

Check has backlinks in the content.

__post_init__(path_input: Path) -> None

Initialize the LogseqFile object.

__hash__() -> int

Return the hash of the LogseqFile based on its path.

__eq__(other: object) -> bool

Check equality based on the file path.

__lt__(other: object) -> bool

Compare LogseqFile objects based on their file names.

process() -> None

Process the Logseq file to extract metadata and content.

init_file_data() -> None

Extract metadata from a file.

process_content_data() -> None

Process content data to extract various elements like backlinks, tags, and properties.

extract_data_pairs() -> Generator[tuple[str, Any]]

Extract data pairs from the Logseq file.

extract_data() -> None

Extract data from the Logseq file.

mask_blocks() -> None

Mask code blocks and other patterns in the content.

extract_primary_data() -> Generator[tuple[str, Any]]

Extract primary data from the content.

Check has backlinks in the content.