mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Fix bug #7080.
- Have InsetFlex::layoutName() report "Flex:" + the inset name. - Do some layout2layout work so that user insets that do not have the "Flex:" prefix get it. Note that this will break some CopyStyle stuff, but we do not have any decent way to do that, so users will have to make that change for themselves. I guess we should add that to the release notes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dc18fcea6f
commit
ebe6c9287f
@ -119,6 +119,9 @@ import os, re, string, sys
|
||||
# Incremented to format 34, 28 March 2011 by rgh
|
||||
# Remove obsolete Fill_(Top|Bottom) tags
|
||||
|
||||
# Incremented to format 35, 28 March 2011 by rgh
|
||||
# Try to add "Flex:" to any flex insets that don't have it.
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -126,7 +129,7 @@ import os, re, string, sys
|
||||
# development/tools/updatelayouts.sh script to update all
|
||||
# layout files to the new format.
|
||||
|
||||
currentFormat = 34
|
||||
currentFormat = 35
|
||||
|
||||
|
||||
def usage(prog_name):
|
||||
@ -217,6 +220,10 @@ def convert(lines):
|
||||
re_QInsetLayout_CopyStyle = re.compile(r'^\s*CopyStyle\s+"(?:Custom|CharStyle|Element):([^"]+)"\s*$', re.IGNORECASE)
|
||||
re_NeedsFloatPkg = re.compile(r'^(\s*)NeedsFloatPkg\s+(\w+)\s*$', re.IGNORECASE)
|
||||
re_Fill = re.compile(r'^\s*Fill_(?:Top|Bottom).*$', re.IGNORECASE)
|
||||
re_InsetLayout2 = re.compile(r'^\s*InsetLayout\s+(\S+)\s*$', re.IGNORECASE)
|
||||
# with quotes
|
||||
re_QInsetLayout2 = re.compile(r'^\s*InsetLayout\s+"([^"]+)"\s*$', re.IGNORECASE)
|
||||
re_IsFlex = re.compile(r'\s*LyXType.*$', re.IGNORECASE)
|
||||
|
||||
# counters for sectioning styles (hardcoded in 1.3)
|
||||
counters = {"part" : "\\Roman{part}",
|
||||
@ -305,6 +312,33 @@ def convert(lines):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format == 34:
|
||||
match = re_InsetLayout2.match(lines[i])
|
||||
if not match:
|
||||
match = re_QInsetLayout2.match(lines[i])
|
||||
if not match:
|
||||
i += 1
|
||||
continue
|
||||
name = match.group(1)
|
||||
names = name.split(":", 1)
|
||||
if len(names) > 1 and names[0] == "Flex":
|
||||
i += 1
|
||||
continue
|
||||
|
||||
isflex = False
|
||||
for j in range(i + 1, len(lines)):
|
||||
if re_IsFlex.match(lines[j]):
|
||||
isflex = True
|
||||
break
|
||||
if re_End.match(lines[j]):
|
||||
break
|
||||
|
||||
if isflex:
|
||||
lines[i] = "InsetLayout \"Flex:" + name + "\""
|
||||
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format == 33:
|
||||
m = re_Fill.match(lines[i])
|
||||
if m:
|
||||
|
@ -60,7 +60,7 @@ namespace lyx {
|
||||
// development/updatelayouts.sh script, to update the format of
|
||||
// all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 34;
|
||||
int const LAYOUT_FORMAT = 35;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
InsetFlex(Buffer *, std::string const & layoutName);
|
||||
///
|
||||
docstring layoutName() const { return from_utf8(name_); }
|
||||
docstring layoutName() const { return from_utf8("Flex:" + name_); }
|
||||
///
|
||||
InsetLayout const & getLayout() const;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user