Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53022 - in trunk/tools/quickbook: . detail
From: daniel_james_at_[hidden]
Date: 2009-05-15 02:13:35


Author: danieljames
Date: 2009-05-15 02:13:34 EDT (Fri, 15 May 2009)
New Revision: 53022
URL: http://svn.boost.org/trac/boost/changeset/53022

Log:
Make code_snippet_action language ignorant.
Text files modified:
   trunk/tools/quickbook/code_snippet.hpp | 6 +++---
   trunk/tools/quickbook/detail/actions.cpp | 6 +++---
   2 files changed, 6 insertions(+), 6 deletions(-)

Modified: trunk/tools/quickbook/code_snippet.hpp
==============================================================================
--- trunk/tools/quickbook/code_snippet.hpp (original)
+++ trunk/tools/quickbook/code_snippet.hpp 2009-05-15 02:13:34 EDT (Fri, 15 May 2009)
@@ -19,10 +19,10 @@
     {
         code_snippet_actions(std::vector<template_symbol>& storage,
                                  std::string const& doc_id,
- bool is_python)
+ char const* source_type)
             : storage(storage)
             , doc_id(doc_id)
- , is_python(is_python)
+ , source_type(source_type)
         {}
 
         void pass_thru(iterator first, iterator last);
@@ -38,7 +38,7 @@
         std::vector<std::string> callouts;
         std::vector<template_symbol>& storage;
         std::string const doc_id;
- bool const is_python;
+ char const* const source_type;
     };
 
     struct python_code_snippet_grammar

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2009-05-15 02:13:34 EDT (Fri, 15 May 2009)
@@ -1011,7 +1011,7 @@
             if (code.size() != 0)
             {
                 snippet += "\n\n";
- snippet += is_python ? "[python]" : "[c++]";
+ snippet += source_type;
                 snippet += "``\n" + code + "``\n\n";
                 code.clear();
             }
@@ -1033,7 +1033,7 @@
             if (code.size() != 0)
             {
                 snippet += "\n\n";
- snippet += is_python ? "[python]" : "[c++]";
+ snippet += source_type;
                 snippet += "```\n" + code + "```\n\n";
             }
 
@@ -1088,7 +1088,7 @@
         size_t fname_len = file.size();
         bool is_python = fname_len >= 3
             && file[--fname_len]=='y' && file[--fname_len]=='p' && file[--fname_len]=='.';
- code_snippet_actions a(storage, doc_id, is_python);
+ code_snippet_actions a(storage, doc_id, is_python ? "[python]" : "[c++]");
         // TODO: Should I check that parse succeeded?
         if(is_python) {
             boost::spirit::classic::parse(first, last, python_code_snippet_grammar(a));


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