Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75539 - in branches/quickbook-dev/tools/quickbook: src test/include
From: dnljms_at_[hidden]
Date: 2011-11-17 16:07:17


Author: danieljames
Date: 2011-11-17 16:07:16 EST (Thu, 17 Nov 2011)
New Revision: 75539
URL: http://svn.boost.org/trac/boost/changeset/75539

Log:
Quickbook: Prevent 'endsect' from ending an include id.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/id_manager.cpp | 44 ++++++++++++++++++++++++++++++++++++---
   branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-1_6.gold | 13 +++++------
   2 files changed, 46 insertions(+), 11 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/id_manager.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_manager.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/id_manager.cpp 2011-11-17 16:07:16 EST (Thu, 17 Nov 2011)
@@ -164,9 +164,9 @@
                 std::string const& id,
                 id_category category);
         void end_section();
-
- // Used to change section for the duration of a file.
- // (or until 'endsect').
+ boost::intrusive_ptr<section_info> end_section(
+ boost::intrusive_ptr<file_info> const& file,
+ boost::intrusive_ptr<section_info> const& section);
 
         void switch_section(boost::intrusive_ptr<section_info> const&);
         void restore_section();
@@ -605,9 +605,45 @@
     void id_state::end_section()
     {
         current_file->document->current_section =
- current_file->document->current_section->parent;
+ end_section(current_file, current_file->document->current_section);
+
+ }
+
+ boost::intrusive_ptr<section_info> id_state::end_section(
+ boost::intrusive_ptr<file_info> const& file,
+ boost::intrusive_ptr<section_info> const& section)
+ {
+ if (file->switched_section == section) {
+ if (!file->document_root) {
+ file->original_section = end_section(
+ file->parent, file->original_section);
+ }
+ else {
+ file->original_section =
+ file->original_section->parent;
+ }
+
+ boost::intrusive_ptr<section_info> alt_section =
+ new section_info(
+ file->original_section->parent,
+ file->original_section->compatibility_version,
+ file->switched_section->placeholder_1_6->id);
+
+ alt_section->placeholder_1_6 =
+ file->switched_section->placeholder_1_6;
+
+ file->switched_section = alt_section;
+ return alt_section;
+ }
+ else {
+ if (!file->switched_section && !file->document_root)
+ return end_section(current_file->parent, section);
+ else
+ return section->parent;
+ }
     }
 
+
     //
     // Xml subset parser used for finding id values.
     //

Modified: branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-1_6.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-1_6.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-1_6.gold 2011-11-17 16:07:16 EST (Thu, 17 Nov 2011)
@@ -43,18 +43,17 @@
         <phrase id="include2.inc2_1"/><link linkend="include2.inc2_1">Heading 1</link>
       </bridgehead>
     </section>
- <bridgehead renderas="sect3" id="unbalanced.sect1.h1">
- <phrase id="unbalanced.sect1.inc2_2"/><link linkend="unbalanced.sect1.inc2_2">Heading
- 2</link>
+ <bridgehead renderas="sect3" id="include2.h1">
+ <phrase id="include2.inc2_2"/><link linkend="include2.inc2_2">Heading 2</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="include2a.h0">
       <phrase id="include2a.inc2a_1"/><link linkend="include2a.inc2a_1">Heading 1</link>
     </bridgehead>
   </section>
- <bridgehead renderas="sect2" id="unbalanced.h0">
- <phrase id="unbalanced.inc2a_2"/><link linkend="unbalanced.inc2a_2">Heading 2</link>
+ <bridgehead renderas="sect2" id="include2a.h1">
+ <phrase id="include2a.inc2a_2"/><link linkend="include2a.inc2a_2">Heading 2</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="unbalanced.h1">
- <phrase id="unbalanced.inc2_3"/><link linkend="unbalanced.inc2_3">Heading 3</link>
+ <bridgehead renderas="sect2" id="include2.h2">
+ <phrase id="include2.inc2_3"/><link linkend="include2.inc2_3">Heading 3</link>
   </bridgehead>
 </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