Jean-Marc Lasgouttes wrote: > Le 15/02/2015 20:43, Georg Baum a écrit : >> The attached patch implements this behaviour. In an ideal world, the >> backward compatibility would be handled completely by lyx2lyx, but this >> is currently not possible, since we have no infrastructure in lyx2lyx to >> track the current font (including inheritance from parent insets and >> styles), and we have no infrastructure either to read layout files and >> know the pass_thru flag for each layout. Therefore I kept the old logic >> mostly in LyX (except for IPA, since this is easily done in lyx2lyx), but >> encapsulated it into two new specialchar kinds. The export is not changed >> by the patch for any format. > > This looks very intriguing, but I do not understand what the magic is > with the special inset. What sense does it make?
Without the special inset, lyx2lyx would have to decide whether to keep consecutive hyphens or to convert them to endash/emdash. To keep the output unchanged, this decision needs to know the following: - The pass_thru flag of the active layout (taking CopyStyle into account, otherwise it ould be quite easy) - Whether the font family at the current position is typewriter (this needs to resolve all implicit inheritance from layouts and insets as well as explicit font family changes) - Whether a direct or indirect parent inset is an IPA inset. Only the last item can be easily implemented in lyx2lyx (and I did it). For the first two we are missing some infrastructure. Therefore I came up with the special inset which encapsulates all the old special logic. In principle, this inset could also be replaced complete after reading the file in LyX (because LyX can gather all needed information). This would be more nice for the user, but I am not familiar enough with the reading code to decide how this could be implemented in a good way. BTW, in tex2lyx it is easy: Thanks to the Context class we know everything to decide whether endash or emdash needs to be created. > PS: removing special handling for LyX/TeX/etc would be a nice step too. Yes. I might even do that, but one step after the other. Georg