It's generally easier to do this stuff when you're outside of Calibre, do the conversion to EPUB/HTMLZ and try get things to be reasonable, once that's done then take the markup and process it by hand in something easier - RegexBuddy works well, tho I'm sure there are free alternatives, I never found one with a good spread of features. Sigil is nice for EPUB editing, however the current release has some problems with regex (tho it's fixed for the next release! - no real preview however).
It's also pretty tricky to help without a sample to work from, if you provide that, I'm sure I can work out a better way (there's a few problems with the regex there that will most likely miss things).
|