Discussion:
Double quotes in flex inset names
aparsloe
2014-04-23 00:20:51 UTC
Permalink
The Customisation manual (downloaded with LyX 2.1.0 an hour ago) says in
Section 5.3.9:

The layout for a Flex inset is being defined. In this case, |<Type>|
must be of the form "|Flex:<name>|", where |name| may be be any valid
identifier not used by a pre-existing Flex inset. The identifier may
include spaces, but in that case the whole thing must be wrapped in quotes.

In answering a query on the user's list I find that the double quotes
are necessary in LyX 2.1.0 irrespective of whether the name includes
spaces. (This wasn't the case in beta2 but seems to have arisen since
then.)LyX Document

Andrew
Richard Heck
2014-04-23 02:42:32 UTC
Permalink
Post by aparsloe
The Customisation manual (downloaded with LyX 2.1.0 an hour ago) says
The layout for a Flex inset is being defined. In this case, |<Type>|
must be of the form "|Flex:<name>|", where |name| may be be any valid
identifier not used by a pre-existing Flex inset. The identifier may
include spaces, but in that case the whole thing must be wrapped in quotes.
In answering a query on the user's list I find that the double quotes
are necessary in LyX 2.1.0 irrespective of whether the name includes
spaces. (This wasn't the case in beta2 but seems to have arisen since
then.) LyX Document
This is close to right, but the problem is in the conversion of layouts.
It's fine not to quote the names. Look at e.g. logicalmkup.module. Mone
of the InsetLayout names are quoted, yet they work fine. The problem is
that there is some buggy conversion code, and it seems to run only when
the name is not quoted.

Georg, this is the format 48 conversion code you introduced at 6b49b6b1.
In this case, we end up converting

InsetLayout Flex:ShortLabel
LyXType custom
LatexType command
LatexName shortLyXname
Decoration Classic
LabelFont
Color phantomtext
End
LabelString lab
Multipar 0
PassThru 0
End

to:

InsetLayout Flex:ShortLabel
LyXType custom
LatexType command
LatexName shortLyXname
Decoration Classic
LabelFont
Color phantomtext
ResetsFont true
End
LabelString lab
Multipar 0
PassThru 0
ResetsFont true
End

Note the extra ResetsFont in the LabelFont declaration. This is because
we find "End", but the wrong one.

Note also that this code does not allow for the possibility of a quoted
name. So the check:
if name == "flex" or name[:5] == "flex:":
isflexlayout = True
fails if the name is quoted. That's why quotes vs no quotes matters.

Richard
Richard Heck
2014-04-23 15:06:55 UTC
Permalink
Of coures I meant: layout2layout bug.
Post by Richard Heck
Post by aparsloe
The Customisation manual (downloaded with LyX 2.1.0 an hour ago) says
The layout for a Flex inset is being defined. In this case, |<Type>|
must be of the form "|Flex:<name>|", where |name| may be be any valid
identifier not used by a pre-existing Flex inset. The identifier may
include spaces, but in that case the whole thing must be wrapped in quotes.
In answering a query on the user's list I find that the double quotes
are necessary in LyX 2.1.0 irrespective of whether the name includes
spaces. (This wasn't the case in beta2 but seems to have arisen since
then.) LyX Document
This is close to right, but the problem is in the conversion of
layouts. It's fine not to quote the names. Look at e.g.
logicalmkup.module. Mone of the InsetLayout names are quoted, yet they
work fine. The problem is that there is some buggy conversion code,
and it seems to run only when the name is not quoted.
Georg, this is the format 48 conversion code you introduced at
6b49b6b1. In this case, we end up converting
InsetLayout Flex:ShortLabel
LyXType custom
LatexType command
LatexName shortLyXname
Decoration Classic
LabelFont
Color phantomtext
End
LabelString lab
Multipar 0
PassThru 0
End
InsetLayout Flex:ShortLabel
LyXType custom
LatexType command
LatexName shortLyXname
Decoration Classic
LabelFont
Color phantomtext
ResetsFont true
End
LabelString lab
Multipar 0
PassThru 0
ResetsFont true
End
Note the extra ResetsFont in the LabelFont declaration. This is
because we find "End", but the wrong one.
Note also that this code does not allow for the possibility of a
isflexlayout = True
fails if the name is quoted. That's why quotes vs no quotes matters.
Richard
Georg Baum
2014-04-24 18:47:16 UTC
Permalink
Post by Richard Heck
This is close to right, but the problem is in the conversion of layouts.
It's fine not to quote the names. Look at e.g. logicalmkup.module. Mone
of the InsetLayout names are quoted, yet they work fine. The problem is
that there is some buggy conversion code, and it seems to run only when
the name is not quoted.
Georg, this is the format 48 conversion code you introduced at 6b49b6b1.
In this case, we end up converting
I'll have a look (after I finihsed the lyx2lyx bug regarding math packages).


Georg
Richard Heck
2014-04-25 21:20:30 UTC
Permalink
Post by Georg Baum
Post by Richard Heck
This is close to right, but the problem is in the conversion of layouts.
It's fine not to quote the names. Look at e.g. logicalmkup.module. Mone
of the InsetLayout names are quoted, yet they work fine. The problem is
that there is some buggy conversion code, and it seems to run only when
the name is not quoted.
Georg, this is the format 48 conversion code you introduced at 6b49b6b1.
In this case, we end up converting
I'll have a look (after I finihsed the lyx2lyx bug regarding math packages).
I took care of this at 7e1541dd. The module on which it failed was
actually ill-formed, but there was the issue about quoted names, and I
simplified and sped up the code a bit.

Richard

Loading...