I'm working on some old HTML documentation, where are multiple code snippets (several lines long). I need to replace this old HTML-ized code with new one using modern styling.
What I have now:
... ...
<pre>
<font color="ff0000">void</font> main() {
<font color="00ff00">return</font> <font color="00ffff">0</font>;
}
</pre>
... ...
Now I can select this fragment between pre tags and remove all HTML using some keystrokes which I defined. The result is pure C code which looks like this:
... ...
void main() {
return 0;
}
... ...
The final step, which is time consuming, is to select this clean code again, and run :TOhtml command, which generates the whole new HTML document (in new unsaved buffer) with proper highlighting of the code. I have to scroll thru this document, find pre tag and cut the styled code fragment. Then I have to close this new buffer, return to my old buffer, paste new code, and select and delete the old code AGAIN. This is awkard and very time consuming.
Question: how to select the old "bad" code and press one keystroke to have this work done? It has to be just cleaned from old HTML to pure cod and then colorized and the result should replace in-place the old code.
Desired result:
... ...
<pre class="code">
<span class="keyword">void</span> <span class="funcname">main</span>() {
<span class="return">return</span> <span class="number">0</span>;
}
</pre>
... ...
CSS class names are irrelevant - I can style them in my external CSS file, they only have to be inserted. I prefer not to load any huge/junky/bloated/bundle plugin system.
>pkV
<d<CR>