I want to write a web-based code generator for a Python crawler. Its aim is to automatically generate code so a developer doesn't need to write it, but I've run into this problem: in one of my project's webpages, there are some checkboxes, buttons, etc. Each of them generates some Python code and writes it to a common textarea. However, when I uncheck boxes I can't figure out how to remove the corresponding code from the textarea, because it's all been mixed together. For example:
- Check box 1 -- it writes code snippet 1 to the textarea
- Check box 2 -- it writes code snippet 2 to the textarea
- Check box 3 -- it writes code snippet 3 to the textarea
- Uncheck box 2 -- it needs to somehow remove code snippet 2 from the text area, but leave behind code snippets 1 and 3
Is there some way to fix this problem, or any better solution for the whole code generator project?