From 96dfc081b7cba9eb30ecf438ba007921092c67b3 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Thu, 27 Jul 2023 21:20:53 -0400 Subject: [PATCH] Fix bug #11822. Allow counter formatting strings in PrettyFormat. Patch from Daniel. --- lib/scripts/layout2layout.py | 7 +++++-- src/Counters.cpp | 2 +- src/TextClass.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index c77b05e100..7d3cca7be8 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -11,7 +11,7 @@ # This script will update a .layout file to current format # The latest layout format is also defined in src/TextClass.cpp -currentFormat = 102 +currentFormat = 103 # Incremented to format 4, 6 April 2007, lasgouttes @@ -345,6 +345,9 @@ currentFormat = 102 # AllowedInLayouts, EndAllowedInLayouts, AllowedOccurrences, # AllowedOccurrencesPerItem +# Incremented to format 103, 27 July 2023 by rikiheck +# Allow e.g. \roman{section} in PrettyFormat + # Do not forget to document format change in Customization # Manual (section "Declaring a new text class"). @@ -592,7 +595,7 @@ def convert(lines, end_format): i += 1 continue - if format == 101: + if 101 <= format <= 102: # nothing to do. i += 1 continue diff --git a/src/Counters.cpp b/src/Counters.cpp index 8f2c60e461..1a9c6af637 100644 --- a/src/Counters.cpp +++ b/src/Counters.cpp @@ -611,7 +611,7 @@ docstring Counters::prettyCounter(docstring const & name, docstring const value = theCounter(name, lang); docstring const & format = - translateIfPossible(ctr.prettyFormat(), lang); + translateIfPossible(counterLabel(ctr.prettyFormat(), lang), lang); if (format.empty()) return value; return subst(format, from_ascii("##"), value); diff --git a/src/TextClass.cpp b/src/TextClass.cpp index b6a7887ed8..a9688d3b13 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -59,7 +59,7 @@ namespace lyx { // You should also run the development/tools/updatelayouts.py script, // to update the format of all of our layout files. // -int const LAYOUT_FORMAT = 102; // spitz: add tags AllowedInInsets, AllowedInLayouts, AllowedOccurrences +int const LAYOUT_FORMAT = 103; // rkh: allow counter specs in PrettyFormat // Layout format for the current lyx file format. Controls which format is