Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70960 - in branches/quickbook-dev/tools/quickbook: src test test/include
From: dnljms_at_[hidden]
Date: 2011-04-03 15:19:09


Author: danieljames
Date: 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
New Revision: 70960
URL: http://svn.boost.org/trac/boost/changeset/70960

Log:
Quickbook: Include code file in 1.6.
Added:
   branches/quickbook-dev/tools/quickbook/test/include/code-import.gold (contents, props changed)
      - copied, changed from r70959, /branches/quickbook-dev/tools/quickbook/test/import.gold
   branches/quickbook-dev/tools/quickbook/test/include/code-import.quickbook (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/include/code-include.gold (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/include/code-include.quickbook (contents, props changed)
Removed:
   branches/quickbook-dev/tools/quickbook/test/import.gold
   branches/quickbook-dev/tools/quickbook/test/import.quickbook
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/actions.cpp | 244 ++++++++++++++++++++++-----------------
   branches/quickbook-dev/tools/quickbook/src/actions.hpp | 3
   branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp | 18 ++
   branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 | 1
   branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2 | 2
   5 files changed, 158 insertions(+), 110 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.cpp 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -78,7 +78,7 @@
     void variable_list_action(quickbook::actions&, value);
     void table_action(quickbook::actions&, value);
     void xinclude_action(quickbook::actions&, value);
- void include_action(quickbook::actions&, value);
+ void include_action(quickbook::actions&, value, file_position);
     void image_action(quickbook::actions&, value);
     void anchor_action(quickbook::actions&, value);
     void link_action(quickbook::actions&, value);
@@ -136,7 +136,7 @@
             return xinclude_action(actions, v);
         case block_tags::import:
         case block_tags::include:
- return include_action(actions, v);
+ return include_action(actions, v, first.get_position());
         case phrase_tags::image:
             return image_action(actions, v);
         case phrase_tags::anchor:
@@ -1063,7 +1063,7 @@
 
         std::pair<bool, std::vector<std::string>::const_iterator>
         get_arguments(
- std::vector<template_body>& args
+ std::vector<template_body> const& args
           , std::vector<std::string> const& params
           , template_scope const& scope
           , file_position const& pos
@@ -1074,7 +1074,6 @@
             std::vector<std::string>::const_iterator tpl = params.begin();
             std::vector<std::string> empty_params;
 
-
             // Store each of the argument passed in as local templates:
             while (arg != args.end())
             {
@@ -1132,28 +1131,11 @@
         int callout_id = 0;
     }
 
- void do_template_action(quickbook::actions& actions, value template_list,
+ void call_template(quickbook::actions& actions, bool template_escape,
+ template_symbol const* symbol,
+ std::vector<template_body> const& args,
             file_position pos)
     {
- if(!(actions.process_state & actions.process_output)) return;
-
- // Get the arguments
- value_consumer values = template_list;
-
- bool template_escape = values.check(template_tags::escape);
- if(template_escape) values.consume();
-
- std::string identifier = values.consume(template_tags::identifier).get_quickbook();
-
- std::vector<template_body> args;
-
- BOOST_FOREACH(value arg, values)
- {
- args.push_back(template_body(arg, actions.filename));
- }
-
- values.finish();
-
         ++actions.template_depth;
         if (actions.template_depth > actions.max_template_depth)
         {
@@ -1171,15 +1153,12 @@
         // arguments are expanded.
         template_scope const& call_scope = actions.templates.top_scope();
 
- template_symbol const* symbol = actions.templates.find(identifier);
- BOOST_ASSERT(symbol);
-
         std::string block;
         std::string phrase;
 
         {
             template_state state(actions);
-
+
             // Store the current section level so that we can ensure that
             // [section] and [endsect] tags in the template are balanced.
             actions.min_section_level = actions.section_level;
@@ -1192,64 +1171,17 @@
                 actions.templates.set_parent_scope(*symbol->parent);
 
             ///////////////////////////////////
- // Initialise the arguments
-
- if (!symbol->callouts.check())
- {
- // Break the arguments for a template
-
- if (!break_arguments(args, symbol->params, actions.filename, pos))
- {
- --actions.template_depth;
- ++actions.error_count;
- return;
- }
- }
- else
- {
- if (!args.empty())
- {
- detail::outerr(actions.filename, pos.line)
- << "Arguments for code snippet."
- <<std::endl;
- ++actions.error_count;
-
- args.clear();
- }
-
- unsigned int size = symbol->params.size();
-
- for(unsigned int i = 0; i < size; ++i)
- {
- std::string callout_id = actions.doc_id +
- boost::lexical_cast<std::string>(detail::callout_id + i);
-
- std::string code;
- code += "'''";
- code += "<co id=\"" + callout_id + "co\" ";
- code += "linkends=\"" + callout_id + "\" />";
- code += "'''";
-
- args.push_back(template_body(
- qbk_value(code, pos, template_tags::phrase),
- actions.filename));
- }
- }
-
- ///////////////////////////////////
             // Prepare the arguments as local templates
             bool get_arg_result;
             std::vector<std::string>::const_iterator tpl;
             boost::tie(get_arg_result, tpl) =
- get_arguments(args, symbol->params,
- call_scope, pos, actions);
+ get_arguments(args, symbol->params, call_scope, pos, actions);
 
             if (!get_arg_result)
             {
                 --actions.template_depth;
                 return;
             }
-
             ///////////////////////////////////
             // parse the template body:
 
@@ -1272,7 +1204,9 @@
             if (actions.section_level != actions.min_section_level)
             {
                 detail::outerr(actions.filename, pos.line)
- << "Mismatched sections in template " << detail::utf8(identifier) << std::endl;
+ << "Mismatched sections in template "
+ << detail::utf8(symbol->identifier)
+ << std::endl;
                 --actions.template_depth;
                 ++actions.error_count;
                 return;
@@ -1282,21 +1216,64 @@
             actions.phrase.swap(phrase);
         }
 
+ if(symbol->body.is_block() || !block.empty()) {
+ actions.paragraph(); // For paragraphs before the template call.
+ actions.out << block;
+ actions.phrase << phrase;
+ }
+ else {
+ actions.phrase << phrase;
+ }
+ --actions.template_depth;
+ }
+
+ void call_code_snippet(quickbook::actions& actions,
+ bool template_escape,
+ template_symbol const* symbol,
+ file_position pos)
+ {
+ assert(symbol->body.is_block());
+
+ std::vector<template_body> args;
+ unsigned int size = symbol->params.size();
+
+ for(unsigned int i = 0; i < size; ++i)
+ {
+ std::string callout_id = actions.doc_id +
+ boost::lexical_cast<std::string>(detail::callout_id + i);
+
+ std::string code;
+ code += "'''";
+ code += "<co id=\"" + callout_id + "co\" ";
+ code += "linkends=\"" + callout_id + "\" />";
+ code += "'''";
+
+ args.push_back(template_body(
+ qbk_value(code, pos, template_tags::phrase),
+ actions.filename));
+ }
+
+ call_template(actions, template_escape, symbol, args, pos);
+
+ std::string block;
+
         if(!symbol->callouts.empty())
         {
- BOOST_ASSERT(phrase.empty());
+ template_state state(actions);
+ ++actions.template_depth;
+
             block += "<calloutlist>";
             BOOST_FOREACH(value c, symbol->callouts)
             {
                 std::string callout_id = actions.doc_id +
                     boost::lexical_cast<std::string>(detail::callout_id++);
-
+
                 std::string callout_value;
                 {
                     template_state state(actions);
                     bool r = parse_template(
                         template_body(c, symbol->body.filename), false, actions);
-
+
                     if(!r)
                     {
                         detail::outerr(symbol->body.filename, c.get_position().line)
@@ -1307,9 +1284,10 @@
                             << "------------------end--------------------" << std::endl
                             ;
                         ++actions.error_count;
+ --actions.template_depth;
                         return;
                     }
-
+
                     actions.out.swap(callout_value);
                 }
                 
@@ -1319,17 +1297,67 @@
                 block += "</callout>";
             }
             block += "</calloutlist>";
+
+ --actions.template_depth;
         }
 
- if(symbol->body.is_block() || !block.empty()) {
- actions.paragraph(); // For paragraphs before the template call.
- actions.out << block;
- actions.phrase << phrase;
+ actions.out << block;
+ }
+
+ void do_template_action(quickbook::actions& actions, value template_list,
+ file_position pos)
+ {
+ if(!(actions.process_state & actions.process_output)) return;
+
+ // Get the arguments
+ value_consumer values = template_list;
+
+ bool template_escape = values.check(template_tags::escape);
+ if(template_escape) values.consume();
+
+ std::string identifier = values.consume(template_tags::identifier).get_quickbook();
+
+ std::vector<template_body> args;
+
+ BOOST_FOREACH(value arg, values)
+ {
+ args.push_back(template_body(arg, actions.filename));
         }
- else {
- actions.phrase << phrase;
+
+ values.finish();
+
+ template_symbol const* symbol = actions.templates.find(identifier);
+ BOOST_ASSERT(symbol);
+
+ ///////////////////////////////////
+ // Initialise the arguments
+
+ if (!symbol->callouts.check())
+ {
+ // Break the arguments for a template
+
+ if (!break_arguments(args, symbol->params, actions.filename, pos))
+ {
+ ++actions.error_count;
+ return;
+ }
+
+ call_template(actions, template_escape, symbol, args, pos);
         }
- --actions.template_depth;
+ else
+ {
+ if (!args.empty())
+ {
+ detail::outerr(actions.filename, pos.line)
+ << "Arguments for code snippet."
+ <<std::endl;
+ ++actions.error_count;
+
+ args.clear();
+ }
+
+ call_code_snippet(actions, template_escape, symbol, pos);
+ }
     }
 
     void link_action(quickbook::actions& actions, value link)
@@ -1794,38 +1822,40 @@
     void load_source_file(quickbook::actions& actions,
             include_search_return const& paths,
             value::tag_type load_type,
+ file_position pos,
             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 = paths.filename.extension().generic_string();
         std::vector<template_symbol> storage;
         actions.error_count +=
- load_snippets(paths.filename.string(), storage, ext);
+ load_snippets(paths.filename.string(), storage, ext, load_type);
 
- BOOST_FOREACH(template_symbol& ts, storage)
+ if (load_type == block_tags::import)
         {
- std::string tname = ts.identifier;
- ts.parent = &actions.templates.top_scope();
- if (!actions.templates.add(ts))
+ BOOST_FOREACH(template_symbol& ts, storage)
             {
- detail::outerr(ts.body.filename, ts.body.content.get_position().line)
- << "Template Redefinition: " << detail::utf8(tname) << std::endl;
- ++actions.error_count;
+ std::string tname = ts.identifier;
+ ts.parent = &actions.templates.top_scope();
+ if (!actions.templates.add(ts))
+ {
+ detail::outerr(ts.body.filename, ts.body.content.get_position().line)
+ << "Template Redefinition: " << detail::utf8(tname) << std::endl;
+ ++actions.error_count;
+ }
             }
         }
+ else
+ {
+ template_symbol* snippet = &storage.back();
+ snippet->parent = &actions.templates.top_scope();
+ call_code_snippet(actions, false, snippet, pos);
+ }
     }
 
- void include_action(quickbook::actions& actions, value include)
+ void include_action(quickbook::actions& actions, value include, file_position pos)
     {
         if (!(actions.process_state & actions.process_output)) return;
         write_anchors(actions, actions.out);
@@ -1846,7 +1876,7 @@
             }
             else
             {
- load_source_file(actions, paths, include.get_tag(), include_doc_id);
+ load_source_file(actions, paths, include.get_tag(), pos, include_doc_id);
             }
         }
         else
@@ -1857,7 +1887,7 @@
             }
             else
             {
- load_source_file(actions, paths, include.get_tag(), include_doc_id);
+ load_source_file(actions, paths, include.get_tag(), pos, include_doc_id);
             }
         }
     }

Modified: branches/quickbook-dev/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.hpp 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -53,7 +53,8 @@
     }
 
     int load_snippets(std::string const& file, std::vector<template_symbol>& storage,
- std::string const& extension);
+ std::string const& extension, value::tag_type load_type);
+
     std::string syntax_highlight(
         iterator first, iterator last,
         actions& escape_actions,

Modified: branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -13,6 +13,7 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/bind.hpp>
 #include <boost/lexical_cast.hpp>
+#include "block_tags.hpp"
 #include "template_stack.hpp"
 #include "actions.hpp"
 #include "values.hpp"
@@ -312,8 +313,12 @@
         std::string const& file
       , std::vector<template_symbol>& storage // snippets are stored in a
                                                 // vector of template_symbols
- , std::string const& extension)
+ , std::string const& extension
+ , value::tag_type load_type)
     {
+ assert(load_type == block_tags::include ||
+ load_type == block_tags::import);
+
         std::string code;
         int err = detail::load(file, code);
         if (err != 0)
@@ -325,6 +330,13 @@
         bool is_python = extension == ".py";
         code_snippet_actions a(storage, file, is_python ? "[python]" : "[c++]");
         // TODO: Should I check that parse succeeded?
+
+ if (load_type == block_tags::include) {
+ // Use an id that couldn't occur normally.
+ a.id = "global tag";
+ a.start_snippet(first, first);
+ }
+
         if(is_python) {
             boost::spirit::classic::parse(first, last, python_code_snippet_grammar(a));
         }
@@ -332,6 +344,10 @@
             boost::spirit::classic::parse(first, last, cpp_code_snippet_grammar(a));
         }
 
+ if (load_type == block_tags::include) {
+ a.end_snippet(first, first);
+ }
+
         return 0;
     }
 

