Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75245 - in branches/quickbook-dev/tools/quickbook: src test/include
From: dnljms_at_[hidden]
Date: 2011-11-02 03:43:04


Author: danieljames
Date: 2011-11-02 03:43:03 EDT (Wed, 02 Nov 2011)
New Revision: 75245
URL: http://svn.boost.org/trac/boost/changeset/75245

Log:
Quickbook: Reset section info for nested documents.

So when including a document inside a section, the section's id is not
used. Also cleans up the messy handling of section.min_leveln.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/actions_class.cpp | 2 -
   branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 3 -
   branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 4 +-
   branches/quickbook-dev/tools/quickbook/src/quickbook.cpp | 7 ++++
   branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold | 66 +++++++++++++++++++--------------------
   5 files changed, 41 insertions(+), 41 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.cpp 2011-11-02 03:43:03 EDT (Wed, 02 Nov 2011)
@@ -103,7 +103,6 @@
         , filename_relative(a.filename_relative)
         , source_mode(a.source_mode)
         , macro()
- , min_level(a.section.min_level)
     {
         if (scope & scope_macros) macro = a.macro;
         if (scope & scope_templates) a.templates.push();
@@ -130,7 +129,6 @@
         }
         if (scope & scope_templates) a.templates.pop();
         if (scope & scope_macros) a.macro = macro;
- boost::swap(a.section.min_level, min_level);
     }
     
     template_state::template_state(actions& a)

Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.hpp 2011-11-02 03:43:03 EDT (Wed, 02 Nov 2011)
@@ -144,9 +144,6 @@
         fs::path filename_relative;
         std::string source_mode;
         string_symbols macro;
- // Currently saving this twice for templates...
- // Will fix that soon.
- int min_level;
     private:
         file_state(file_state const&);
         file_state& operator=(file_state const&);

Modified: branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp 2011-11-02 03:43:03 EDT (Wed, 02 Nov 2011)
@@ -465,12 +465,12 @@
         assert(!actions.doc_type.empty());
 
         // Close any open sections.
