The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 394e559ffc16554288486763374722613cd39326
Author: Richard Heck <[email protected]>
Date:   Sat Jul 21 14:18:52 2012 -0400

    Add a FIXME about when the appendix should be enabled.

diff --git a/src/Text3.cpp b/src/Text3.cpp
index e17e965..0f429b2 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -2282,6 +2282,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & 
cmd,
                break;
 
        case LFUN_APPENDIX:
+               // FIXME We really should not allow this to be put, e.g.,
+               // in a footnote, or in ERT. But it would make sense in a 
+               // branch, so I'm not sure what to do.
                flag.setOnOff(cur.paragraph().params().startOfAppendix());
                break;
 

commit 894569e601ea1e0acb1adf92a0f168c10d6577dc
Author: Richard Heck <[email protected]>
Date:   Sat Jul 21 14:14:12 2012 -0400

    Fix a long-standing FIXME by resetting only the counter for top-level
    sectioning when we see an appendix. This fixes bug #8271, whose root
    cause was the fact that we were resetting all the counters inside ERT.

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 28bca5b..cb856b0 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -4301,9 +4301,11 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType 
utype) const
        Counters & counters = textclass.counters();
 
        if (par.params().startOfAppendix()) {
-               // FIXME: only the counter corresponding to toplevel
-               // sectioning should be reset
-               counters.reset();
+               // We want to reset the counter corresponding to toplevel 
sectioning
+               Layout const & lay = textclass.getTOCLayout();
+               docstring const cnt = lay.counter;
+               if (!cnt.empty())
+                       counters.reset(cnt);
                counters.appendix(true);
        }
        par.params().appendix(counters.appendix());
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 17e4f09..b352ca2 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -1507,27 +1507,32 @@ bool DocumentClass::hasTocLevels() const
 }
 
 
+Layout const & DocumentClass::getTOCLayout() const
+{
+       // we're going to look for the layout with the minimum toclevel
+       TextClass::LayoutList::const_iterator lit = begin();
+       TextClass::LayoutList::const_iterator const len = end();
+       int minlevel = 1000;
+       Layout const * lay = NULL;
+       for (; lit != len; ++lit) {
+               int const level = lit->toclevel;
+               // we don't want Part
+               if (level == Layout::NOT_IN_TOC || level < 0 || level >= 
minlevel)
+                       continue;
+               lay = &*lit;
+               minlevel = level;
+       }
+       if (lay)
+               return *lay;
+       // hmm. that is very odd, so we'll do our best.
+       return operator[](defaultLayoutName());
+}
+
+
 Layout const & DocumentClass::htmlTOCLayout() const
 {
        if (html_toc_section_.empty()) {
-               // we're going to look for the layout with the minimum toclevel
-               TextClass::LayoutList::const_iterator lit = begin();
-               TextClass::LayoutList::const_iterator const len = end();
-               int minlevel = 1000;
-               Layout const * lay = NULL;
-               for (; lit != len; ++lit) {
-                       int const level = lit->toclevel;
-                       // we don't want Part
-                       if (level == Layout::NOT_IN_TOC || level < 0 || level 
>= minlevel)
-                               continue;
-                       lay = &*lit;
-                       minlevel = level;
-               }
-               if (lay)
-                       html_toc_section_ = lay->name();
-               else
-                       // hmm. that is very odd, so we'll do our best
-                       html_toc_section_ = defaultLayoutName();
+               html_toc_section_ = getTOCLayout().name();
        }
        return operator[](html_toc_section_);
 }
diff --git a/src/TextClass.h b/src/TextClass.h
index fd80113..1bf35f6 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -419,6 +419,8 @@ public:
        docstring const & htmlpreamble() const { return htmlpreamble_; }
        ///
        docstring const & htmlstyles() const { return htmlstyles_; }
+       ///
+       Layout const & getTOCLayout() const;
        /// the paragraph style to use for TOCs, Bibliography, etc
        /// we will attempt to calculate this if it was not given
        Layout const & htmlTOCLayout() const;
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index d039544..3653c5e 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -967,11 +967,15 @@ void xhtmlParagraphs(Text const & text,
        while (bpit < epit) {
                ParagraphList::const_iterator par = 
paragraphs.constIterator(bpit);
                if (par->params().startOfAppendix()) {
-                       // FIXME: only the counter corresponding to toplevel
-                       // sectioning should be reset
-                       Counters & cnts = 
buf.masterBuffer()->params().documentClass().counters();
-                       cnts.reset();
-                       cnts.appendix(true);
+                       // We want to reset the counter corresponding to 
toplevel sectioning
+                       Layout const & lay =
+                               
buf.masterBuffer()->params().documentClass().getTOCLayout();
+                       docstring const cnt = lay.counter;
+                       if (!cnt.empty()) {
+                               Counters const & cnts =
+                                       
buf.masterBuffer()->params().documentClass().counters();
+                               cnts.reset(cnt);
+                       }
                }
                Layout const & style = par->layout();
                ParagraphList::const_iterator const lastpar = par;

-----------------------------------------------------------------------

Summary of changes:
 src/Buffer.cpp       |    8 +++++---
 src/Text3.cpp        |    3 +++
 src/TextClass.cpp    |   41 +++++++++++++++++++++++------------------
 src/TextClass.h      |    2 ++
 src/output_xhtml.cpp |   14 +++++++++-----
 5 files changed, 42 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to