fabricatio_typst.models.article_base
Hierarchical article outline base classes (section → chapter → article).
Attributes
Classes
Base class for article outlines. |
|
Base class for article sections and subsections. |
|
Base class for article sections and subsections. |
|
Base class for article chapters. |
|
Base class for article outlines. |
Module Contents
- fabricatio_typst.models.article_base.ARTICLE_WRAPPER
- class fabricatio_typst.models.article_base.ArticleOutlineBase(/, **data: Any)
Bases:
fabricatio_capabilities.models.generic.ProposedUpdateAble,fabricatio_capabilities.models.generic.PersistentAble,fabricatio_capabilities.models.generic.ModelHash,fabricatio_typst.models.generic.Introspect,fabricatio_typst.models.meta.FromTypstCode,fabricatio_typst.models.meta.ToTypstCode,abc.ABCBase class for article outlines.
- property metadata: fabricatio_typst.models.meta.ArticleMetaData
Returns the metadata of the article component.
- update_metadata(other: fabricatio_typst.models.meta.ArticleMetaData) Self
Updates the metadata of the current instance with the attributes of another instance.
- update_from_inner(other: Self) Self
Updates the current instance with the attributes of another instance.
- class fabricatio_typst.models.article_base.SubSectionBase(/, **data: Any)
Bases:
ArticleOutlineBaseBase class for article sections and subsections.
- class fabricatio_typst.models.article_base.SectionBase[T: SubSectionBase](/, **data: Any)
Bases:
ArticleOutlineBaseBase class for article sections and subsections.
- subsections: List[T]
Subsections of the section. Contains at least one subsection. You can also add more as needed.
- child_type: ClassVar[Type[SubSectionBase]]
- to_typst_code() str
Converts the section into a Typst formatted code snippet.
- Returns:
The formatted Typst code snippet.
- Return type:
- classmethod from_typst_code(title: str, body: str, **kwargs) Self
Creates an Article object from the given Typst code.
- update_from_inner(other: Self) Self
Updates the current instance with the attributes of another instance.
- class fabricatio_typst.models.article_base.ChapterBase[T: SectionBase](/, **data: Any)
Bases:
ArticleOutlineBaseBase class for article chapters.
- sections: List[T]
Sections of the chapter. Contains at least one section. You can also add more as needed.
- child_type: ClassVar[Type[SectionBase]]
- classmethod from_typst_code(title: str, body: str, **kwargs) Self
Creates an Article object from the given Typst code.
- update_from_inner(other: Self) Self
Updates the current instance with the attributes of another instance.
- class fabricatio_typst.models.article_base.ArticleBase[T: ChapterBase](/, **data: Any)
Bases:
fabricatio_capabilities.models.generic.FinalizedDumpAble,fabricatio_capabilities.models.generic.AsPrompt,fabricatio_typst.models.meta.FromTypstCode,fabricatio_typst.models.meta.ToTypstCode,abc.ABCBase class for article outlines.
- description: str = None
A comprehensive description of this object, including its purpose, scope, and context. This should clearly explain what this object is about, why it exists, and in what situations it applies. The description should be detailed enough to provide full understanding of this object’s intent and application.
- chapters: List[T]
Chapters of the article. Contains at least one chapter. You can also add more as needed.
- child_type: ClassVar[Type[ChapterBase]]
- property exact_word_count: int
Calculates the total word count across all chapters in the article.
- Returns:
The cumulative word count of all chapters.
- Return type:
- classmethod from_typst_code(title: str, body: str, **kwargs) Self
Generates an article from the given Typst code.
- iter_dfs_rev() Generator[ArticleOutlineBase, None, None]
Performs a depth-first search (DFS) through the article structure in reverse order.
- iter_dfs() Generator[ArticleOutlineBase, None, None]
Performs a depth-first search (DFS) through the article structure.
- iter_sections() Generator[Tuple[ChapterBase, SectionBase], None, None]
Iterates through all sections in the article.
- iter_subsections() Generator[Tuple[ChapterBase, SectionBase, SubSectionBase], None, None]
Iterates through all subsections in the article.
- find_introspected() Tuple[ArticleOutlineBase, str] | None
Finds the first introspected component in the article structure.
- iter_section_title() Generator[str, None, None]
Iterates through all section titles in the article.
- iter_subsection_title() Generator[str, None, None]
Iterates through all subsection titles in the article.
- finalized_dump() str
Generates standardized hierarchical markup for academic publishing systems.
Implements ACL 2024 outline conventions with four-level structure: = Chapter Title (Level 1) == Section Title (Level 2) === Subsection Title (Level 3) ==== Subsubsection Title (Level 4)
- avg_chap_wordcount[S: ArticleBase]() S
Set all chap have same word count sum up to be self.expected_word_count.
- avg_sec_wordcount[S: ArticleBase]() S
Set all sec have same word count sum up to be self.expected_word_count.
- avg_subsec_wordcount[S: ArticleBase]() S
Set all subsec have same word count sum up to be self.expected_word_count.
- avg_wordcount_recursive[S: ArticleBase]() S
Set all chap, sec, subsec have same word count sum up to be self.expected_word_count.
- update_article_file[S: ArticleBase](file: str | pathlib.Path) S
Update the article file.
- classmethod from_article_file[S: ArticleBase](file: str | pathlib.Path, title: str = '') S
Load article from file.