Fix output of formatted counters.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33122 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-01-20 22:28:42 +00:00
parent 0568e46eea
commit aff3907ec6
2 changed files with 15 additions and 17 deletions

View File

@ -11,32 +11,32 @@ Counter part
End End
Counter chapter Counter chapter
PrettyFormat "Chapter \arabic{chapter}" PrettyFormat "Chapter ##"
End End
Counter section Counter section
Within chapter Within chapter
PrettyFormat "Section \arabic{section}" PrettyFormat "Section ##"
End End
Counter subsection Counter subsection
Within section Within section
PrettyFormat "Section \arabic{subsection}" PrettyFormat "Section ##"
End End
Counter subsubsection Counter subsubsection
Within subsection Within subsection
PrettyFormat "Section \arabic{subsubsection}" PrettyFormat "Section ##"
End End
Counter paragraph Counter paragraph
Within subsubsection Within subsubsection
PrettyFormat "Paragraph \arabic{paragraph}" PrettyFormat "Paragraph ##"
End End
Counter subparagraph Counter subparagraph
Within paragraph Within paragraph
PrettyFormat "Paragraph \arabic{subparagraph}" PrettyFormat "Paragraph ##"
End End
Counter enumi Counter enumi
@ -65,9 +65,9 @@ Counter listing
End End
Counter equation Counter equation
PrettyFormat "Equation \arabic{equation}" PrettyFormat "Equation ##"
End End
Counter footnote Counter footnote
PrettyFormat "Footnote \arabic{footnote}" PrettyFormat "Footnote ##"
End End

View 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 string const & lang) const
{ {
CounterList::const_iterator it = counterList_.find(counter); CounterList::const_iterator it = counterList_.find(name);
if (it == counterList_.end()) if (it == counterList_.end())
return from_ascii("??"); return from_ascii("??");
Counter const & ctr = it->second; Counter const & ctr = it->second;
docstring const value = theCounter(name, lang);
docstring const & format = ctr.prettyFormat(); docstring const & format = ctr.prettyFormat();
// FIXME We need to "flatten" the format to get proper output, if (format.empty())
// but doing so will take a bit of work. return value;
if (true || format.empty()) { return subst(format, from_ascii("##"), value);
docstring cntrname = translateIfPossible(counter, lang);
return cntrname + " " + theCounter(counter, lang);
}
return counterLabel(format, lang);
} }