feat: add some extractor
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from typing import cast
|
||||||
|
from pylatexenc.latexwalker import LatexNode, LatexMacroNode
|
||||||
from .common import Extractor
|
from .common import Extractor
|
||||||
|
|
||||||
class AustExtractor(Extractor):
|
class AustExtractor(Extractor):
|
||||||
@@ -5,4 +7,14 @@ class AustExtractor(Extractor):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def extract_include_command(self, node: LatexNode) -> str | None:
|
||||||
|
if not isinstance(node, LatexMacroNode):
|
||||||
|
return None
|
||||||
|
|
||||||
|
macro_name = cast(str, node.macroname)
|
||||||
|
match macro_name:
|
||||||
|
case 'include' | 'input':
|
||||||
|
# TODO: handle include command
|
||||||
|
return None
|
||||||
|
case _:
|
||||||
|
return None
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from pylatexenc.latexwalker import LatexNode, LatexMacroNode
|
||||||
|
|
||||||
class Extractor(ABC):
|
class Extractor(ABC):
|
||||||
pass
|
"""
|
||||||
|
An abstract base class for all extractors.
|
||||||
|
|
||||||
|
Extractors are used to extract information from LaTeX nodes.
|
||||||
|
"""
|
||||||
|
@abstractmethod
|
||||||
|
def extract_include_command(self, node: LatexNode) -> str | None:
|
||||||
|
"""
|
||||||
|
Extract the include command from a LaTeX node.
|
||||||
|
|
||||||
|
:param node: The LaTeX node to extract the include command from.
|
||||||
|
:return: The path to the include file, otherwise None.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user