I've thought about this some more, and here's how I would do it:
Make the ebook format some lightweight markup language, for e.g., markdown (see the thread on txt2lrf for examples of markdown in action)
python-markdown has a plugin system that will allow you to easily write plugins to support any custom ebook features you need. It will mean that you can write a simple Text Editor with syntax highlighting and a preview button (WYSIWYM + automatic partial WYSIWYG). I believe, you can accommodate all the needs of the typical ebook author using markdown. There are plenty of existing tools to convert markdown to HTML in many languages.
It's light, simple, easy to learn and easy to program. It leverages existing code. The hardest coding would be in writing input filters for various existing ebook formats. A lot of authors who also write on the web would be familiar with lightweight markup languages already.
|