mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
Add NoCounter layout tag. When working on output of equation numbers, I
noticed that article, for example, still has a counter "chapter". This surprised me. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37193 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4b1777d2fa
commit
49436e4c2d
@ -107,6 +107,9 @@ import os, re, string, sys
|
||||
# Incremented to format 30, 13 August 2010 by rgh
|
||||
# Introduced ResetsFont tag for InsetLayout.
|
||||
|
||||
# Incremented to format 31, 12 January 2011 by rgh
|
||||
# Introducted NoCounter tag.
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -114,7 +117,7 @@ import os, re, string, sys
|
||||
# development/tools/updatelayouts.sh script to update all
|
||||
# layout files to the new format.
|
||||
|
||||
currentFormat = 30
|
||||
currentFormat = 31
|
||||
|
||||
|
||||
def usage(prog_name):
|
||||
@ -290,7 +293,7 @@ def convert(lines):
|
||||
continue
|
||||
|
||||
# Only new features
|
||||
if format == 29:
|
||||
if format == 29 or format == 30:
|
||||
i += 1
|
||||
continue
|
||||
|
||||
|
@ -294,6 +294,12 @@ void Counters::reset(docstring const & match)
|
||||
}
|
||||
|
||||
|
||||
bool Counters::remove(docstring const & cnt)
|
||||
{
|
||||
return counterList_.erase(cnt);
|
||||
}
|
||||
|
||||
|
||||
void Counters::copy(Counters & from, Counters & to, docstring const & match)
|
||||
{
|
||||
CounterList::iterator it = counterList_.begin();
|
||||
|
@ -132,6 +132,8 @@ public:
|
||||
void reset();
|
||||
/// Reset counters matched by match string.
|
||||
void reset(docstring const & match);
|
||||
/// Remove counter \p cnt.
|
||||
bool remove(docstring const & cnt);
|
||||
/// Copy counters whose name matches match from the &from to
|
||||
/// the &to array of counters. Empty string matches all.
|
||||
void copy(Counters & from, Counters & to,
|
||||
|
@ -60,7 +60,7 @@ namespace lyx {
|
||||
// development/updatelayouts.sh script, to update the format of
|
||||
// all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 30;
|
||||
int const LAYOUT_FORMAT = 31;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -196,6 +196,7 @@ enum TextClassTags {
|
||||
TC_RIGHTMARGIN,
|
||||
TC_FLOAT,
|
||||
TC_COUNTER,
|
||||
TC_NOCOUNTER,
|
||||
TC_IFCOUNTER,
|
||||
TC_NOFLOAT,
|
||||
TC_TITLELATEXNAME,
|
||||
@ -233,6 +234,7 @@ namespace {
|
||||
{ "input", TC_INPUT },
|
||||
{ "insetlayout", TC_INSETLAYOUT },
|
||||
{ "leftmargin", TC_LEFTMARGIN },
|
||||
{ "nocounter", TC_NOCOUNTER },
|
||||
{ "nofloat", TC_NOFLOAT },
|
||||
{ "nostyle", TC_NOSTYLE },
|
||||
{ "outputformat", TC_OUTPUTFORMAT },
|
||||
@ -652,6 +654,14 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
|
||||
readCiteFormat(lexrc);
|
||||
break;
|
||||
|
||||
case TC_NOCOUNTER:
|
||||
if (lexrc.next()) {
|
||||
docstring const cnt = lexrc.getDocString();
|
||||
if (!counters_.remove(cnt))
|
||||
LYXERR0("Unable to remove counter: " + to_utf8(cnt));
|
||||
}
|
||||
break;
|
||||
|
||||
case TC_IFCOUNTER:
|
||||
ifcounter = true;
|
||||
case TC_COUNTER:
|
||||
|
Loading…
Reference in New Issue
Block a user