]> git.lyx.org Git - features.git/commitdiff
Fix output of formatted counters.
authorRichard Heck <rgheck@comcast.net>
Wed, 20 Jan 2010 22:28:42 +0000 (22:28 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 20 Jan 2010 22:28:42 +0000 (22:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33122 a592a061-630c-0410-9148-cb99ea01b6c8

lib/layouts/stdcounters.inc
src/Counters.cpp

index d6e43bed3c19170c97885694c155c25fd5aad104..a31b3525be612d031e052cef20ba36b1cb46afe9 100644 (file)
@@ -11,32 +11,32 @@ Counter part
 End
 
 Counter chapter
-       PrettyFormat         "Chapter \arabic{chapter}"
+       PrettyFormat         "Chapter ##"
 End
 
 Counter section
        Within               chapter
-       PrettyFormat         "Section \arabic{section}"
+       PrettyFormat         "Section ##"
 End
 
 Counter subsection
        Within               section
-       PrettyFormat         "Section \arabic{subsection}"
+       PrettyFormat         "Section ##"
 End
 
 Counter subsubsection
        Within               subsection
-       PrettyFormat         "Section \arabic{subsubsection}"
+       PrettyFormat         "Section ##"
 End
 
 Counter paragraph
        Within               subsubsection
-       PrettyFormat         "Paragraph \arabic{paragraph}"
+       PrettyFormat         "Paragraph ##"
 End
 
 Counter subparagraph
        Within               paragraph
-       PrettyFormat         "Paragraph \arabic{subparagraph}"
+       PrettyFormat         "Paragraph ##"
 End
 
 Counter enumi
@@ -65,9 +65,9 @@ Counter listing
 End
 
 Counter equation
-       PrettyFormat         "Equation \arabic{equation}"
+       PrettyFormat         "Equation ##"
 End
 
 Counter footnote
-       PrettyFormat         "Footnote \arabic{footnote}"
+       PrettyFormat         "Footnote ##"
 End
index c8e82ca39350832861d6c858be68629d26cdcf1f..d6865d107d99dd6954b1e4a3d697c7449a2f8acd 100644 (file)
@@ -545,21 +545,19 @@ docstring Counters::counterLabel(docstring const & format,
 }
 
 
-docstring Counters::prettyCounter(docstring const & counter,
+docstring Counters::prettyCounter(docstring const & name,
                               string const & lang) const
 {
-       CounterList::const_iterator it = counterList_.find(counter); 
+       CounterList::const_iterator it = counterList_.find(name); 
        if (it == counterList_.end())
                return from_ascii("??");
        Counter const & ctr = it->second;
+
+       docstring const value = theCounter(name, lang);
        docstring const & format = ctr.prettyFormat();
-       // FIXME We need to "flatten" the format to get proper output, 
-       // but doing so will take a bit of work.
-       if (true || format.empty()) {
-               docstring cntrname = translateIfPossible(counter, lang);
-               return  cntrname + " " + theCounter(counter, lang);
-       }
-       return counterLabel(format, lang);
+       if (format.empty())
+               return value;
+       return subst(format, from_ascii("##"), value);
 }