From bdc3522f7fc1623300e04feef441599f2d48571c Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Thu, 23 Nov 2023 00:12:58 +0100 Subject: [PATCH] fix comment tags deletion in cmd_include with section --- html-preprocessor | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/html-preprocessor b/html-preprocessor index effaa32..c9c8d63 100755 --- a/html-preprocessor +++ b/html-preprocessor @@ -182,6 +182,7 @@ class Sidenav: space = len(args) cmd = args[:space] cmd_args = "" + pdebug(f"cmd_sidenav: cmd='{cmd}' cmd_args='{cmd_args}'") if 0 < space and space < len(args) - 1: cmd_args = args[space+1:].strip(" ") if cmd == "skip": @@ -242,8 +243,15 @@ def cmd_include(args: str, variables:dict[str, str]={}) -> str: p.pos["end"] = max(p.pos["cmt_end"] + len(COMMENT_END), p.pos["line_end"] + 1) # p.pos["end"] = p.pos["cmt_beg"] p.replace_command_with_output("") - p.command_end() - if p.pos["start"] >= 0 and p.pos["end"] > 0: break + p.command_end() # remove the command (+comment) + if p.pos["start"] >= 0 and p.pos["end"] > 0: break + continue + # section cmd in multiline comment is not supported, so simply jump to end of comment + p.i = p.pos["cmt_end"] + len(COMMENT_END) + p.pos["cmt_beg"] = -1 + p.pos["cmd_beg"] = -1 + p.pos["cmt_end"] = -1 + p.pos["cmd_end"] = -1 if p.pos["start"] >= 0: if p.pos["end"] < 0: p.pos["end"] = len(p)