(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image)
| 51 | return str(soup) |
| 52 | |
| 53 | def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image): |
| 54 | buffer = get_buffer(file) |
| 55 | if type(limit) is str: |
| 56 | limit = int(limit) |
| 57 | if type(with_filter) is str: |
| 58 | with_filter = with_filter.lower() == 'true' |
| 59 | if pattern_list is not None and len(pattern_list) > 0: |
| 60 | split_model = SplitModel(pattern_list, with_filter, limit) |
| 61 | else: |
| 62 | split_model = SplitModel(default_pattern_list, with_filter=with_filter, limit=limit) |
| 63 | try: |
| 64 | encoding = get_encoding(buffer) |
| 65 | content = buffer.decode(encoding) |
| 66 | content = self._remove_anchor_links(content) |
| 67 | content = markdownify(content, heading_style='ATX') |
| 68 | except BaseException as e: |
| 69 | maxkb_logger.error(f"Error processing HTML file {file.name}: {e}, {traceback.format_exc()}") |
| 70 | |
| 71 | return { |
| 72 | 'name': file.name, 'content': [] |
| 73 | } |
| 74 | return { |
| 75 | 'name': file.name, |
| 76 | 'content': split_model.parse(content) |
| 77 | } |
| 78 | |
| 79 | def get_content(self, file, save_image): |
| 80 | buffer = file.read() |
nothing calls this directly
no test coverage detected