Modified: branches/quickbook-dev/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -38,7 +38,6 @@
     [ quickbook-test mismatched-brackets-2 ]
     [ quickbook-error-test mismatched-brackets-3 ]
     [ quickbook-test xinclude : : : <quickbook-xinclude-base>../src ]
- [ quickbook-test import ]
     [ quickbook-test include_1_5 ]
     [ quickbook-test include_1_6 ]
     [ quickbook-test include_1_6-2 ]

Deleted: branches/quickbook-dev/tools/quickbook/test/import.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/import.gold 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
+++ (empty file)
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<article id="import" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Import</title>
- <para>
- This is the <emphasis role="bold"><emphasis>foo</emphasis></emphasis> function.
- </para>
- <para>
- This description can have paragraphs...
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- lists
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- etc.
- </simpara>
- </listitem>
- </itemizedlist>
- <para>
- And any quickbook block markup.
- </para>
- <para>
-
-<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
-<phrase role="special">{</phrase>
- <phrase role="comment">// return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
-<phrase role="special">}</phrase>
-</programlisting>
- </para>
- <para>
- This is the Python <emphasis role="bold"><emphasis>foo</emphasis></emphasis>
- function.
- </para>
- <para>
- This description can have paragraphs...
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- lists
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- etc.
- </simpara>
- </listitem>
- </itemizedlist>
- <para>
- And any quickbook block markup.
- </para>
- <para>
-
-<programlisting><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase role="special">():</phrase>
- <phrase role="comment"># return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase>
-
-</programlisting>
- </para>
- <para>
- This is the C <emphasis role="bold"><emphasis>foo</emphasis></emphasis> function.
- </para>
- <para>
- This description can have paragraphs...
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- lists
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- etc.
- </simpara>
- </listitem>
- </itemizedlist>
- <para>
- And any quickbook block markup.
- </para>
- <para>
-
-<programlisting><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
-<phrase role="special">{</phrase>
- <phrase role="comment">// return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
-<phrase role="special">}</phrase>
-</programlisting>
- </para>
-</article>

