Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75220 - in branches/quickbook-dev/tools/quickbook: src test test/include
From: dnljms_at_[hidden]
Date: 2011-11-01 14:59:09


Author: danieljames
Date: 2011-11-01 14:59:08 EDT (Tue, 01 Nov 2011)
New Revision: 75220
URL: http://svn.boost.org/trac/boost/changeset/75220

Log:
Quickbook: Close any open sections at end of document.
Added:
   branches/quickbook-dev/tools/quickbook/test/section_1_5-unclosed.gold (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/section_1_5-unclosed.quickbook (contents, props changed)
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 14 ++++++++++++++
   branches/quickbook-dev/tools/quickbook/src/quickbook.cpp | 7 -------
   branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 | 1 +
   branches/quickbook-dev/tools/quickbook/test/include/section-unclosed.gold | 4 ++--
   4 files changed, 17 insertions(+), 9 deletions(-)

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-01 14:59:08 EDT (Tue, 01 Nov 2011)
@@ -459,6 +459,20 @@
 
         assert(!actions.doc_type.empty());
 
+ // Close any open sections.
+ if (actions.section_level != 0) {
+ detail::outwarn(actions.filename)
+ << "Warning missing [endsect] detected at end of file."
+ << std::endl;
+
+ while(actions.section_level > 0) {
+ out << "</section>";
+ --actions.section_level;
+ }
+
+ actions.qualified_section_id.clear();
+ }
+
         // We've finished generating our output. Here's what we'll do
         // *after* everything else.
         out << "\n</" << actions.doc_type << ">\n\n";

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-01 14:59:08 EDT (Tue, 01 Nov 2011)
@@ -123,16 +123,9 @@
         fs::path const& filein_,
         actions& actor)
     {
-
         try {
             parse_file(filein_, actor);
 
- if (actor.section_level != 0) {
- detail::outwarn(filein_)
- << "Warning missing [endsect] detected at end of file."
- << std::endl;
- }
-
             if(actor.error_count) {
                 detail::outerr()
                     << "Error count: " << actor.error_count << ".\n";

Modified: branches/quickbook-dev/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 2011-11-01 14:59:08 EDT (Tue, 01 Nov 2011)
@@ -45,6 +45,7 @@
     [ quickbook-test include_1_6-2 ]
     [ quickbook-test section_1_4 ]
     [ quickbook-test section_1_5 ]
+ [ quickbook-test section_1_5-unclosed ]
     [ quickbook-test heading_1_1 ]
     [ quickbook-test heading_1_3 ]
     [ quickbook-test heading_1_5 ]

Modified: branches/quickbook-dev/tools/quickbook/test/include/section-unclosed.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/include/section-unclosed.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/include/section-unclosed.gold 2011-11-01 14:59:08 EDT (Tue, 01 Nov 2011)
@@ -6,5 +6,5 @@
   <section id="include_section_test.mulitple_file_section">
     <title><link linkend="include_section_test.mulitple_file_section">Mulitple file
     section</link></title>
- </article>
-
\ No newline at end of file
+ </section>
+</article>

Added: branches/quickbook-dev/tools/quickbook/test/section_1_5-unclosed.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/section_1_5-unclosed.gold 2011-11-01 14:59:08 EDT (Tue, 01 Nov 2011)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="unclosed_section" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Unclosed section</title>
+ <section id="unclosed_section.unclosed">
+ <title><link linkend="unclosed_section.unclosed">Unclosed Section should be closed
+ with a warning</link></title>
+ </section>
+</article>

Added: branches/quickbook-dev/tools/quickbook/test/section_1_5-unclosed.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/section_1_5-unclosed.quickbook 2011-11-01 14:59:08 EDT (Tue, 01 Nov 2011)
@@ -0,0 +1,5 @@
+[article Unclosed section
+[quickbook 1.5]
+]
+
+[section:unclosed Unclosed Section should be closed with a warning]
\ No newline at end of file


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