As most of you are probably aware the new web interface in this forum does not faithfully reproduce indentation which is a pain when trying to understand the code somebody has posted. (In fairness to the web administrators this appears to be a function of the way HTML treats multiple spaces.)
Selecting and copying the code off the web page and pasting it into something like Notepad produces the same result. However the HTML source does hold the indentation, so with a bit of mucking around you can reformat the code as the originator intended. Unfortunately I couldn't make this work in Notepad, so you need to get yourself an editor with a smarter Replace function like TextPad.
1. Open the HTML source for the post. In Internet Explorer do this by right-clicking the page and choosing View Source which will open it in Notepad.
2. Use the Find command to locate the beginning of the code block you want.
3. The code continues straight across the one line but eventually wraps to the next line(s) so you'll probably need to scroll across to find the end of the code. Hold down Shift and click at the end of the code to select the whole code block, then copy it to the clipboard.
4. Switch to your smarter editor and paste in the code.
5. Replace the HTML line-break tag with a newline. In TextPad you do this by saying Find "
", Replace with "\n" and ticking the Regular Expression box.
6. Grab your lemonade, sit back, and leisurely view the formatted code! 😉
Regards
Wayne Ivory
IT Analyst Programmer
Wespine Industries Pty Ltd