Update of /cvsroot/boost/boost/tools/quickbook/detail
In directory 
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30470/tools/quickbook_backend/detail

Modified Files:
      Tag: QUICKBOOK_BACKEND
        actions.cpp actions.hpp actions_class.cpp actions_class.hpp 
        utils.hpp 
Log Message:
Anchors, as templates.

Index: actions.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.cpp,v
retrieving revision 1.49.2.6
retrieving revision 1.49.2.7
diff -u -d -r1.49.2.6 -r1.49.2.7
--- actions.cpp 10 Jul 2007 03:50:48 -0000      1.49.2.6
+++ actions.cpp 11 Jul 2007 04:55:13 -0000      1.49.2.7
@@ -265,12 +265,16 @@
         out << '#'; // print out an unexpected character
     }
 
-    void anchor_action::operator()(iterator first, iterator last) const
+    void string_action::operator()(iterator first, iterator last) const
     {
-        out << "<anchor id=\"";
-        while (first != last)
-            detail::print_char(*first++, out.get());
-        out << "\" />\n";
+        std::string str = pop_phrase();
+        str = detail::make_string(str.begin(),str.end());
+        
+        backend_action::operator()(boost::assign::list_of
+            (str)
+            );
+        
+        out_phrase();
     }
 
     void do_macro_action::operator()(std::string const& str) const

Index: actions.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.hpp,v
retrieving revision 1.36.2.5
retrieving revision 1.36.2.6
diff -u -d -r1.36.2.5 -r1.36.2.6
--- actions.hpp 10 Jul 2007 03:50:49 -0000      1.36.2.5
+++ actions.hpp 11 Jul 2007 04:55:13 -0000      1.36.2.6
@@ -152,18 +152,6 @@
         collector& out;
     };
 
-    struct anchor_action
-    {
-        // Handles anchors
-
-        anchor_action(collector& out)
-            : out(out) {}
-
-        void operator()(iterator first, iterator last) const;
-
-        collector& out;
-    };
-
     namespace
     {
         char const* quickbook_get_date = "__quickbook_get_date__";
@@ -766,6 +754,21 @@
 
         void operator()(iterator first, iterator last) const;
     };
+
+    struct string_action : backend_action
+    {
+        //  anchor, or anything that passes the recoded string to the template
+
+        string_action(
+            std::string const & action_name,
+            quickbook::actions & actions
+            )
+            : backend_action(action_name,actions)
+        {
+        }
+
+        void operator()(iterator first, iterator last) const;
+    };
 }
 
 #endif // BOOST_SPIRIT_QUICKBOOK_ACTIONS_HPP

Index: actions_class.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.cpp,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -u -d -r1.9.2.5 -r1.9.2.6
--- actions_class.cpp   10 Jul 2007 03:50:49 -0000      1.9.2.5
+++ actions_class.cpp   11 Jul 2007 04:55:13 -0000      1.9.2.6
@@ -166,7 +166,7 @@
         , end_row(phrase, end_row_)
         , start_cell(phrase, table_span)
         , end_cell(phrase, temp_para)
-        , anchor(out)
+        , anchor("anchor",*this)
 
         , begin_section(out, phrase, doc_id, section_id, section_level, 
qualified_section_id)
         , end_section(out, section_level, qualified_section_id)

Index: actions_class.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.hpp,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -u -d -r1.9.2.5 -r1.9.2.6
--- actions_class.hpp   10 Jul 2007 03:50:49 -0000      1.9.2.5
+++ actions_class.hpp   11 Jul 2007 04:55:13 -0000      1.9.2.6
@@ -189,7 +189,7 @@
         markup_action           end_row;
         start_col_action        start_cell;
         end_col_action          end_cell;
-        anchor_action           anchor;
+        string_action           anchor;
 
         begin_section_action    begin_section;
         end_section_action      end_section;

Index: utils.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/utils.hpp,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- utils.hpp   21 Feb 2007 00:48:28 -0000      1.9
+++ utils.hpp   11 Jul 2007 04:55:13 -0000      1.9.2.1
@@ -80,6 +80,29 @@
     };
 
     file_type get_file_type(std::string const& extension);
+
+    template <typename Iterator>
+    inline std::string
+    make_string(Iterator const& first, Iterator const& last)
+    {
+        std::string out;
+        for (Iterator i = first; i != last; ++i)
+        {
+            switch (*i)
+            {
+                case '<': out += "&lt;";    break;
+                case '>': out += "&gt;";    break;
+                case '&': out += "&amp;";   break;
+                case '"': out += "&quot;";  break;
+                //~ case '[': out += "&#91;";   break;
+                //~ case ']': out += "&#93;";   break;
+                default:  out += *i;        break;
+                // note &apos; is not included. see the curse of apos:
+                // http://fishbowl.pastiche.org/2003/07/01/the_curse_of_apos
+            }
+        }
+        return out;
+    }
 }}
 
 #endif // BOOST_SPIRIT_QUICKBOOK_UTILS_HPP


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to