fabricatio_typst.models.article_base
A foundation for hierarchical document components with dependency tracking.
Attributes
Classes
Enumeration of different types of references that can be made in an article. |
|
Metadata for an article component. |
|
Base class for article components that can be created from a Typst code snippet. |
|
Base class for article components that can be converted to a Typst code snippet. |
|
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.ReferringType
Bases:
enum.StrEnumEnumeration of different types of references that can be made in an article.
- CHAPTER = 'chapter'
- SECTION = 'section'
- SUBSECTION = 'subsection'
- class fabricatio_typst.models.article_base.ArticleMetaData(/, **data: Any)
Bases:
fabricatio_core.models.generic.SketchedAble,fabricatio_core.models.generic.Described,fabricatio_capabilities.models.generic.WordCount,fabricatio_core.models.generic.Titled,fabricatio_core.models.generic.LanguageMetadata for an article component.
- 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.
- title: str = None
The title of this object, make it professional and concise.No prefixed heading number should be included.
- property typst_metadata_comment: str
Generates a comment for the metadata of the article component.
- update_unstructured_body[S: ArticleMetaData](body: str) S
Update the unstructured body of the article component.
- class fabricatio_typst.models.article_base.FromTypstCode(/, **data: Any)
Bases:
ArticleMetaDataBase class for article components that can be created from a Typst code snippet.
- class fabricatio_typst.models.article_base.ToTypstCode(/, **data: Any)
Bases:
ArticleMetaDataBase class for article components that can be converted to a Typst code snippet.
- 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,FromTypstCode,ToTypstCode,abc.ABCBase class for article outlines.
- property metadata: ArticleMetaData
Returns the metadata of the article component.
- update_metadata(other: 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,FromTypstCode,ToTypstCode,abc.ABCBase class for article outlines.
- description: str = None
The abstract of this article, which serves as a concise summary of an academic article, encapsulating its core purpose, methodologies, key results, and conclusions while enabling readers to rapidly assess the relevance and significance of the study. Functioning as the article’s distilled essence, it succinctly articulates the research problem, objectives, and scope, providing a roadmap for the full text while also facilitating database indexing, literature reviews, and citation tracking through standardized metadata. Additionally, it acts as an accessibility gateway, allowing scholars to gauge the study’s contribution to existing knowledge, its methodological rigor, and its broader implications without engaging with the entire manuscript, thereby optimizing scholarly communication efficiency.
- 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.
- Returns:
Each component in the article structure in reverse order.
- Return type:
Generator[ArticleMainBase]
- iter_dfs() Generator[ArticleOutlineBase, None, None]
Performs a depth-first search (DFS) through the article structure.
- Returns:
Each component in the article structure.
- Return type:
Generator[ArticleMainBase]
- iter_sections() Generator[Tuple[ChapterBase, SectionBase], None, None]
Iterates through all sections in the article.
- Returns:
Each section in the article.
- Return type:
Generator[ArticleOutlineBase]
- iter_subsections() Generator[Tuple[ChapterBase, SectionBase, SubSectionBase], None, None]
Iterates through all subsections in the article.
- Returns:
Each subsection in the article.
- Return type:
Generator[ArticleOutlineBase]
- 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)
- Returns:
Strictly formatted outline with academic sectioning
- Return type:
Example
= Methodology == Neural Architecture Search Framework === Differentiable Search Space ==== Constrained Optimization Parameters === Implementation Details == Evaluation Protocol
- 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.