$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r59558 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-02-07 04:10:03
Author: danieljames
Date: 2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
New Revision: 59558
URL: http://svn.boost.org/trac/boost/changeset/59558
Log:
Separate out block output.
Added:
   branches/quickbook-1.5-spirit2/block_actions.hpp   (contents, props changed)
   branches/quickbook-1.5-spirit2/gen_types.hpp   (contents, props changed)
Removed:
   branches/quickbook-1.5-spirit2/markups.cpp
   branches/quickbook-1.5-spirit2/markups.hpp
Text files modified: 
   branches/quickbook-1.5-spirit2/Jamfile.v2           |     1                                         
   branches/quickbook-1.5-spirit2/block.cpp            |     1                                         
   branches/quickbook-1.5-spirit2/block_actions.cpp    |   196 ++++++++----------------------------    
   branches/quickbook-1.5-spirit2/block_list.cpp       |    70 +++++-------                            
   branches/quickbook-1.5-spirit2/boostbook.cpp        |   211 +++++++++++++++++++++++++++++++++++++++ 
   branches/quickbook-1.5-spirit2/boostbook.hpp        |    33 ++++++                                  
   branches/quickbook-1.5-spirit2/code_snippet.cpp     |     1                                         
   branches/quickbook-1.5-spirit2/phrase.cpp           |     1                                         
   branches/quickbook-1.5-spirit2/phrase_actions.cpp   |     1                                         
   branches/quickbook-1.5-spirit2/phrase_actions.hpp   |    17 +++                                     
   branches/quickbook-1.5-spirit2/phrase_image.cpp     |    44 -------                                 
   branches/quickbook-1.5-spirit2/process.cpp          |    18 ---                                     
   branches/quickbook-1.5-spirit2/syntax_highlight.cpp |    34 ------                                  
   branches/quickbook-1.5-spirit2/syntax_highlight.hpp |     7                                         
   branches/quickbook-1.5-spirit2/template.cpp         |    15 +-                                      
   15 files changed, 350 insertions(+), 300 deletions(-)
Modified: branches/quickbook-1.5-spirit2/Jamfile.v2
==============================================================================
--- branches/quickbook-1.5-spirit2/Jamfile.v2	(original)
+++ branches/quickbook-1.5-spirit2/Jamfile.v2	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -28,7 +28,6 @@
     post_process.cpp
     collector.cpp
     template.cpp
-    markups.cpp
     phrase.cpp
     phrase_actions.cpp
     phrase_image.cpp
Modified: branches/quickbook-1.5-spirit2/block.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block.cpp	(original)
+++ branches/quickbook-1.5-spirit2/block.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -24,7 +24,6 @@
 #include "utils.hpp"
 #include "actions_class.hpp"
 #include "parse_utils.hpp"
-#include "markups.hpp"
 #include "code.hpp"
 
 BOOST_FUSION_ADAPT_STRUCT(
Modified: branches/quickbook-1.5-spirit2/block_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_actions.cpp	(original)
+++ branches/quickbook-1.5-spirit2/block_actions.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -11,9 +11,8 @@
 #include <numeric>
 #include <boost/assert.hpp>
 #include <boost/filesystem/convenience.hpp>
-#include "block.hpp"
+#include "block_actions.hpp"
 #include "actions_class.hpp"
-#include "markups.hpp"
 #include "quickbook.hpp"
 #include "grammars.hpp"
 #include "code_snippet_types.hpp"
@@ -35,19 +34,15 @@
         }
     }
 
-    nothing process(quickbook::actions& actions, hr)
+    formatted process(quickbook::actions& actions, paragraph const& x)
     {
-        actions.phrase << hr_;
-        return nothing();
+        formatted r;
+        r.type="paragraph";
+        r.content = x.content;
+        return r;
     }
 
-    nothing process(quickbook::actions& actions, paragraph const& x)
-    {
-        actions.phrase << paragraph_pre << x.content << paragraph_post;
-        return nothing();
-    }
-
-    nothing process(quickbook::actions& actions, begin_section const& x)
+    begin_section2 process(quickbook::actions& actions, begin_section const& x)
     {
         // TODO: This uses the generated title.
         actions.section_id = x.id ? *x.id :
@@ -65,45 +60,24 @@
         actions.qualified_section_id += actions.section_id;
         ++actions.section_level;
 
-        if (qbk_version_n < 103) // version 1.2 and below
-        {
-            actions.phrase << "\n<section id=\""
-                << actions.doc_id << "."
-                << actions.section_id << "\">\n";
-        }
-        else // version 1.3 and above
-        {
-            actions.phrase << "\n<section id=\""
-                << actions.doc_id
-                << "."
-                << actions.qualified_section_id << "\">\n";
-        }
+        begin_section2 r;
 
         if (qbk_version_n < 103) // version 1.2 and below
         {
-            actions.phrase << "<title>" << x.content.content << "</title>\n";
+            r.id = actions.doc_id + "." + actions.section_id;
         }
         else // version 1.3 and above
         {
-            actions.phrase
-                << "<title>"
-                << "<link linkend=\""
-                << actions.doc_id
-                << "."
-                << actions.qualified_section_id << "\">"
-                << x.content.content
-                << "</link>"
-                << "</title>\n"
-                ;
+            r.linkend = r.id = actions.doc_id + "." + actions.qualified_section_id;
         }
         
-        return nothing();
+        r.content = x.content.content;
+        
+        return r;
     }
 
-    nothing process(quickbook::actions& actions, end_section const& x)
+    end_section2 process(quickbook::actions& actions, end_section const& x)
     {
-        actions.phrase << "</section>";
-
         --actions.section_level;
         if (actions.section_level < 0)
         {
@@ -126,56 +100,45 @@
             actions.qualified_section_id.erase(n, std::string::npos);
         }
         
-        return nothing();
+        return end_section2();
     }
 
