It seems I praised Beautiful Soup too quickly. I was playing with it yesterday and discovered it mangles Javascript included in file. I can’t say it does this every time, but it’s fairly obvious if you have few kilobytes of code stuck in file. There you have it, another argument why Javascript and CSS should be stored in external files.
It’s not an option for me though, so I’ll have to work around it.
It’s still a great module, as long as you can work within its limitations, but it’s not panacea. At least not yet.
If I find time, I’ll try to fix the problem, since I really dislike idea of processing files using usual methods (regular expressions & co.).