Skip to content

Commit

Permalink
fix: #21
Browse files Browse the repository at this point in the history
  • Loading branch information
shaokeyibb committed Aug 10, 2024
1 parent 95a1fa2 commit 033a9cc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,15 @@ class OffsetsInjectionBlockProcessor(BlockProcessor):

last_processed_line_idx: int = -1

is_in_prerender: bool = False

def __init__(self, parser: BlockParser, meta: dict):
super(OffsetsInjectionBlockProcessor, self).__init__(parser)
self.meta = meta

def test(self, _, block) -> bool:
if self.is_in_prerender:
return False
for i in range(0, len(self.meta["preprocessed_document"])):
line: str = self.meta["preprocessed_document"][i]
if len(line) == 0:
Expand Down Expand Up @@ -129,9 +133,11 @@ def run(self, parent: etree.Element, blocks: list[str]):
if start == -1:
return

self.is_in_prerender = True
previous_len = len(parent)
self.parser.parseBlocks(parent, [block])
parsed_len = len(parent)
self.is_in_prerender = False

blocks.pop(0)

Expand Down

0 comments on commit 033a9cc

Please sign in to comment.