Deleted: branches/quickbook-dev/tools/quickbook/test/import.quickbook
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/import.quickbook 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-[article Import]
-
-[import stub.c]
-[import stub.py]
-[import stub.cpp]
-
-[foo]
-
-[foo_py]
-
-[foo_c]
-

Modified: branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -24,6 +24,8 @@
     [ quickbook-test templates-1.6 ]
     [ quickbook-test macros-1.5 ]
     [ quickbook-test macros-1.6 ]
+ [ quickbook-test code-import ]
+ [ quickbook-test code-include ]
     [ quickbook-error-test section-fail1 ]
     [ quickbook-error-test section-fail2 ]
     ;

Copied: branches/quickbook-dev/tools/quickbook/test/include/code-import.gold (from r70959, /branches/quickbook-dev/tools/quickbook/test/import.gold)
==============================================================================

Added: branches/quickbook-dev/tools/quickbook/test/include/code-import.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/include/code-import.quickbook 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -0,0 +1,12 @@
+[article Import]
+
+[import ../stub.c]
+[import ../stub.py]
+[import ../stub.cpp]
+
+[foo]
+
+[foo_py]
+
+[foo_c]
+

Added: branches/quickbook-dev/tools/quickbook/test/include/code-include.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/include/code-include.gold 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Include</title>
+ <para>
+
+<programlisting><phrase role="comment">/*=============================================================================
+ Copyright (c) 2006 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/</phrase>
+
+</programlisting>
+ </para>
+ <para>
+ This is the C <emphasis role="bold"><emphasis>foo</emphasis></emphasis> function.
+ </para>
+ <para>
+ This description can have paragraphs...
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ lists
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ etc.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para>
+ And any quickbook block markup.
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
+<phrase role="special">{</phrase>
+ <phrase role="comment">// return 'em, foo man!
+</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
+<phrase role="special">}</phrase>
+</programlisting>
+ </para>
+ <para>
+
+<programlisting><phrase role="comment"># Copyright 2009 Daniel James
+</phrase><phrase role="comment">#
+</phrase><phrase role="comment"># Use, modification and distribution is subject to the Boost Software
+</phrase><phrase role="comment"># License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+</phrase><phrase role="comment"># http://www.boost.org/LICENSE_1_0.txt)
+</phrase>
+</programlisting>
+ </para>
+ <para>
+ This is the Python <emphasis role="bold"><emphasis>foo</emphasis></emphasis>
+ function.
+ </para>
+ <para>
+ This description can have paragraphs...
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ lists
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ etc.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para>
+ And any quickbook block markup.
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase role="special">():</phrase>
+ <phrase role="comment"># return 'em, foo man!
+</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase>
+
+<phrase role="keyword">print</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase></programlisting>
+ </para>
+ <para>
+
+<programlisting><phrase role="comment">/*=============================================================================
+ Copyright (c) 2006 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/</phrase>
+<phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">string</phrase><phrase role="special">&gt;</phrase>
+
+</programlisting>
+ </para>
+ <para>
+ This is the <emphasis role="bold"><emphasis>bar</emphasis></emphasis> function
+ </para>
+ <para>
+
+<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">bar</phrase><phrase role="special">()</phrase>
+<phrase role="special">{</phrase>
+ <phrase role="comment">// return 'em, bar man!
+</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;bar&quot;</phrase><phrase role="special">;</phrase>
+<phrase role="special">}</phrase></programlisting>
+ </para>
+ <para>
+ Some trailing text here
+ </para>
+ <para>
+ This is the <emphasis role="bold"><emphasis>foo</emphasis></emphasis> function.
+ </para>
+ <para>
+ This description can have paragraphs...
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ lists
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ etc.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para>
+ And any quickbook block markup.
+ </para>
+ <para>
+
+<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
+<phrase role="special">{</phrase>
+ <phrase role="comment">// return 'em, foo man!
+</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
+<phrase role="special">}</phrase>
+<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo_bar</phrase><phrase role="special">()</phrase> <!--quickbook-escape-prefix--><co id="include0co" linkends="include0" /><!--quickbook-escape-postfix-->
+<phrase role="special">{</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo-bar&quot;</phrase><phrase role="special">;</phrase> <!--quickbook-escape-prefix--><co id="include1co" linkends="include1" /><!--quickbook-escape-postfix-->
+<phrase role="special">}</phrase>
+<phrase role="keyword">class</phrase> <phrase role="identifier">x</phrase>
+<phrase role="special">{</phrase>
+<phrase role="keyword">public</phrase><phrase role="special">:</phrase>
+
+ <!--quickbook-escape-prefix--><co id="include2co" linkends="include2" /><!--quickbook-escape-postfix--><phrase role="identifier">x</phrase><phrase role="special">()</phrase> <phrase role="special">:</phrase> <phrase role="identifier">n</phrase><phrase role="special">(</phrase><phrase role="number">0</phrase><phrase role="special">)</phrase>
+ <phrase role="special">{</phrase>
+ <phrase role="special">}</phrase>
+
+ <!--quickbook-escape-prefix--><co id="include3co" linkends="include3" /><!--quickbook-escape-postfix--><phrase role="special">~</phrase><phrase role="identifier">x</phrase><phrase role="special">()</phrase>
+ <phrase role="special">{</phrase>
+ <phrase role="special">}</phrase>
+
+ <!--quickbook-escape-prefix--><co id="include4co" linkends="include4" /><!--quickbook-escape-postfix--><phrase role="keyword">int</phrase> <phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase>
+ <phrase role="special">{</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="identifier">n</phrase><phrase role="special">;</phrase>
+ <phrase role="special">}</phrase>
+
+ <!--quickbook-escape-prefix--><co id="include5co" linkends="include5" /><!--quickbook-escape-postfix--><phrase role="keyword">void</phrase> <phrase role="identifier">set</phrase><phrase role="special">(</phrase><phrase role="keyword">int</phrase> <phrase role="identifier">n_</phrase><phrase role="special">)</phrase>
+ <phrase role="special">{</phrase>
+ <phrase role="identifier">n</phrase> <phrase role="special">=</phrase> <phrase role="identifier">n_</phrase><phrase role="special">;</phrase>
+ <phrase role="special">}</phrase>
+<phrase role="special">};</phrase>
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="include0co" id="include0">
+ <para>
+ The <emphasis>Mythical</emphasis> FooBar. See <ulink url="http://en.wikipedia.org/wiki/Foobar">Foobar
+ for details</ulink>
+ </para>
+ </callout>
+ <callout arearefs="include1co" id="include1">
+ <para>
+ return 'em, foo-bar man!
+ </para>
+ </callout>
+ <callout arearefs="include2co" id="include2">
+ <para>
+ Constructor
+ </para>
+ </callout>
+ <callout arearefs="include3co" id="include3">
+ <para>
+ Destructor
+ </para>
+ </callout>
+ <callout arearefs="include4co" id="include4">
+ <para>
+ Get the <code><phrase role="identifier">n</phrase></code> member variable
+ </para>
+ </callout>
+ <callout arearefs="include5co" id="include5">
+ <para>
+ Set the <code><phrase role="identifier">n</phrase></code> member variable
+ </para>
+ </callout>
+ </calloutlist>
+ <para>
+ [foo]
+ </para>
+ <para>
+ [foo_py]
+ </para>
+ <para>
+ [foo_c]
+ </para>
+</article>

Added: branches/quickbook-dev/tools/quickbook/test/include/code-include.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/include/code-include.quickbook 2011-04-03 15:19:07 EDT (Sun, 03 Apr 2011)
@@ -0,0 +1,16 @@
+[article Include
+[quickbook 1.6]
+]
+
+[include ../stub.c]
+[include ../stub.py]
+[include ../stub.cpp]
+
+[/ These shouldn't expand ]
+
+[foo]
+
+[foo_py]
+
+[foo_c]
+


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