Andre Poenitz wrote:
On Wed, Oct 03, 2007 at 02:10:09PM +0200, Jean-Marc Lasgouttes wrote:
We define an "attribute precedence" order. Then, we use the following
rules (to be applied when moving from the GUI to non-overlapping
markup) to make sure that at any given position, the
highest-precedence active range is also the outermost one:
I think we should use some algorithm that discovers nesting from
ranges. It cannot be so difficult. The only problem is when ranges
have exactly the same begin and end ranges, in which case some
precedence helps.
Either we do insets properly, or we do ranges properly. When we do
ranges properly there should be no guessing about a possible nesting
as this might go wrong.
So this mean we can't use
<par>....<emph>....<strong>....</emph>.....</strong>.....</par>
as external format, and we should not try to
Rather we'd need to store that as something like
<par>
<data>................</data>
<range>
<from>...</from>
<to>...</to>
<type>emph</emph>
</range>
<range>
<from>...</from>
<to>...</to>
<type>strong</emph>
</range>
</par>
Hmm, yes, this does describe the structure that I'm thinking of, I think
that it's the right approach.
There is however one main problem with this that I can think of: it
makes it harder to understand the .lyx file; even worse, if anyone tries
to edit the .lyx file directly, it would be disastrous, the ranges could
suddenly point to the wrong things, or to nowhere...
Since it's XML, it wouldn't be hard to translate from this format to a
more linear, inline-charstyle, form, we could even provide such a tool,
but I'm not sure that's good enough. For that reason, it may still be
better to store the .lyx file with inline charstyles, and for us to do
the translation back and forth when loading/saving the .lyx file.
But again, yes, I like the structure you present and I think that's the
way we should be working internally, at least.
As far as overlapping (not nested) ranges are concerned, there is no
good solution (and they are quite rare and weird) so any solution that
produces valid LaTeX is OK.
For the external format see above, for LaTeX it is more or less one-way
only anyway.
Andre'