Parse input content into a list of raw entries. Args: input_content: The raw text or BibTeX string to parse. input_type: ``"txt"`` for plain-text references or ``"bib"`` for BibTeX format. Returns: A list of :class:`RawEntry` dict
(self, input_content: str, input_type: str)
| 21 | self.logger = logging.getLogger(__name__) |
| 22 | |
| 23 | def parse(self, input_content: str, input_type: str) -> List[RawEntry]: |
| 24 | """Parse input content into a list of raw entries. |
| 25 | |
| 26 | Args: |
| 27 | input_content: The raw text or BibTeX string to parse. |
| 28 | input_type: ``"txt"`` for plain-text references or |
| 29 | ``"bib"`` for BibTeX format. |
| 30 | |
| 31 | Returns: |
| 32 | A list of :class:`RawEntry` dictionaries. |
| 33 | """ |
| 34 | self.logger.info(f"Starting to parse {input_type} format input content") |
| 35 | |
| 36 | if input_type.lower() == 'bib': |
| 37 | return self._parse_bibtex(input_content) |
| 38 | elif input_type.lower() == 'txt': |
| 39 | return self._parse_text(input_content) |
| 40 | else: |
| 41 | raise ParseError(f"Unsupported input type: {input_type}") |
| 42 | |
| 43 | def _parse_bibtex(self, bibtex_content: str) -> List[RawEntry]: |
| 44 | """Parse BibTeX format content""" |
no test coverage detected