[include] has optional :doc_id argument, fix doc_type include bug

[SVN r29175]
This commit is contained in:
Eric Niebler
2005-05-24 18:31:05 +00:00
parent 834cdedf63
commit bb146bf5f0
3 changed files with 18 additions and 1 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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]
;