|
| 1 | +import itertools |
1 | 2 | import logging |
2 | 3 | import os |
3 | 4 | import re |
@@ -321,6 +322,7 @@ def _resolve_links(self): |
321 | 322 | log.debug(dst_to_src) |
322 | 323 |
|
323 | 324 | md_link_regex = re.compile(r"\[.*?\]\((\.(?:\.)?\/.*?)\)") |
| 325 | + iframe_link_regex = re.compile(r"<iframe.*?src=\"(\.(?:\.)?\/.*?)\".*?>") |
324 | 326 |
|
325 | 327 | dst_files = [] |
326 | 328 |
|
@@ -363,7 +365,10 @@ def _walk_struct(structure): |
363 | 365 | with open(_file, "r") as f: |
364 | 366 | content = f.read() |
365 | 367 |
|
366 | | - for match in re.finditer(md_link_regex, content): |
| 368 | + for match in itertools.chain( |
| 369 | + re.finditer(md_link_regex, content), |
| 370 | + re.finditer(iframe_link_regex, content), |
| 371 | + ): |
367 | 372 | src_link = match.group(1) |
368 | 373 | log.info(f"Found link {src_link}") |
369 | 374 | # dst_link = src_to_dst[path_utils.real_join(src_dir, src_link)] |
@@ -432,7 +437,7 @@ def run(self): |
432 | 437 | log.error(f"Command {self.init_command} failed with code {p.returncode}") |
433 | 438 | log.error(f"STDOUT: {p.stdout.decode('utf-8')}") |
434 | 439 | log.error(f"STDERR: {p.stderr.decode('utf-8')}") |
435 | | - raise PluginRunError(f"Error while running init command") |
| 440 | + raise PluginRunError("Error while running init command") |
436 | 441 |
|
437 | 442 | # Folders we need to delete: |
438 | 443 | # - blog |
@@ -490,16 +495,14 @@ def run(self): |
490 | 495 | log.error(f"Command {math_command} failed with code {p.returncode}") |
491 | 496 | log.error(f"STDOUT: {p.stdout.decode('utf-8')}") |
492 | 497 | log.error(f"STDERR: {p.stderr.decode('utf-8')}") |
493 | | - raise PluginRunError( |
494 | | - f"Error while installing math dependencies command" |
495 | | - ) |
| 498 | + raise PluginRunError("Error while installing math dependencies command") |
496 | 499 |
|
497 | 500 | p = subprocess.run(self.build_command, capture_output=True) |
498 | 501 | if p.returncode != 0: |
499 | 502 | log.error(f"Command {self.build_command} failed with code {p.returncode}") |
500 | 503 | log.error(f"STDOUT: {p.stdout.decode('utf-8')}") |
501 | 504 | log.error(f"STDERR: {p.stderr.decode('utf-8')}") |
502 | | - raise PluginRunError(f"Error while running build command") |
| 505 | + raise PluginRunError("Error while running build command") |
503 | 506 |
|
504 | 507 | # os.mkdir(path_utils.real_join(self.output_dir, "output")) |
505 | 508 | if not self.config.get("debug", False): |
|
0 commit comments