-    nothing process(quickbook::actions& actions, heading const& x)
+    heading2 process(quickbook::actions& actions, heading const& x)
     {
+        heading2 r;
+
         // TODO: Is this right?
         bool new_style = qbk_version_n >= 103 || x.level > 0;
         
-        int level = x.level;
-        if(level < 0) {
-            level = actions.section_level + 2;  // section_level is zero-based. We need to use a
+        r.level = x.level;
+        if(r.level < 0) {
+            r.level = actions.section_level + 2;// section_level is zero-based. We need to use a
                                                 // one-based heading which is one greater
                                                 // than the current. Thus: section_level + 2.
-            if (level > 6)                      // The max is h6, clip it if it goes
-                level = 6;                      // further than that
+            if (r.level > 6)                    // The max is h6, clip it if it goes
+                r.level = 6;                    // further than that
         }
 
         if (!new_style) // version 1.2 and below
         {
-            actions.phrase
-                << "<anchor id=\""
-                << actions.section_id << '.'
-                << detail::make_identifier(
+            r.id = actions.section_id + "." +
+                detail::make_identifier(
                     x.content.raw_markup.begin(),
-                    x.content.raw_markup.end())
-                << "\" />"
-                << "<bridgehead renderas=\"sect" << level << "\">"
-                << x.content.content
-                << "</bridgehead>"
-                ;
+                    x.content.raw_markup.end());
         }
         else // version 1.3 and above
         {
-            std::string anchor = fully_qualified_id(
+            r.linkend = r.id = fully_qualified_id(
                 actions.doc_id, actions.qualified_section_id,
                 detail::make_identifier(
                     x.content.raw_markup.begin(),
                     x.content.raw_markup.end()));
 
-            actions.phrase
-                << "<anchor id=\"" << anchor << "\"/>"
-                << "<bridgehead renderas=\"sect" << level << "\">"
-                << "<link linkend=\"" << anchor << "\">"
-                << x.content.content
-                << "</link>"
-                << "</bridgehead>"
-                ;
         }
+
+        r.content = x.content.content;
         
-        return nothing();
+        return r;
     }
 
     nothing process(quickbook::actions& actions, def_macro const& x)
@@ -198,68 +161,25 @@
         return nothing();
     }
 
-    nothing process(quickbook::actions& actions, variablelist const& x)
+    table2 process(quickbook::actions& actions, table const& x)
     {
-        actions.phrase << "<variablelist>\n";
-
-        actions.phrase << "<title>";
-        detail::print_string(x.title, actions.phrase.get());
-        actions.phrase << "</title>\n";
-
-        for(std::vector<varlistentry>::const_iterator
-            it = x.entries.begin(); it != x.entries.end(); ++it)
-        {
-            actions.phrase << start_varlistentry_;
-            std::for_each(it->begin(), it->end(), actions.process);
-            actions.phrase << end_varlistentry_;
-        }
-
-        actions.phrase << "</variablelist>\n";
-        
-        return nothing();
-    }
+        table2 r;
 
-
-    nothing process(quickbook::actions& actions, table const& x)
-    {
-        bool has_title = !x.title.empty();
+        if(!x.title.empty()) r.title = x.title;
         
-        std::string table_id;
         if(qbk_version_n >= 105) {
             if(x.id) {
-                table_id = fully_qualified_id(actions.doc_id,
+                r.id = fully_qualified_id(actions.doc_id,
                     actions.qualified_section_id, *x.id);
             }
-            else if(has_title) {
-                table_id = fully_qualified_id(actions.doc_id,
+            else if(r.title) {
+                r.id = fully_qualified_id(actions.doc_id,
                     actions.qualified_section_id,
                     detail::make_identifier(x.title.begin(), x.title.end()));
             }
         }
-
-        if (has_title)
-        {
-            actions.phrase << "<table frame=\"all\"";
-            if(!table_id.empty())
-                actions.phrase << " id=\"" << table_id << "\"";
-            actions.phrase << ">\n";
-            actions.phrase << "<title>";
-            detail::print_string(x.title, actions.phrase.get());
-            actions.phrase << "</title>";
-        }
-        else
-        {
-            actions.phrase << "<informaltable frame=\"all\"";
-            if(!table_id.empty())
-                actions.phrase << " id=\"" << table_id << "\"";
-            actions.phrase << ">\n";
-        }
-
-        // This is a bit odd for backwards compatability: the old version just
-        // used the last count that was calculated.
-        actions.phrase << "<tgroup cols=\""
-            << (x.rows.empty() ? 0 : x.rows.back().size())
-            << "\">\n";
+        
+        r.cols = x.rows.empty() ? 0 : x.rows.back().size();
 
         std::vector<table_row>::const_iterator row = x.rows.begin();
 
@@ -268,36 +188,13 @@
         // when there was more than one row.
         if (x.rows.size() > 1)
         {
-            actions.phrase << "<thead>";
-            actions.phrase << start_row_;
-            std::for_each(row->begin(), row->end(), actions.process);
-            actions.phrase << end_row_;
-            actions.phrase << "</thead>\n";
+            r.head = *row;
             ++row;
         }
 
-        actions.phrase << "<tbody>\n";
+        r.rows.assign(row, x.rows.end());
 
-        while(row != x.rows.end()) {
-            actions.phrase << start_row_;
-            std::for_each(row->begin(), row->end(), actions.process);
-            actions.phrase << end_row_;
-            ++row;
-        }
-
-        actions.phrase << "</tbody>\n"
-                     << "</tgroup>\n";
-
-        if (has_title)
-        {
-            actions.phrase << "</table>\n";
-        }
-        else
-        {
-            actions.phrase << "</informaltable>\n";
-        }
-        
-        return nothing();
+        return r;
     }
 
     namespace
@@ -396,14 +293,11 @@
         }
     }
 
-    nothing process(quickbook::actions& actions, xinclude const& x)
+    xinclude2 process(quickbook::actions& actions, xinclude const& x)
     {
-        fs::path path = calculate_relative_path(x.path, actions);
-        actions.phrase << "\n<xi:include href=\"";
-        detail::print_string(detail::escape_uri(path.string()), actions.phrase.get());
-        actions.phrase << "\" />\n";
-        
-        return nothing();
+        xinclude2 r;
+        r.path = calculate_relative_path(x.path, actions).string();
+        return r;
     }
 
     nothing process(quickbook::actions& actions, include const& x)
Added: branches/quickbook-1.5-spirit2/block_actions.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/block_actions.hpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,32 @@
+/*=============================================================================
+    Copyright (c) 2002 2004 2006 Joel de Guzman
+    Copyright (c) 2004 Eric Niebler
+    http://spirit.sourceforge.net/
+
+    Use, modification and distribution is subject to the Boost Software
+    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+    http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_QUICKBOOK_BLOCK_ACTIONS_HPP)
+#define BOOST_SPIRIT_QUICKBOOK_BLOCK_ACTIONS_HPP
+
+#include "block.hpp"
+#include "gen_types.hpp"
+
+namespace quickbook
+{
+    // TODO: Just generate formatted.
+    formatted process(quickbook::actions&, paragraph const&);
+    begin_section2 process(quickbook::actions&, begin_section const&);
+    end_section2 process(quickbook::actions&, end_section const&);
+    heading2 process(quickbook::actions&, heading const&);
+    nothing process(quickbook::actions&, def_macro const&);
+    nothing process(quickbook::actions&, define_template const&);
+    table2 process(quickbook::actions&, table const&);
+    xinclude2 process(quickbook::actions&, xinclude const&);
+    nothing process(quickbook::actions&, import const&);
+    nothing process(quickbook::actions&, include const&);
+    list2 process(quickbook::actions&, list const&);
+}
+
+#endif
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/block_list.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_list.cpp	(original)
+++ branches/quickbook-1.5-spirit2/block_list.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -9,14 +9,12 @@
 =============================================================================*/
 
 #include <boost/assert.hpp>
-#include "block.hpp"
 #include "actions_class.hpp"
+#include "gen_types.hpp"
 #include "utils.hpp"
 
 namespace quickbook
 {
-    typedef std::pair<char, int> mark_type;
-
     namespace {
         int indent_length(std::string const& indent)
         {
@@ -36,46 +34,47 @@
         }
     }
 
-    nothing process(quickbook::actions& actions, quickbook::list const& list)
+    struct stack_entry
+    {
+        explicit stack_entry(list2& list, int indent) : list(list), indent(indent) {}
+        list2& list;
+        int indent;
+    };
+
+    list2 process(quickbook::actions& actions, quickbook::list const& list)
     {
-        int list_indent = -1;
-        std::stack<mark_type> list_marks;
+        list::const_iterator it = list.begin(), end = list.end();
+        BOOST_ASSERT(it != end);
+        
+        list2 r;
+        r.mark = list.begin()->mark;
+        std::stack<stack_entry> stack;
+        stack.push(stack_entry(r, 0));
 
         for(list::const_iterator it = list.begin(), end = list.end(); it != end; ++it)
         {
             int new_indent = indent_length(it->indent);
             BOOST_ASSERT(it->mark == '#' || it->mark == '*');
             
-            // The first item shouldn't be indented.
-            BOOST_ASSERT(list_indent != -1 || new_indent == 0);
-    
-            if (new_indent > list_indent)
+            if (new_indent > stack.top().indent)
             {
-                list_indent = new_indent;
-                list_marks.push(mark_type(it->mark, list_indent));
-                actions.phrase << std::string(it->mark == '#' ? "<orderedlist>\n" : "<itemizedlist>\n");
+                stack.push(stack_entry(stack.top().list.items.back().sublist, new_indent));
+                stack.top().list.mark = it->mark;
             }
-            else if(new_indent == list_indent)
+            else if (new_indent < stack.top().indent)
             {
-                actions.phrase << std::string("\n</listitem>");
-            }
-            else if (new_indent < list_indent)
-            {
-                list_indent = new_indent;
-    
-                // TODO: This assumes that list_indent is equal to one of the
+                // TODO: This assumes that new_indent is equal to one of the
                 // existing indents.
-                while (!list_marks.empty() && (list_indent < list_marks.top().second))
-                {
-                    actions.phrase << std::string("\n</listitem>");
-                    actions.phrase << std::string(list_marks.top().first == '#' ? "\n</orderedlist>" : "\n</itemizedlist>");
-                    list_marks.pop();
-                }
-                BOOST_ASSERT(!list_marks.empty());
-                actions.phrase << std::string("\n</listitem>");
+                while (!stack.empty() && (new_indent < stack.top().indent))
+                    stack.pop();
+                BOOST_ASSERT(!stack.empty());
             }
+            
+            list_item2 item;
+            item.content = it->content;
+            stack.top().list.items.push_back(item);
     
-            if (it->mark != list_marks.top().first)
+            if (it->mark != stack.top().list.mark)
             {
                 file_position const pos = it->position;
                 detail::outerr(pos.file,pos.line)
@@ -84,17 +83,8 @@
                     << "Ignoring change of list style" << std::endl;
                 ++actions.error_count;
             }
-            
-            actions.phrase << "<listitem>\n" << it->content;
-        }
-
-        while (!list_marks.empty())
-        {
-            actions.phrase << std::string("\n</listitem>");
-            actions.phrase << std::string(list_marks.top().first == '#' ? "\n</orderedlist>" : "\n</itemizedlist>");
-            list_marks.pop();
         }
 
-        return nothing();
+        return r;
     }
 }
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/boostbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/boostbook.cpp	(original)
+++ branches/quickbook-1.5-spirit2/boostbook.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -2,10 +2,21 @@
 #include "boostbook.hpp"
 #include "phrase.hpp"
 #include "actions_class.hpp"
-#include "utils.hpp"
+#include <algorithm>
 
 namespace quickbook
 {
+    struct output_action
+    {
+        output_action(quickbook::actions& actions) : actions(actions) {}    
+        quickbook::actions& actions;
+
+        template <typename T>
+        void operator()(T const& x) const {
+            output(actions, x);
+        }
+    };
+
     template <typename Iter>
     std::string encode(Iter first, Iter last)
     {
@@ -114,14 +125,14 @@
 
     void output(quickbook::actions& actions, anchor const& x) {
         actions.phrase << "<anchor id=\"";
-        detail::print_string(x.id, actions.phrase.get());
-        actions.phrase << "\" />\n";
+        actions.phrase << encode(x.id);
+        actions.phrase << "\"/>\n";
     }
 
     void output(quickbook::actions& actions, link const& x) {
         boostbook_markup m = markup_map.at(x.type);
         actions.phrase << m.pre;
-        detail::print_string(x.destination, actions.phrase.get());
+        actions.phrase << encode(x.destination);
         actions.phrase << "\">";
         actions.phrase << x.content;
         actions.phrase << m.post;
@@ -136,4 +147,196 @@
         boostbook_markup m = markup_map.at("break");
         actions.phrase << m.pre;
     }
+
+    void output(quickbook::actions& actions, image2 const& x) {
+        actions.phrase << "<inlinemediaobject>";
+
+        actions.phrase << "<imageobject><imagedata";
+        
+        for(image2::attribute_map::const_iterator
+            attr_first = x.attributes.begin(), attr_last  = x.attributes.end();
+            attr_first != attr_last; ++attr_first)
+        {
+            if(attr_first->first == "alt") continue;
+        
+            actions.phrase
+                << " "
+                << attr_first->first
+                << "=\""
+                << encode(attr_first->second)
+                << "\"";
+        }
+
+        actions.phrase << "></imagedata></imageobject>";
+
+        attribute_map::const_iterator it = x.attributes.find("alt");
+        if(it != x.attributes.end()) {
+            // Also add a textobject -- use the basename of the image file.
+            // This will mean we get "alt" attributes of the HTML img.
+            actions.phrase << "<textobject><phrase>";
+            actions.phrase << encode(it->second);
+            actions.phrase << "</phrase></textobject>";
+        }
+
+        actions.phrase << "</inlinemediaobject>";
+    }
+
+    void output(quickbook::actions& actions, hr) {
+        actions.phrase << markup_map.at("hr").pre;
+    }
+
+    void output(quickbook::actions& actions, begin_section2 const& x) {
+        actions.phrase << "\n<section id=\"" << x.id << "\">\n";
+        if(x.linkend.empty()) {
+            actions.phrase
+                << "<title>"
+                << x.content
+                << "</title>\n"
+                ;
+        }
+        else {
+            actions.phrase
+                << "<title>"
+                << "<link linkend=\""
+                << x.linkend
+                << "\">"
+                << x.content
+                << "</link>"
+                << "</title>\n"
+                ;
+        }
+    }
+
+    void output(quickbook::actions& actions, end_section2 const& x) {
+        actions.phrase << "</section>";
+    }
+
+    void output(quickbook::actions& actions, heading2 const& x) {
+        actions.phrase
+            << "<anchor id=\"" << x.id << "\"/>"
+            << "<bridgehead renderas=\"sect" << x.level << "\">";
+
+        if(x.linkend.empty()) {
+            actions.phrase << x.content;
+        }
+        else {
+            actions.phrase
+                << "<link linkend=\"" << x.linkend << "\">"
+                << x.content << "</link>";
+        }
+
+        actions.phrase << "</bridgehead>";
+    }
+
+    void output(quickbook::actions& actions, variablelist const& x)
+    {
+        actions.phrase << "<variablelist>\n";
+
+        actions.phrase << "<title>";
+        actions.phrase << encode(x.title);
+        actions.phrase << "</title>\n";
+
+        boostbook_markup m = markup_map.at("varlistentry");
+
+        for(std::vector<varlistentry>::const_iterator
+            it = x.entries.begin(); it != x.entries.end(); ++it)
+        {
+            actions.phrase << m.pre;
+            std::for_each(it->begin(), it->end(), output_action(actions));
+            actions.phrase << m.post;
+        }
+
+        actions.phrase << "</variablelist>\n";
+    }
+
+    void output(quickbook::actions& actions, table2 const& x)
+    {
+        if (x.title)
+        {
+            actions.phrase << "<table frame=\"all\"";
+            if(x.id)
+                actions.phrase << " id=\"" << *x.id << "\"";
+            actions.phrase << ">\n";
+            actions.phrase << "<title>";
+            actions.phrase << encode(*x.title);
+            actions.phrase << "</title>";
+        }
+        else
+        {
+            actions.phrase << "<informaltable frame=\"all\"";
+            if(x.id)
+                actions.phrase << " id=\"" << *x.id << "\"";
+            actions.phrase << ">\n";
+        }
+
+        // This is a bit odd for backwards compatability: the old version just
+        // used the last count that was calculated.
+        actions.phrase << "<tgroup cols=\"" << x.cols << "\">\n";
+
+        boostbook_markup m = markup_map.at("row");
+
+        if (x.head)
+        {
+            actions.phrase << "<thead>";
+            actions.phrase << m.pre;
+            std::for_each(x.head->begin(), x.head->end(), actions.process);
+            actions.phrase << m.post;
+            actions.phrase << "</thead>\n";
+        }
+
+        actions.phrase << "<tbody>\n";
+
+        for(std::vector<table_row>::const_iterator
+            it = x.rows.begin(); it != x.rows.end(); ++it)
+        {
+            actions.phrase << m.pre;
+            std::for_each(it->begin(), it->end(), actions.process);
+            actions.phrase << m.post;
+        }
+
+        actions.phrase << "</tbody>\n" << "</tgroup>\n";
+
+        if (x.title)
+        {
+            actions.phrase << "</table>\n";
+        }
+        else
+        {
+            actions.phrase << "</informaltable>\n";
+        }
+    }
+
+    void output(quickbook::actions& actions, xinclude2 const& x)
+    {
+        actions.phrase << "\n<xi:include href=\"" <<x.path << "\" />\n";
+    }
+
+    void output(quickbook::actions& actions, list2 const& x)
+    {
+        actions.phrase << std::string(x.mark == '#' ? "<orderedlist>\n" : "<itemizedlist>\n");
+
+        for(std::vector<list_item2>::const_iterator
+            it = x.items.begin(), end = x.items.end(); it != end; ++it)
+        {
+            actions.phrase << "<listitem>\n" << it->content;
+            if(!it->sublist.items.empty()) output(actions, it->sublist);
+            actions.phrase << std::string("\n</listitem>");
+        }
+
+        actions.phrase << std::string(x.mark == '#' ? "\n</orderedlist>" : "\n</itemizedlist>");
+    }
+
+    void output(quickbook::actions& actions, code_token const& x)
+    {
+        std::string type = x.type;
+        if(type == "space") {
+            actions.phrase << x.text;
+        }
+        else {
+            actions.phrase
+                << "<phrase role=\"" << x.type << "\">"
+                << encode(x.text)
+                << "</phrase>";
+        }
+    }
 }
Modified: branches/quickbook-1.5-spirit2/boostbook.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/boostbook.hpp	(original)
+++ branches/quickbook-1.5-spirit2/boostbook.hpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -1,8 +1,27 @@
+/*=============================================================================
+    Copyright (c) 2002 2004 2006 Joel de Guzman
+    Copyright (c) 2004 Eric Niebler
+    Copyright (c) 2010 Daniel James
+    http://spirit.sourceforge.net/
+
+    Use, modification and distribution is subject to the Boost Software
+    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+    http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_SPIRIT_QUICKBOOK_BOOSTBOOK_HPP)
+#define BOOST_SPIRIT_QUICKBOOK_BOOSTBOOK_HPP
+
 #include "fwd.hpp"
 #include "phrase.hpp"
+#include "block.hpp"
+#include "syntax_highlight.hpp"
+#include "gen_types.hpp"
 
 namespace quickbook
 {
+    // TODO: Sort this out:
+
     // Output function for boostbook, these should eventually become an
     // interface with implementations for boostbook and html.
     // They probably shouldn't use quickbook::actions, instead they
@@ -14,8 +33,22 @@
     void output(quickbook::actions&, link const&);
     void output(quickbook::actions&, formatted const&);
     void output(quickbook::actions&, break_ const&);
+    void output(quickbook::actions&, image2 const&);
+
+    void output(quickbook::actions&, hr);
+    void output(quickbook::actions&, begin_section2 const&);
+    void output(quickbook::actions&, end_section2 const&);
+    void output(quickbook::actions&, heading2 const&);
+    void output(quickbook::actions&, variablelist const&);
+    void output(quickbook::actions&, table2 const&);
+    void output(quickbook::actions&, xinclude2 const&);
+    void output(quickbook::actions&, list2 const&);
+
+    void output(quickbook::actions&, code_token const&);
 
     std::string encode(std::string const&);
     std::string encode(char);
     std::string encode(char const*);
 }
+
+#endif
Modified: branches/quickbook-1.5-spirit2/code_snippet.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet.cpp	(original)
+++ branches/quickbook-1.5-spirit2/code_snippet.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -16,7 +16,6 @@
 #include <iterator>
 #include <boost/lexical_cast.hpp>
 #include "utils.hpp"
-#include "markups.hpp"
 #include "actions_class.hpp"
 #include "grammars.hpp"
 #include "code_snippet_types.hpp"
Added: branches/quickbook-1.5-spirit2/gen_types.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/gen_types.hpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,78 @@
+/*=============================================================================
+    Copyright (c) 2002 2004 2006 Joel de Guzman
+    Copyright (c) 2004 Eric Niebler
+    Copyright (c) 2010 Daniel James
+    http://spirit.sourceforge.net/
+
+    Use, modification and distribution is subject to the Boost Software
+    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+    http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_SPIRIT_QUICKBOOK_GEN_TYPES_HPP)
+#define BOOST_SPIRIT_QUICKBOOK_GEN_TYPES_HPP
+
+#include <string>
+#include <vector>
+#include <map>
+#include <boost/optional.hpp>
+#include "block.hpp"
+
+namespace quickbook
+{
+    struct image2 {
+        typedef std::map<std::string, std::string> attribute_map;
+        
+        image2(attribute_map const& attributes)
+            : attributes(attributes) {}
+
+        attribute_map attributes;
+    };
+    
+    struct begin_section2 {
+        std::string id;
+        std::string content;
+        std::string linkend;
+    };
+
+    struct end_section2 {
+    };
+
+    struct heading2
+    {
+        int level;
+        std::string id;
+        std::string content;
+        std::string linkend;
+    };
+
+    struct table2
+    {
+        boost::optional<std::string> id;
+        boost::optional<std::string> title;
+        int cols;
+        boost::optional<table_row> head;
+        std::vector<table_row> rows;
+    };
+
+    struct xinclude2
+    {
+        std::string path;
+    };
+
+    struct list_item2;
+
+    struct list2
+    {
+        char mark;
+        std::vector<list_item2> items;
+    };
+
+    struct list_item2
+    {
+        std::string content;
+        list2 sublist;
+    };
+}
+
+#endif
Deleted: branches/quickbook-1.5-spirit2/markups.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/markups.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
+++ (empty file)
@@ -1,101 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2002 2004 2006 Joel de Guzman
-    Copyright (c) 2004 Eric Niebler
-    http://spirit.sourceforge.net/
-
-    Use, modification and distribution is subject to the Boost Software
-    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-    http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-
-#include "markups.hpp"
-
-namespace quickbook
-{
-    const char* comment_pre         = "<!--";
-    const char* comment_post        = "-->";
-    const char* paragraph_pre       = "<para>\n";
-    const char* paragraph_post      = "</para>\n";
-    const char* h1_pre              = "<bridgehead renderas=\"sect1\">";
-    const char* h1_post             = "</bridgehead>";
-    const char* h2_pre              = "<bridgehead renderas=\"sect2\">";
-    const char* h2_post             = "</bridgehead>";
-    const char* h3_pre              = "<bridgehead renderas=\"sect3\">";
-    const char* h3_post             = "</bridgehead>";
-    const char* h4_pre              = "<bridgehead renderas=\"sect4\">";
-    const char* h4_post             = "</bridgehead>";
-    const char* h5_pre              = "<bridgehead renderas=\"sect5\">";
-    const char* h5_post             = "</bridgehead>";
-    const char* h6_pre              = "<bridgehead renderas=\"sect6\">";
-    const char* h6_post             = "</bridgehead>";
-    const char* hr_                 = "<para/>";
-    const char* blurb_pre           = "<sidebar role=\"blurb\">\n";
-    const char* blurb_post          = "</sidebar>\n";
-    const char* blockquote_pre      = "<blockquote><para>";
-    const char* blockquote_post     = "</para></blockquote>";
-    const char* preformatted_pre    = "<programlisting>";
-    const char* preformatted_post   = "</programlisting>";
-    const char* warning_pre         = "<warning>";
-    const char* warning_post        = "</warning>";
-    const char* caution_pre         = "<caution>";
-    const char* caution_post        = "</caution>";
-    const char* important_pre       = "<important>";
-    const char* important_post      = "</important>";
-    const char* note_pre            = "<note>";
-    const char* note_post           = "</note>";
-    const char* tip_pre             = "<tip>";
-    const char* tip_post            = "</tip>";
-    const char* list_item_pre       = "<listitem>\n";
-    const char* list_item_post      = "\n</listitem>";
-    const char* bold_pre_           = "<emphasis role=\"bold\">";
-    const char* bold_post_          = "</emphasis>";
-    const char* italic_pre_         = "<emphasis>";
-    const char* italic_post_        = "</emphasis>";
-    const char* underline_pre_      = "<emphasis role=\"underline\">";
-    const char* underline_post_     = "</emphasis>";
-    const char* teletype_pre_       = "<literal>";
-    const char* teletype_post_      = "</literal>";
-    const char* strikethrough_pre_  = "<emphasis role=\"strikethrough\">";
-    const char* strikethrough_post_ = "</emphasis>";
-    const char* quote_pre_          = "<quote>";
-    const char* quote_post_         = "</quote>";
-    const char* break_mark          = "<sbr/>\n";
-    const char* url_pre_            = "<ulink url=\"";
-    const char* url_post_           = "</ulink>";
-    const char* link_pre_           = "<link linkend=\"";
-    const char* link_post_          = "</link>";
-    const char* start_varlistentry_ = "<varlistentry>";
-    const char* end_varlistentry_   = "</varlistentry>\n";
-    const char* start_varlistterm_  = "<term>";
-    const char* end_varlistterm_    = "</term>";
-    const char* start_varlistitem_  = "<listitem>";
-    const char* end_varlistitem_    = "</listitem>";
-    const char* start_header_       = "<thead>";
-    const char* end_header_         = "</thead>\n";
-    const char* start_row_          = "<row>";
-    const char* end_row_            = "</row>\n";
-    const char* start_cell_         = "<entry>";
-    const char* end_cell_           = "</entry>";
-    const char* funcref_pre_        = "<functionname alt=\"";
-    const char* funcref_post_       = "</functionname>";
-    const char* classref_pre_       = "<classname alt=\"";
-    const char* classref_post_      = "</classname>";
-    const char* memberref_pre_      = "<methodname alt=\"";
-    const char* memberref_post_     = "</methodname>";
-    const char* enumref_pre_        = "<enumname alt=\"";
-    const char* enumref_post_       = "</enumname>";
-    const char* macroref_pre_       = "<macroname alt=\"";
-    const char* macroref_post_      = "</macroname>";
-    const char* headerref_pre_      = "<headername alt=\"";
-    const char* headerref_post_     = "</headername>";
-    const char* conceptref_pre_     = "<conceptname alt=\"";
-    const char* conceptref_post_    = "</conceptname>";
-    const char* globalref_pre_      = "<globalname alt=\"";
-    const char* globalref_post_     = "</globalname>";
-    const char* footnote_pre_       = "<footnote><para>";
-    const char* footnote_post_      = "</para></footnote>";
-    const char* escape_pre_         = "<!--quickbook-escape-prefix-->";
-    const char* escape_post_        = "<!--quickbook-escape-postfix-->";
-    const char* replaceable_pre_    = "<replaceable>";
-    const char* replaceable_post_   = "</replaceable>";
-}
Deleted: branches/quickbook-1.5-spirit2/markups.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/markups.hpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
+++ (empty file)
@@ -1,104 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2002 2004 2006 Joel de Guzman
-    Copyright (c) 2004 Eric Niebler
-    http://spirit.sourceforge.net/
-
-    Use, modification and distribution is subject to the Boost Software
-    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-    http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-#if !defined(BOOST_SPIRIT_MARKUPS_HPP)
-#define BOOST_SPIRIT_MARKUPS_HPP
-
-namespace quickbook
-{
-    extern const char* comment_pre;
-    extern const char* comment_post;
-    extern const char* paragraph_pre;
-    extern const char* paragraph_post;
-    extern const char* h1_pre;
-    extern const char* h1_post;
-    extern const char* h2_pre;
-    extern const char* h2_post;
-    extern const char* h3_pre;
-    extern const char* h3_post;
-    extern const char* h4_pre;
-    extern const char* h4_post;
-    extern const char* h5_pre;
-    extern const char* h5_post;
-    extern const char* h6_pre;
-    extern const char* h6_post;
-    extern const char* hr_;
-    extern const char* blurb_pre;
-    extern const char* blurb_post;
-    extern const char* blockquote_pre;
-    extern const char* blockquote_post;
-    extern const char* preformatted_pre;
-    extern const char* preformatted_post;
-    extern const char* warning_pre;
-    extern const char* warning_post;
-    extern const char* caution_pre;
-    extern const char* caution_post;
-    extern const char* important_pre;
-    extern const char* important_post;
-    extern const char* note_pre;
-    extern const char* note_post;
-    extern const char* tip_pre;
-    extern const char* tip_post;
-    extern const char* list_item_pre;
-    extern const char* list_item_post;
-    extern const char* bold_pre_;
-    extern const char* bold_post_;
-    extern const char* italic_pre_;
-    extern const char* italic_post_;
-    extern const char* underline_pre_;
-    extern const char* underline_post_;
-    extern const char* teletype_pre_;
-    extern const char* teletype_post_;
-    extern const char* strikethrough_pre_;
-    extern const char* strikethrough_post_;
-    extern const char* quote_pre_;
-    extern const char* quote_post_;
-    extern const char* break_mark;
-    extern const char* url_pre_;
-    extern const char* url_post_;
-    extern const char* link_pre_;
-    extern const char* link_post_;
-    extern const char* start_varlistentry_;
-    extern const char* end_varlistentry_;
-    extern const char* start_varlistterm_;
-    extern const char* end_varlistterm_;
-    extern const char* start_varlistitem_;
-    extern const char* end_varlistitem_;
-    extern const char* start_header_;
-    extern const char* end_header_;
-    extern const char* start_row_;
-    extern const char* end_row_;
-    extern const char* start_cell_;
-    extern const char* end_cell_;
-    extern const char* funcref_pre_;
-    extern const char* funcref_post_;
-    extern const char* classref_pre_;
-    extern const char* classref_post_;
-    extern const char* memberref_pre_;
-    extern const char* memberref_post_;
-    extern const char* enumref_pre_;
-    extern const char* enumref_post_;
-    extern const char* macroref_pre_;
-    extern const char* macroref_post_;
-    extern const char* headerref_pre_;
-    extern const char* headerref_post_;
-    extern const char* conceptref_pre_;
-    extern const char* conceptref_post_;
-    extern const char* globalref_pre_;
-    extern const char* globalref_post_;
-    extern const char* footnote_pre_;
-    extern const char* footnote_post_;
-    extern const char* escape_pre_;
-    extern const char* escape_post_;
-    extern const char* replaceable_pre_;
-    extern const char* replaceable_post_;
-}
-
-#endif // BOOST_SPIRIT_MARKUPS_HPP
-
Modified: branches/quickbook-1.5-spirit2/phrase.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase.cpp	(original)
+++ branches/quickbook-1.5-spirit2/phrase.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -22,7 +22,6 @@
 #include "phrase.hpp"
 #include "grammars.hpp"
 #include "actions_class.hpp"
-#include "markups.hpp"
 #include "quickbook.hpp"
 #include "parse_utils.hpp"
 
Modified: branches/quickbook-1.5-spirit2/phrase_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_actions.cpp	(original)
+++ branches/quickbook-1.5-spirit2/phrase_actions.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -11,7 +11,6 @@
 #include <boost/assert.hpp>
 #include "phrase.hpp"
 #include "actions_class.hpp"
-#include "markups.hpp"
 #include "utils.hpp"
 #include "code.hpp"
 #include "boostbook.hpp"
Modified: branches/quickbook-1.5-spirit2/phrase_actions.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_actions.hpp	(original)
+++ branches/quickbook-1.5-spirit2/phrase_actions.hpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -1,5 +1,18 @@
+/*=============================================================================
+    Copyright (c) 2002 2004 2006 Joel de Guzman
+    Copyright (c) 2004 Eric Niebler
+    http://spirit.sourceforge.net/
+
+    Use, modification and distribution is subject to the Boost Software
+    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+    http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_QUICKBOOK_PHRASE_ACTIONS_HPP)
+#define BOOST_SPIRIT_QUICKBOOK_PHRASE_ACTIONS_HPP
+
 #include "phrase.hpp"
 #include "code.hpp"
+#include "gen_types.hpp"
 
 namespace quickbook
 {
@@ -10,4 +23,8 @@
     std::string process(quickbook::actions&, cond_phrase const&);
     break_ process(quickbook::actions&, break_ const&);
     formatted process(quickbook::actions&, code const&);
+    image2 process(quickbook::actions&, image const&);
+    std::string process(quickbook::actions&, call_template const&);
 }
+
+#endif
Modified: branches/quickbook-1.5-spirit2/phrase_image.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_image.cpp	(original)
+++ branches/quickbook-1.5-spirit2/phrase_image.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -11,6 +11,7 @@
 #include <boost/filesystem/convenience.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include "phrase.hpp"
+#include "gen_types.hpp"
 #include "actions_class.hpp"
 #include "utils.hpp"
 
@@ -18,7 +19,7 @@
 {
     namespace fs = boost::filesystem;
 
-    nothing process(quickbook::actions& actions, image const& x)
+    image2 process(quickbook::actions& actions, image const& x)
     {
         std::map<std::string, std::string> attributes(
             x.attributes.begin(), x.attributes.end());
@@ -43,12 +44,9 @@
         }
     
         fs::path const img_path(x.image_filename);
-        
-        attribute_map::iterator it = attributes.find("alt");
-        std::string alt_text = it != attributes.end() ? it->second : fs::basename(img_path);
-        attributes.erase("alt");
-
         attributes.insert(attribute_map::value_type("fileref", x.image_filename));
+        // Note: If there is already an alt attribute this is a no-op.
+        attributes.insert(attribute_map::value_type("alt", fs::basename(img_path)));
 
         if(fs::extension(img_path) == ".svg")
         {
@@ -112,39 +110,7 @@
                 std::string(svg_text.begin() + a + 1, svg_text.begin() + b)));
            }
         }
-
-        actions.phrase << "<inlinemediaobject>";
-
-        actions.phrase << "<imageobject><imagedata";
         
-        for(attribute_map::const_iterator
-            attr_first = attributes.begin(), attr_last  = attributes.end();
-            attr_first != attr_last; ++attr_first)
-        {
-            actions.phrase << " " << attr_first->first << "=\"";
-
-            for(std::string::const_iterator
-                first = attr_first->second.begin(),
-                last  = attr_first->second.end();
-                first != last; ++first)
-            {
-                if (*first == '\\' && ++first == last) break;
-                detail::print_char(*first, actions.phrase.get());
-            }
-
-            actions.phrase << "\"";
-        }
-
-        actions.phrase << "></imagedata></imageobject>";
-
-        // Also add a textobject -- use the basename of the image file.
-        // This will mean we get "alt" attributes of the HTML img.
-        actions.phrase << "<textobject><phrase>";
-        detail::print_string(alt_text, actions.phrase.get());
-        actions.phrase << "</phrase></textobject>";
-
-        actions.phrase << "</inlinemediaobject>";
-
-        return nothing();
+        return image2(attributes);
     }
 }
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/process.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/process.cpp	(original)
+++ branches/quickbook-1.5-spirit2/process.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -11,9 +11,9 @@
 
 #include "fwd.hpp"
 #include "phrase_actions.hpp"
+#include "block_actions.hpp"
 #include "actions.hpp"
 #include "parse_types.hpp"
-#include "block.hpp"
 #include "code.hpp"
 #include "syntax_highlight.hpp"
 #include "template.hpp"
@@ -37,22 +37,6 @@
     }
 
     void output(quickbook::actions&, std::string const&);
-    nothing process(quickbook::actions&, call_template const&);
-    nothing process(quickbook::actions&, image const&);
-    nothing process(quickbook::actions&, hr);
-    nothing process(quickbook::actions&, paragraph const&);
-    nothing process(quickbook::actions&, list const&);
-    nothing process(quickbook::actions&, begin_section const&);
-    nothing process(quickbook::actions&, end_section const&);
-    nothing process(quickbook::actions&, heading const&);
-    nothing process(quickbook::actions&, def_macro const&);
-    nothing process(quickbook::actions&, variablelist const&);
-    nothing process(quickbook::actions&, table const&);
-    nothing process(quickbook::actions&, xinclude const&);
-    nothing process(quickbook::actions&, import const&);
-    nothing process(quickbook::actions&, include const&);
-    nothing process(quickbook::actions&, define_template const&);
-    nothing process(quickbook::actions&, code_token const&);
 
     template void process_action::operator()<formatted>(formatted const&) const;
     template void process_action::operator()<source_mode>(source_mode const&) const;
Modified: branches/quickbook-1.5-spirit2/syntax_highlight.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/syntax_highlight.cpp	(original)
+++ branches/quickbook-1.5-spirit2/syntax_highlight.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -7,8 +7,6 @@
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
-#if !defined(BOOST_SPIRIT_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP
 
 #include <boost/spirit/include/qi_core.hpp>
 #include <boost/spirit/include/qi_auxiliary.hpp>
@@ -21,36 +19,6 @@
 #include "utils.hpp"
 #include "syntax_highlight.hpp"
 
-namespace quickbook
-{
-    struct code_token
-    {
-        std::string text;
-        char const* type;
-    };
-    
-    struct space
-    {
-        std::string text;
-        char const* dummy;
-    };
-    
-    nothing process(quickbook::actions& actions, code_token const& x)
-    {
-        std::string type = x.type;
-        if(type == "space") {
-            actions.phrase << x.text;
-        }
-        else {
-            actions.phrase << "<phrase role=\"" << x.type << "\">";
-            detail::print_string(x.text, actions.phrase.get());
-            actions.phrase << "</phrase>";
-        }
-
-        return nothing();
-    }
-}   
-
 BOOST_FUSION_ADAPT_STRUCT(
     quickbook::code_token,
     (std::string, text)
@@ -432,5 +400,3 @@
         return str;
     }
 }
-
-#endif // BOOST_SPIRIT_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP
Modified: branches/quickbook-1.5-spirit2/syntax_highlight.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/syntax_highlight.hpp	(original)
+++ branches/quickbook-1.5-spirit2/syntax_highlight.hpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -14,8 +14,11 @@
 
 namespace quickbook
 {
-    struct code_token;
-    struct space;
+    struct code_token
+    {
+        std::string text;
+        char const* type;
+    };
 }
 
 #endif
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/template.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/template.cpp	(original)
+++ branches/quickbook-1.5-spirit2/template.cpp	2010-02-07 04:10:00 EST (Sun, 07 Feb 2010)
@@ -9,7 +9,7 @@
 
 #include <boost/spirit/include/qi_symbols.hpp>
 #include "template.hpp"
-#include "phrase.hpp"
+#include "phrase_actions.hpp"
 #include "grammars.hpp"
 #include "actions_class.hpp"
 #include "quickbook.hpp"
@@ -342,7 +342,7 @@
         }
     }
 
-    nothing process(quickbook::actions& actions, call_template const& x)
+    std::string process(quickbook::actions& actions, call_template const& x)
     {
         ++actions.template_depth;
         if (actions.template_depth > actions.max_template_depth)
@@ -351,7 +351,7 @@
                 << "Infinite loop detected" << std::endl;
             --actions.template_depth;
             ++actions.error_count;
-            return nothing();
+            return "";
         }
 
         // The template arguments should have the scope that the template was
@@ -380,7 +380,7 @@
                 actions.pop(); // restore the actions' states
                 --actions.template_depth;
                 ++actions.error_count;
-                return nothing();
+                return "";
             }
 
             ///////////////////////////////////
@@ -395,7 +395,7 @@
             {
                 actions.pop(); // restore the actions' states
                 --actions.template_depth;
-                return nothing();
+                return "";
             }
 
             ///////////////////////////////////
@@ -413,15 +413,14 @@
                 actions.pop(); // restore the actions' states
                 --actions.template_depth;
                 ++actions.error_count;
-                return nothing();
+                return "";
             }
         }
 
         actions.pop(); // restore the actions' states
-        actions.phrase << result; // print it!!!
         --actions.template_depth;
         
-        return nothing();
+        return result;
     }
 }