(self, *args)
| 134 | ) |
| 135 | |
| 136 | def execute_command(self, *args) -> str: |
| 137 | # args[0] -> N (int) |
| 138 | # args[1] -> M (int) |
| 139 | # args[2] -> old latex |
| 140 | # args[3] -> new lines to replace |
| 141 | try: |
| 142 | args = args[0] |
| 143 | current_latex = args[2] |
| 144 | lines_to_add = list(reversed(args[3])) |
| 145 | lines_to_replace = list(reversed(range(args[0], args[1]+1))) |
| 146 | for _ln in lines_to_replace: |
| 147 | current_latex.pop(_ln) |
| 148 | for _line in lines_to_add: |
| 149 | current_latex.insert(args[0], _line) |
| 150 | new_latex = "\n".join(current_latex) |
| 151 | latex_exec = f"{new_latex}" |
| 152 | latex_ret = compile_latex(latex_exec, self.save_loc, compile=args[4]) |
| 153 | if "error" in latex_ret.lower(): return (False, None, latex_ret) |
| 154 | return (True, current_latex, latex_ret) |
| 155 | except Exception as e: |
| 156 | return (False, None, str(e)) |
| 157 | |
| 158 | def matches_command(self, cmd_str) -> bool: |
| 159 | if "```EDIT" in cmd_str: return True |
nothing calls this directly
no test coverage detected