Ah - it seems to be the regular expression in mobi_html.py that's the problem. It didn't consider that there might be anything other than white space there.
That's a pretty simple fix, and shouldn't break anything. Just two lines need changing in mobi_html.py
Code:
link_pattern = re.compile(r'''<a([^>]*?)filepos=['"]{0,1}0*(\d+)['"]{0,1}([^>]*?)>''', re.IGNORECASE)
srctext = link_pattern.sub(r'''<a\1href="#filepos\2"\3>''', srctext)
I'm just testing it now, and if I get time I'll upload a fixed version later today. Perhaps even wrapped in a new version of the AppleScript too!