Angus Leeming wrote:

> Juergen Spitzmueller wrote:
>> Yes. Would one of the two nice lyx2lyx persons be so kind? Two
>> conversions have to be done
>> \InsetSpace \space --> \InsetSpace \space{}
>> \insetSpace \, --> InsetSpace \thinspace{}

I am not kind today (read: short on time), so I'll give you a recipe to do
it yourself (it is really easy).

(...reading lyx_1_4.py to find the earlier conversion...)

You did add InsetSpace with new space types without lyx2lyx conversion.
Shame on you! ;-)

What needs to be done:

1. fix revert_spaces() so that it converts other spaces than ~ to ERT.
Something like (untested)

def revert_spaces(file)
    regexp = re.compile(r'(\\InsetSpace\s+)(\S+)')
    i = 0
    while 1:
        i = find_re(file.body, regexp, i)
        if i == -1:
            break
        space = regexp.match(file.body[i]).group(2)
        if space == ~:
            file.body[i] = regexp.sub('\\SpecialChar ~', file.body[i])
            i = i + 1
        else:
            file.body[i] = regexp.sub('', file.body[i])
            file.body[i+1:i+1] = ''
            i = insert_ert(file.body, i+1, 'Collapsed', space', file.format
- 1)

2. Convert \, --> \thinspace from 243 --> 244. You can use the existing
revert_spaces() as an example
3. Convert '\InsetSpace \thinspace' to ERT from 244 --> 243. The code can be
very similar to the above.

Implementing this is left as an exercise for the reader :-)

> Whoa! Whilst that is consistent, I'd like to remind you that LyX has
> aspirations to be more than just a LaTeX frontend. IMO we should output
> the semantics, not the LaTeX code:
> 
> \InsetSpace \space --> \InsetSpace space
> \insetSpace \, --> InsetSpace thinspace

I'd prefer that too, but since we are going to xml after 1.4.x and in freeze
now I think that we should not put too much time in polishing the current
format.


Georg

Reply via email to