- if (actions.section.level > actions.section.min_level) {
+ if (actions.section.level > 0) {
             detail::outwarn(actions.filename)
                 << "Missing [endsect] detected at end of file."
                 << std::endl;
 
- while(actions.section.level > actions.section.min_level) {
+ while(actions.section.level > 0) {
                 out << "</section>";
                 --actions.section.level;
             }

Modified: branches/quickbook-dev/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/quickbook.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/quickbook.cpp 2011-11-02 03:43:03 EDT (Wed, 02 Nov 2011)
@@ -98,6 +98,10 @@
         
         if (!info.hit) actor.source_mode = saved_source_mode;
 
+ section_info saved_section;
+ if (docinfo_type == docinfo_nested)
+ boost::swap(saved_section, actor.section);
+
         if (info.hit || !docinfo_type)
         {
             pre(actor.out, actor, include_doc_id, docinfo_type);
@@ -109,6 +113,9 @@
             }
         }
 
+ if (docinfo_type == docinfo_nested)
+ boost::swap(saved_section, actor.section);
+
         if (!info.full)
         {
             file_position const& pos = info.stop.get_position();

Modified: branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold 2011-11-02 03:43:03 EDT (Wed, 02 Nov 2011)
@@ -8,27 +8,26 @@
     <article id="include_in_section_include_1" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
     xmlns:xi="http://www.w3.org/2001/XInclude">
       <title>Include in section include 1</title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.container.h0">
- <phrase id="include_in_section_include_1.container.test1"/><link linkend="include_in_section_include_1.container.test1">Test1</link>
+ <bridgehead renderas="sect1" id="include_in_section_include_1.h0">
+ <phrase id="include_in_section_include_1.test1"/><link linkend="include_in_section_include_1.test1">Test1</link>
       </bridgehead>
- <section id="include_in_section_include_1.container.inner">
- <title><link linkend="include_in_section_include_1.container.inner"></link></title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.container.inner.h0">
- <phrase id="include_in_section_include_1.container.inner.test2"/><link
- linkend="include_in_section_include_1.container.inner.test2">Test2</link>
+ <section id="include_in_section_include_1.inner">
+ <title><link linkend="include_in_section_include_1.inner"></link></title>
+ <bridgehead renderas="sect1" id="include_in_section_include_1.inner.h0">
+ <phrase id="include_in_section_include_1.inner.test2"/><link linkend="include_in_section_include_1.inner.test2">Test2</link>
         </bridgehead>
       </section>
     </article>
     <article id="section_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
     xmlns:xi="http://www.w3.org/2001/XInclude">
       <title>Include in section include 2</title>
- <bridgehead renderas="sect1" id="section_include.container.h0">
- <phrase id="section_include.container.test1"/><link linkend="section_include.container.test1">Test1</link>
+ <bridgehead renderas="sect1" id="section_include.h0">
+ <phrase id="section_include.test1"/><link linkend="section_include.test1">Test1</link>
       </bridgehead>
- <section id="section_include.container.inner">
- <title><link linkend="section_include.container.inner"></link></title>
- <bridgehead renderas="sect1" id="section_include.container.inner.h0">
- <phrase id="section_include.container.inner.test2"/><link linkend="section_include.container.inner.test2">Test2</link>
+ <section id="section_include.inner">
+ <title><link linkend="section_include.inner"></link></title>
+ <bridgehead renderas="sect1" id="section_include.inner.h0">
+ <phrase id="section_include.inner.test2"/><link linkend="section_include.inner.test2">Test2</link>
         </bridgehead>
       </section>
     </article>
@@ -36,26 +35,26 @@
   <article id="include_in_section_include_1_0" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
   xmlns:xi="http://www.w3.org/2001/XInclude">
     <title>Include in section include 1</title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.h0">
- <phrase id="include_in_section_include_1.test1"/><link linkend="include_in_section_include_1.test1">Test1</link>
+ <bridgehead renderas="sect1" id="include_in_section_include_1.h1">
+ <phrase id="include_in_section_include_1.test1_0"/><link linkend="include_in_section_include_1.test1_0">Test1</link>
     </bridgehead>
     <section id="include_in_section_include_1.inner">
       <title><link linkend="include_in_section_include_1.inner"></link></title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.inner.h0">
- <phrase id="include_in_section_include_1.inner.test2"/><link linkend="include_in_section_include_1.inner.test2">Test2</link>
+ <bridgehead renderas="sect1" id="include_in_section_include_1.inner.h1">
+ <phrase id="include_in_section_include_1.inner.test2_0"/><link linkend="include_in_section_include_1.inner.test2_0">Test2</link>
       </bridgehead>
     </section>
   </article>
   <article id="section_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
   xmlns:xi="http://www.w3.org/2001/XInclude">
     <title>Include in section include 2</title>
- <bridgehead renderas="sect1" id="section_include.h0">
- <phrase id="section_include.test1"/><link linkend="section_include.test1">Test1</link>
+ <bridgehead renderas="sect1" id="section_include.h1">
+ <phrase id="section_include.test1_0"/><link linkend="section_include.test1_0">Test1</link>
     </bridgehead>
     <section id="section_include.inner">
       <title><link linkend="section_include.inner"></link></title>
- <bridgehead renderas="sect1" id="section_include.inner.h0">
- <phrase id="section_include.inner.test2"/><link linkend="section_include.inner.test2">Test2</link>
+ <bridgehead renderas="sect1" id="section_include.inner.h1">
+ <phrase id="section_include.inner.test2_0"/><link linkend="section_include.inner.test2_0">Test2</link>
       </bridgehead>
     </section>
   </article>
@@ -64,27 +63,26 @@
     <article id="include_in_section_include_1_1" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
     xmlns:xi="http://www.w3.org/2001/XInclude">
       <title>Include in section include 1</title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.container2.h0">
- <phrase id="include_in_section_include_1.container2.test1"/><link linkend="include_in_section_include_1.container2.test1">Test1</link>
+ <bridgehead renderas="sect1" id="include_in_section_include_1.h2">
+ <phrase id="include_in_section_include_1.test1_1"/><link linkend="include_in_section_include_1.test1_1">Test1</link>
       </bridgehead>
- <section id="include_in_section_include_1.container2.inner">
- <title><link linkend="include_in_section_include_1.container2.inner"></link></title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.container2.inner.h0">
- <phrase id="include_in_section_include_1.container2.inner.test2"/><link
- linkend="include_in_section_include_1.container2.inner.test2">Test2</link>
+ <section id="include_in_section_include_1.inner">
+ <title><link linkend="include_in_section_include_1.inner"></link></title>
+ <bridgehead renderas="sect1" id="include_in_section_include_1.inner.h2">
+ <phrase id="include_in_section_include_1.inner.test2_1"/><link linkend="include_in_section_include_1.inner.test2_1">Test2</link>
         </bridgehead>
       </section>
     </article>
     <article id="section_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
     xmlns:xi="http://www.w3.org/2001/XInclude">
       <title>Include in section include 2</title>
- <bridgehead renderas="sect1" id="section_include.container2.h0">
- <phrase id="section_include.container2.test1"/><link linkend="section_include.container2.test1">Test1</link>
+ <bridgehead renderas="sect1" id="section_include.h2">
+ <phrase id="section_include.test1_1"/><link linkend="section_include.test1_1">Test1</link>
       </bridgehead>
- <section id="section_include.container2.inner">
- <title><link linkend="section_include.container2.inner"></link></title>
- <bridgehead renderas="sect1" id="section_include.container2.inner.h0">
- <phrase id="section_include.container2.inner.test2"/><link linkend="section_include.container2.inner.test2">Test2</link>
+ <section id="section_include.inner">
+ <title><link linkend="section_include.inner"></link></title>
+ <bridgehead renderas="sect1" id="section_include.inner.h2">
+ <phrase id="section_include.inner.test2_1"/><link linkend="section_include.inner.test2_1">Test2</link>
         </bridgehead>
       </section>
     </article>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk