diff --git a/detail/actions.hpp b/detail/actions.hpp index 589f2c1..844f04d 100755 --- a/detail/actions.hpp +++ b/detail/actions.hpp @@ -936,9 +936,10 @@ namespace quickbook void operator()(Iterator first, Iterator last) const { std::string filein(first, last); - std::string doc_id, doc_dirname, doc_last_revision; + std::string doc_type, doc_id, doc_dirname, doc_last_revision; // save the doc info strings + actions.doc_type.swap(doc_type); actions.doc_id.swap(doc_id); actions.doc_dirname.swap(doc_dirname); actions.doc_last_revision.swap(doc_last_revision); @@ -946,6 +947,14 @@ namespace quickbook // scope the macros macros_type macro = actions.macro; + // if an id is specified in this include (in in [include:id foo.qbk] + // then use it as the doc_id. + if(!actions.include_doc_id.empty()) + { + actions.doc_id = actions.include_doc_id; + actions.include_doc_id.clear(); + } + // update the __FILENAME__ macro *boost::spirit::find(actions.macro, "__FILENAME__") = filein; @@ -953,6 +962,7 @@ namespace quickbook quickbook::parse(filein.c_str(), actions, true); // restore the values + actions.doc_type.swap(doc_type); actions.doc_id.swap(doc_id); actions.doc_dirname.swap(doc_dirname); actions.doc_last_revision.swap(doc_last_revision); diff --git a/detail/quickbook.cpp b/detail/quickbook.cpp index 5ba32f8..26b18b4 100755 --- a/detail/quickbook.cpp +++ b/detail/quickbook.cpp @@ -149,6 +149,7 @@ namespace quickbook author_list doc_authors; std::string doc_license; std::string doc_last_revision; + std::string include_doc_id; std::string page_title; std::string section_id; diff --git a/quickbook.hpp b/quickbook.hpp index 37fcbc5..fbb8994 100755 --- a/quickbook.hpp +++ b/quickbook.hpp @@ -247,6 +247,12 @@ namespace quickbook include = "include" >> hard_space + >> + !( + ':' + >> (*((alnum_p | '_') - space_p))[assign_a(self.actions.include_doc_id)] + >> space + ) >> (*(anychar_p - close_bracket)) [self.actions.include] ;