In order to fully fix bug 4927, we need to do some LaTeX->LyX conversion, because subfigure captions can contain LaTeX constructs such as \label. Currently, subcaptions with such constructs are simply eaten (i.e., dataloss).
I think we should factor out the routines of convert_latexcommand_index to a helper function which is used by convert_latexcommand_index, convert_subfig and maybe others. I failed at doing this due to limited python knowledge. I'd appreciate if someone could jump in (and maybe also clean up my really ugly convert_subfig routine). Thanks in advance, Jürgen