Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70030 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-03-16 17:41:09


Author: danieljames
Date: 2011-03-16 17:41:08 EDT (Wed, 16 Mar 2011)
New Revision: 70030
URL: http://svn.boost.org/trac/boost/changeset/70030

Log:
Single action for import/include.
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 53 +++++++++++++++++++++++++++------------
   1 files changed, 36 insertions(+), 17 deletions(-)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.cpp 2011-03-16 17:41:08 EDT (Wed, 16 Mar 2011)
@@ -60,7 +60,6 @@
     void variable_list_action(quickbook::actions&, value);
     void table_action(quickbook::actions&, value);
     void xinclude_action(quickbook::actions&, value);
- void import_action(quickbook::actions&, value);
     void include_action(quickbook::actions&, value);
     void image_action(quickbook::actions&, value);
     void anchor_action(quickbook::actions&, value);
@@ -114,7 +113,6 @@
         case block_tags::xinclude:
             return xinclude_action(actions, v);
         case block_tags::import:
- return import_action(actions, v);
         case block_tags::include:
             return include_action(actions, v);
         case phrase_tags::image:
@@ -1595,8 +1593,20 @@
     }
 
     void load_quickbook(quickbook::actions& actions, fs::path const& filein,
+ value::tag_type load_type,
             value const& include_doc_id = value())
     {
+ assert(load_type == block_tags::include ||
+ load_type == block_tags::import);
+
+ if (load_type == block_tags::import)
+ {
+ detail::outerr(actions.filename)
+ << "Quickbook import not implemented yet.\n";
+ ++actions.error_count;
+ return;
+ }
+
         std::string doc_type, doc_id;
 
         // swap the filenames
@@ -1660,8 +1670,21 @@
         //~ actions.templates = templates; $$$ fixme $$$
     }
 
- void load_source_file(quickbook::actions& actions, fs::path const& path)
+ void load_source_file(quickbook::actions& actions, fs::path const& path,
+ value::tag_type load_type,
+ value const& include_doc_id = value())
     {
+ assert(load_type == block_tags::include ||
+ load_type == block_tags::import);
+
+ if (load_type == block_tags::include)
+ {
+ detail::outerr(actions.filename)
+ << "Source include not implemented yet.\n";
+ ++actions.error_count;
+ return;
+ }
+
         std::string ext = path.extension().generic_string();
         std::vector<template_symbol> storage;
         actions.error_count +=
@@ -1680,18 +1703,6 @@
         }
     }
 
- void import_action(quickbook::actions& actions, value import)
- {
- if(!actions.output_pre(actions.out)) return;
-
- value_consumer values = import;
- fs::path path = include_search(actions.filename.parent_path(),
- check_path(values.consume(), actions));
- values.finish();
-
- load_source_file(actions, path);
- }
-
     void include_action(quickbook::actions& actions, value include)
     {
         if(!actions.output_pre(actions.out)) return;
@@ -1701,8 +1712,16 @@
         fs::path filein = include_search(actions.filename.parent_path(),
             check_path(values.consume(), actions));
         values.finish();
-
- load_quickbook(actions, filein, include_doc_id);
+
+ std::string ext = filein.extension().generic_string();
+ if (ext == ".qbk" || ext == ".quickbook")
+ {
+ load_quickbook(actions, filein, include.get_tag(), include_doc_id);
+ }
+ else
+ {
+ load_source_file(actions, filein, include.get_tag(), include_doc_id);
+ }
     }
 
     void phrase_to_docinfo_action_impl::operator()(iterator first, iterator last,


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