Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65156 - in branches/quickbook-1.5-spirit2: . doc test
From: dnljms_at_[hidden]
Date: 2010-08-31 16:03:10


Author: danieljames
Date: 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
New Revision: 65156
URL: http://svn.boost.org/trac/boost/changeset/65156

Log:
Merge some of the docinfo work from trunk.
Properties modified:
   branches/quickbook-1.5-spirit2/ (props changed)
Text files modified:
   branches/quickbook-1.5-spirit2/block_actions.cpp | 15 ++--
   branches/quickbook-1.5-spirit2/boostbook.cpp | 32 +++++-----
   branches/quickbook-1.5-spirit2/code_snippet_types.hpp | 4
   branches/quickbook-1.5-spirit2/doc/quickbook.qbk | 4 +
   branches/quickbook-1.5-spirit2/doc_info.hpp | 48 ++++++++++----
   branches/quickbook-1.5-spirit2/doc_info_actions.cpp | 64 +++++++++-----------
   branches/quickbook-1.5-spirit2/doc_info_grammar.cpp | 124 +++++++++++++++++++++++++++------------
   branches/quickbook-1.5-spirit2/encoder_impl.hpp | 24 -------
   branches/quickbook-1.5-spirit2/grammar_impl.hpp | 1
   branches/quickbook-1.5-spirit2/html.cpp | 17 ++--
   branches/quickbook-1.5-spirit2/phrase_grammar.cpp | 5
   branches/quickbook-1.5-spirit2/state.hpp | 5
   branches/quickbook-1.5-spirit2/template.cpp | 4
   branches/quickbook-1.5-spirit2/test/doc-info-1.gold | 11 ++-
   branches/quickbook-1.5-spirit2/test/doc-info-1.quickbook | 7 +
   branches/quickbook-1.5-spirit2/test/doc-info-2.gold | 14 ++-
   branches/quickbook-1.5-spirit2/test/doc-info-2.quickbook | 5
   branches/quickbook-1.5-spirit2/test/xml-escape_1_2.gold | 11 ++
   branches/quickbook-1.5-spirit2/test/xml-escape_1_2.quickbook | 5
   branches/quickbook-1.5-spirit2/test/xml-escape_1_5.gold | 13 ++-
   branches/quickbook-1.5-spirit2/test/xml-escape_1_5.quickbook | 3
   21 files changed, 237 insertions(+), 179 deletions(-)

Modified: branches/quickbook-1.5-spirit2/block_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_actions.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -23,12 +23,13 @@
 namespace quickbook
 {
     namespace {
- raw_string fully_qualified_id(raw_string const& library_id,
+ raw_string fully_qualified_id(
+ std::string const& library_id,
             raw_string const& qualified_section_id,
             raw_string const& section_id)
         {
             raw_string id;
- id.value = library_id.value;
+ id.value = library_id;
             if(!id.empty() && !qualified_section_id.empty()) id.value += '.';
             id.value += qualified_section_id.value;
             if(!id.empty() && !section_id.empty()) id.value += '.';
@@ -80,12 +81,12 @@
 
         if (qbk_version_n < 103) // version 1.2 and below
         {
- r.id.value = state.doc_id.value + "." + state.section_id.value;
+ r.id.value = state.doc_id + "." + state.section_id.value;
         }
         else // version 1.3 and above
         {
             r.linkend.value = r.id.value =
- state.doc_id.value + "." + state.qualified_section_id.value;
+ state.doc_id + "." + state.qualified_section_id.value;
         }
         
         r.content = x.content.content;
@@ -237,7 +238,7 @@
           , std::vector<define_template>& storage // for storing snippets are stored in a
                                                     // vector of define_templates
           , std::string const& extension
- , raw_string const& doc_id)
+ , std::string const& doc_id)
         {
             std::string code;
             int err = detail::load(file, code);
@@ -340,7 +341,7 @@
         state.paragraph_output();
 
         fs::path filein = include_search(state.filename.parent_path(), x.path);
- raw_string doc_id;
+ std::string doc_id;
 
         // swap the filenames
         std::swap(state.filename, filein);
@@ -365,7 +366,7 @@
 
         // if an id is specified in this include (as in [include:id foo.qbk])
         // then use it as the doc_id.
- if (x.id) state.doc_id = *x.id;
+ if (x.id) state.doc_id = x.id->value;
 
         // update the __FILENAME__ macro
         *state.macro.find("__FILENAME__") =

Modified: branches/quickbook-1.5-spirit2/boostbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/boostbook.cpp (original)
+++ branches/quickbook-1.5-spirit2/boostbook.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -445,20 +445,20 @@
         // Document tag
 
         state.block
- << '<' << info.doc_type << " id=\"" << encode(info.doc_id) << "\"\n";
+ << '<' << info.doc_type << " id=\"" << info.doc_id.get(106) << "\"\n";
         
         if(info.doc_type == "library")
         {
- state.block << " name=\"" << encode(info.doc_title) << "\"\n";
+ state.block << " name=\"" << info.doc_title.get(106) << "\"\n";
         }
 
         if(!info.doc_dirname.empty())
         {
- state.block << " dirname=\"" << encode(info.doc_dirname) << "\"\n";
+ state.block << " dirname=\"" << info.doc_dirname.get(106) << "\"\n";
         }
 
         state.block
- << "last-revision=\"" << encode(info.doc_last_revision) << "\""
+ << "last-revision=\"" << info.doc_last_revision.get(106) << "\""
             << " xmlns:xi=\"http://www.w3.org/2001/XInclude\"";
 
         state.block << ">"; // end document tag.
@@ -466,11 +466,11 @@
         // Title tag
 
         std::string title;
- if(info.doc_title.begin() != info.doc_title.end())
+ if(!info.doc_title.empty())
         {
- title = "<title>" + encode(info.doc_title);
+ title = "<title>" + info.doc_title.get(106);
             if (!info.doc_version.empty())
- title += ' ' + info.doc_version.value;
+ title += ' ' + info.doc_version.get(106);
             title += "</title>\n";
         }
 
@@ -487,8 +487,8 @@
             BOOST_FOREACH(doc_info::author const& author, info.doc_authors) {
                 state.block
                     << "<author>\n"
- << "<firstname>" << author.firstname << "</firstname>\n"
- << "<surname>" << author.surname << "</surname>\n"
+ << "<firstname>" << author.firstname.get(106) << "</firstname>\n"
+ << "<surname>" << author.surname.get(106) << "</surname>\n"
                     << "</author>\n";
             }
             state.block << "</authorgroup>\n";
@@ -504,17 +504,17 @@
             }
 
             state.block
- << "<holder>" << copyright.holder << "</holder>\n"
+ << "<holder>" << copyright.holder.get(106) << "</holder>\n"
                 << "</copyright>\n"
             ;
         }
 
- if (!boost::apply_visitor(empty_visitor(), info.doc_license))
+ if (!info.doc_license.empty())
         {
             state.block
                 << "<legalnotice>\n"
                 << "<para>\n"
- << boost::apply_visitor(encode_raw_visitor(*this), info.doc_license)
+ << info.doc_license.get(103)
                 << "\n"
                 << "</para>\n"
                 << "</legalnotice>\n"
@@ -522,21 +522,21 @@
             ;
         }
 
- if (!boost::apply_visitor(empty_visitor(), info.doc_purpose))
+ if (!info.doc_purpose.empty())
         {
             state.block
                 << "<" << info.doc_type << "purpose>\n"
- << boost::apply_visitor(encode_raw_visitor(*this), info.doc_purpose)
+ << info.doc_purpose.get(103)
                 << "</" << info.doc_type << "purpose>\n"
                 << "\n"
             ;
         }
 
- BOOST_FOREACH(raw_string const& category, info.doc_categories)
+ BOOST_FOREACH(docinfo_string const& category, info.doc_categories)
         {
             state.block
                 << "<" << info.doc_type << "category name=\"category:"
- << encode(category)
+ << category.get(106)
                 << "\"></" << info.doc_type << "category>\n"
                 << "\n"
             ;

Modified: branches/quickbook-1.5-spirit2/code_snippet_types.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet_types.hpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet_types.hpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -47,7 +47,7 @@
     struct code_snippet_actions
     {
         code_snippet_actions(std::vector<define_template>& storage,
- raw_string const& doc_id,
+ std::string const& doc_id,
                                  char const* source_type)
             : process(*this)
             , output(*this)
@@ -84,7 +84,7 @@
         std::string snippet;
         quickbook::callouts callouts;
         std::vector<define_template>& storage;
- raw_string const doc_id;
+ std::string const doc_id;
         char const* const source_type;
     };
 }

Modified: branches/quickbook-1.5-spirit2/doc/quickbook.qbk
==============================================================================
--- branches/quickbook-1.5-spirit2/doc/quickbook.qbk (original)
+++ branches/quickbook-1.5-spirit2/doc/quickbook.qbk 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -229,8 +229,12 @@
 * Better generated markup for callout lists.
 * In docbook, variable list entries can only have one `listitem`, so if an
   entry has multiple values, merge them into one `listitem`.
+* Revert xml escaping document info, it broke some documentation files
+ (now a 1.6 feature).
 * Further work on quickbook 1.6, still not stable.
   * Allow heading to have ids, using the syntax: `[heading:id title]`.
+ * XML escape documentation fields, with escapes to allow encoding unicode
+ in ASCII.
 
 [endsect]
 

Modified: branches/quickbook-1.5-spirit2/doc_info.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/doc_info.hpp (original)
+++ branches/quickbook-1.5-spirit2/doc_info.hpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -13,40 +13,60 @@
 #include <vector>
 #include <string>
 #include <utility>
-#include <boost/variant/variant.hpp>
 #include "fwd.hpp"
 #include "strings.hpp"
 
 namespace quickbook
 {
+ struct docinfo_string {
+ std::string raw;
+ std::string encoded;
+
+ docinfo_string() : raw(), encoded() {}
+
+ void swap(docinfo_string& x) {
+ raw.swap(x.raw);
+ encoded.swap(x.encoded);
+ }
+
+ void clear() {
+ raw.clear();
+ encoded.clear();
+ }
+
+ bool empty() const {
+ return raw.empty();
+ }
+
+ std::string const& get(unsigned version) const;
+ };
+
     struct doc_info
     {
         typedef std::vector<unsigned int> copyright_years;
         struct copyright_entry {
             copyright_years years;
- std::string holder;
+ docinfo_string holder;
         };
         typedef std::vector<copyright_entry> copyright_list;
- typedef std::vector<raw_string> category_list;
+ typedef std::vector<docinfo_string> category_list;
         struct author {
- std::string firstname;
- std::string surname;
+ docinfo_string firstname;
+ docinfo_string surname;
         };
         typedef std::vector<author> author_list;
- typedef boost::variant<raw_string, std::string> variant_string;
- enum variant_string_enum { raw_string_type, string_type };
 
         std::string doc_type;
- raw_string doc_title;
- raw_string doc_version;
- raw_string doc_id;
- raw_string doc_dirname;
+ docinfo_string doc_title;
+ docinfo_string doc_version;
+ docinfo_string doc_id;
+ docinfo_string doc_dirname;
         copyright_list doc_copyrights;
- variant_string doc_purpose;
+ docinfo_string doc_purpose;
         category_list doc_categories;
         author_list doc_authors;
- variant_string doc_license;
- raw_string doc_last_revision;
+ docinfo_string doc_license;
+ docinfo_string doc_last_revision;
         bool ignore;
     };
     

Modified: branches/quickbook-1.5-spirit2/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/doc_info_actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/doc_info_actions.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -23,25 +23,9 @@
 
 namespace quickbook
 {
- namespace
+ std::string const& docinfo_string::get(unsigned version) const
     {
- struct empty_visitor {
- typedef bool result_type;
-
- template <typename T>
- bool operator()(T const& x) const {
- return x.empty();
- }
- };
-
- struct clear_visitor {
- typedef void result_type;
-
- template <typename T>
- void operator()(T& x) const {
- return x.clear();
- }
- };
+ return (qbk_version_n < version) ? raw : encoded;
     }
 
     void process(quickbook::state& state, version const& x)
@@ -88,17 +72,20 @@
         // The doc_info in the file has been parsed. Here's what we'll do
         // *before* anything else.
 
- if(!info.doc_title.empty())
- state.doc_title = info.doc_title;
+ if(!info.doc_title.empty()) {
+ state.doc_title = info.doc_title.get(106);
+ state.doc_title_raw = info.doc_title.raw;
+ }
 
         if(info.doc_id.empty())
- info.doc_id = detail::make_identifier(state.doc_title);
+ info.doc_id.encoded = info.doc_id.raw = detail::make_identifier(state.doc_title_raw);
 
         if(state.doc_id.empty())
- state.doc_id = info.doc_id;
+ state.doc_id = info.doc_id.get(106);
 
+ // TODO: Set from state.
         if (info.doc_dirname.empty() && info.doc_type == "library")
- info.doc_dirname = state.doc_id;
+ info.doc_dirname = info.doc_id;
 
         if (info.doc_last_revision.empty())
         {
@@ -112,29 +99,34 @@
                     "$" /* prevent CVS substitution */ "Date: %Y/%m/%d %H:%M:%S $"),
                 current_gm_time
             );
- info.doc_last_revision = strdate;
+ info.doc_last_revision.encoded = info.doc_last_revision.raw = strdate;
         }
 
- std::vector<std::string> invalid_attributes;
+ // TODO: Should I do this when ignoring docinfo?
 
         if (info.doc_type != "library")
         {
- if (!boost::apply_visitor(empty_visitor(), info.doc_purpose))
+ std::vector<std::string> invalid_attributes;
+
+ if (!info.doc_purpose.empty())
                 invalid_attributes.push_back("purpose");
 
             if (!info.doc_categories.empty())
                 invalid_attributes.push_back("category");
- }
 
- if(!invalid_attributes.empty())
- {
- detail::outwarn(state.filename.native(),1)
- << (invalid_attributes.size() > 1 ?
- "Invalid attributes" : "Invalid attribute")
- << " for '" << info.doc_type << "': "
- << boost::algorithm::join(invalid_attributes, ", ")
- << "\n"
- ;
+ if (!info.doc_dirname.empty())
+ invalid_attributes.push_back("dirname");
+
+ if(!invalid_attributes.empty())
+ {
+ detail::outwarn(state.filename.native(),1)
+ << (invalid_attributes.size() > 1 ?
+ "Invalid attributes" : "Invalid attribute")
+ << " for '" << info.doc_type << " document info': "
+ << boost::algorithm::join(invalid_attributes, ", ")
+ << "\n"
+ ;
+ }
         }
 
         state.encode(info);

Modified: branches/quickbook-1.5-spirit2/doc_info_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/doc_info_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/doc_info_grammar.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -31,24 +31,30 @@
     namespace qi = boost::spirit::qi;
     namespace repo = boost::spirit::repository;
     namespace ph = boost::phoenix;
-
+
     struct doc_info_grammar_local
     {
         qi::symbols<char> doc_types;
         qi::rule<iterator, version()> quickbook_version;
- qi::rule<iterator, raw_source()> doc_version;
- qi::rule<iterator, raw_source()> doc_id;
- qi::rule<iterator, raw_source()> doc_dirname;
- qi::rule<iterator, raw_source()> doc_category;
- qi::rule<iterator, raw_source()> doc_last_revision;
+ qi::rule<iterator, docinfo_string()> doc_version;
+ qi::rule<iterator, docinfo_string()> doc_id;
+ qi::rule<iterator, docinfo_string()> doc_dirname;
+ qi::rule<iterator, docinfo_string()> doc_category;
+ qi::rule<iterator, docinfo_string()> doc_last_revision;
         qi::rule<iterator, std::string()> doc_source_mode; // TODO: raw_source
- qi::rule<iterator, doc_info::variant_string()> doc_purpose;
- qi::rule<iterator, doc_info::variant_string()> doc_license;
+ qi::rule<iterator, docinfo_string()> doc_purpose;
+ qi::rule<iterator, docinfo_string()> doc_license;
         qi::rule<iterator, doc_info::copyright_entry()> doc_copyright;
         qi::rule<iterator, doc_info::author_list()> doc_authors;
         qi::rule<iterator, doc_info::author()> doc_author;
- qi::rule<iterator, quickbook::raw_string()> raw_phrase;
- qi::rule<iterator, std::string()> doc_info_phrase;
+ qi::rule<iterator, docinfo_string()> doc_info_phrase;
+ qi::rule<iterator, docinfo_string()> doc_info_text;
+ qi::rule<iterator, docinfo_string()> doc_info_text_comma;
+ qi::rule<iterator, docinfo_string()> doc_info_title;
+ qi::rule<iterator, std::string()> doc_info_phrase_impl;
+ qi::rule<iterator, std::string()> doc_info_text_impl;
+ qi::rule<iterator, std::string()> doc_info_text_comma_impl;
+ qi::rule<iterator, std::string()> doc_info_title_impl;
     };
 
     void quickbook_grammar::impl::init_doc_info()
@@ -62,14 +68,12 @@
           , "appendix", "preface", "qandadiv", "qandaset"
           , "reference", "set"
         ;
-
+
         doc_info_details =
             repo::confix(space >> '[' >> space, space >> ']' >> +qi::eol)
             [ qi::raw[local.doc_types] [member_assign(&doc_info::doc_type)]
>> hard_space
- >> qi::raw[
- *(~qi::char_("[]") - qi::eol)
- ] [member_assign(&doc_info::doc_title)]
+ >> local.doc_info_title [member_assign(&doc_info::doc_title)]
>> local.quickbook_version [actions.process]
>> *repo::confix(space >> '[', space >> ']' >> +qi::eol)
                 [ local.doc_version [member_assign(&doc_info::doc_version)]
@@ -95,39 +99,36 @@
                 [ "quickbook"
>> hard_space
>> qi::uint_ [member_assign(&version::major)]
- >> '.'
+ >> '.'
>> uint2_t() [member_assign(&version::minor)]
                 ]
             ;
 
- local.doc_version = "version" >> hard_space >> qi::raw[*~qi::char_(']')];
- local.doc_id = "id" >> hard_space >> qi::raw[*~qi::char_(']')];
- local.doc_dirname = "dirname" >> hard_space >> qi::raw[*~qi::char_(']')];
- local.doc_category="category" >> hard_space >> qi::raw[*~qi::char_(']')];
- local.doc_last_revision = "last-revision" >> hard_space >> qi::raw[*~qi::char_(']')];
+ local.doc_version = "version" >> hard_space >> local.doc_info_text;
+ local.doc_id = "id" >> hard_space >> local.doc_info_text;
+ local.doc_dirname = "dirname" >> hard_space >> local.doc_info_text;
+ local.doc_category="category" >> hard_space >> local.doc_info_text;
+ local.doc_last_revision = "last-revision" >> hard_space >> local.doc_info_text;
 
         local.doc_copyright =
                 "copyright"
>> hard_space
>> (+(qi::uint_ >> space)) [member_assign(&doc_info::copyright_entry::years)]
- >> qi::raw[*~qi::char_(']')]
- [member_assign(&doc_info::copyright_entry::holder)]
+ >> local.doc_info_text [member_assign(&doc_info::copyright_entry::holder)]
             ;
 
         local.doc_purpose =
- "purpose" >> hard_space
- >> (
- qi::eps(qbk_before(103)) >> local.raw_phrase |
- qi::eps(qbk_since(103)) >> local.doc_info_phrase
- )
+ "purpose"
+ >> hard_space
+ >> local.doc_info_phrase
             ;
 
         local.doc_author =
                 '['
>> space
- >> (*~qi::char_(',')) [member_assign(&doc_info::author::surname)]
+ >> local.doc_info_text_comma [member_assign(&doc_info::author::surname)]
>> ',' >> space
- >> (*~qi::char_(']')) [member_assign(&doc_info::author::firstname)]
+ >> local.doc_info_text [member_assign(&doc_info::author::firstname)]
>> ']'
             ;
 
@@ -139,34 +140,77 @@
                 );
 
         local.doc_license =
- "license" >> hard_space
- >> (
- qi::eps(qbk_before(103)) >> local.raw_phrase |
- qi::eps(qbk_since(103)) >> local.doc_info_phrase
- )
+ "license"
+ >> hard_space
+ >> local.doc_info_phrase
             ;
 
         local.doc_source_mode =
                 "source-mode" >> hard_space
>> (
- qi::string("c++")
+ qi::string("c++")
                 | qi::string("python")
                 | qi::string("teletype")
                 )
             ;
 
- local.raw_phrase =
- qi::raw[local.doc_info_phrase]
- [qi::_val = qi::_1]
+ local.doc_info_phrase =
+ qi::raw[
+ local.doc_info_phrase_impl [member_assign(&docinfo_string::encoded)]
+ ] [member_assign(&docinfo_string::raw)]
             ;
 
- local.doc_info_phrase =
+ local.doc_info_text =
+ qi::raw[
+ local.doc_info_text_impl [member_assign(&docinfo_string::encoded)]
+ ] [member_assign(&docinfo_string::raw)]
+ ;
+
+ local.doc_info_text_comma =
+ qi::raw[
+ local.doc_info_text_comma_impl
+ [member_assign(&docinfo_string::encoded)]
+ ] [member_assign(&docinfo_string::raw)]
+ ;
+
+ local.doc_info_title =
+ qi::raw[
+ local.doc_info_title_impl [member_assign(&docinfo_string::encoded)]
+ ] [member_assign(&docinfo_string::raw)]
+ ;
+
+ local.doc_info_phrase_impl =
                 qi::eps [actions.phrase_push]
- >> *( common
+ >> *( common
                 | comment
                 | (~qi::char_(']')) [actions.process]
                 )
>> qi::eps [actions.phrase_pop]
             ;
+
+ local.doc_info_text_impl =
+ qi::eps [actions.phrase_push]
+ >> *( escape
+ | (~qi::char_(']')) [actions.process]
+ )
+ >> qi::eps [actions.phrase_pop]
+ ;
+
+ local.doc_info_text_comma_impl =
+ qi::eps [actions.phrase_push]
+ >> *( escape
+ | (~qi::char_("],")) [actions.process]
+ )
+ >> qi::eps [actions.phrase_pop]
+ ;
+
+ local.doc_info_title_impl =
+ qi::eps [actions.phrase_push]
+ >> *( escape
+ | (~qi::char_("[]") - qi::eol)
+ [actions.process]
+ )
+ >> qi::eps [actions.phrase_pop]
+ ;
     }
 }

Modified: branches/quickbook-1.5-spirit2/encoder_impl.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/encoder_impl.hpp (original)
+++ branches/quickbook-1.5-spirit2/encoder_impl.hpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -104,28 +104,4 @@
         typedef std::vector<footnote> footnotes;
         std::stack<footnotes> footnote_stack;
     };
-
- struct empty_visitor {
- typedef bool result_type;
-
- template <typename T>
- bool operator()(T const& x) const {
- return x.empty();
- }
- };
-
- struct encode_raw_visitor {
- typedef std::string result_type;
-
- encoder& encoder_;
- encode_raw_visitor(encoder& e) : encoder_(e) {}
-
- std::string operator()(raw_string const& x) const {
- return encoder_.encode(x);
- }
-
- std::string operator()(std::string const& x) const {
- return x;
- }
- };
 }
\ No newline at end of file

Modified: branches/quickbook-1.5-spirit2/grammar_impl.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar_impl.hpp (original)
+++ branches/quickbook-1.5-spirit2/grammar_impl.hpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -35,6 +35,7 @@
         qi::symbols<char, qi::rule<iterator> > phrase_symbol_rules;
         qi::rule<iterator> phrase_end;
         qi::rule<iterator> call_template;
+ qi::rule<iterator> escape;
 
         // block
         qi::rule<iterator> block_start;

Modified: branches/quickbook-1.5-spirit2/html.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/html.cpp (original)
+++ branches/quickbook-1.5-spirit2/html.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -438,18 +438,17 @@
         state.block
             << "<!DOCTYPE html>"
             << "<html><head>"
- << "<title>" << encode(info.doc_title) << "</title>"
+ << "<title>" << encode(info.doc_title.get(106)) << "</title>"
             << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"
             << "</head>"
             << "<body>"
             << "<header>"
- << "<h1>" << encode(info.doc_title) << "</h1>"
+ << "<h1>" << encode(info.doc_title.get(106)) << "</h1>"
             ;
 
         if(!info.doc_authors.empty() || !info.doc_copyrights.empty() ||
- !boost::apply_visitor(empty_visitor(), info.doc_license))
+ !info.doc_license.empty())
         {
-
             state.block << "<dl>\n";
 
             if(!info.doc_authors.empty())
@@ -463,9 +462,9 @@
                 BOOST_FOREACH(doc_info::author const& author, info.doc_authors) {
                     state.block
                         << "<dd>"
- << author.firstname
+ << author.firstname.get(106)
                         << " "
- << author.surname
+ << author.surname.get(106)
                         << "</dd>\n";
                 }
             }
@@ -511,18 +510,18 @@
         
                     state.block
                         << " "
- << copyright.holder
+ << copyright.holder.get(106)
                         << "</dd>\n"
                     ;
                 }
             }
     
- if (!boost::apply_visitor(empty_visitor(), info.doc_license))
+ if (!info.doc_license.empty())
             {
                 state.block
                     << "<dt>License:</dt>\n"
                     << "<dd>"
- << boost::apply_visitor(encode_raw_visitor(*this), info.doc_license)
+ << info.doc_license.get(103)
                     << "</dd>\n"
                 ;
             }

Modified: branches/quickbook-1.5-spirit2/phrase_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/phrase_grammar.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -39,7 +39,6 @@
         qi::rule<iterator, void(char)> simple_format_chars;
         qi::rule<iterator, void(char)> simple_format_end;
         qi::rule<iterator> simple_phrase_end;
- qi::rule<iterator> escape;
         qi::rule<iterator, quickbook::break_()> escape_break;
         qi::rule<iterator, quickbook::formatted()> escape_punct;
         qi::rule<iterator, quickbook::formatted()> escape_markup;
@@ -71,7 +70,7 @@
             | code_block [actions.process]
             | inline_code [actions.process]
             | local.simple_format [actions.process]
- | local.escape
+ | escape
             | comment
             ;
 
@@ -133,7 +132,7 @@
 
         local.simple_phrase_end = '[' | phrase_end;
 
- local.escape =
+ escape =
             ( local.escape_break
             | "\\ " // ignore an escaped char
             | local.escape_punct

Modified: branches/quickbook-1.5-spirit2/state.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/state.hpp (original)
+++ branches/quickbook-1.5-spirit2/state.hpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -35,8 +35,9 @@
 
         static int const max_template_depth = 100;
 
- raw_string doc_id;
- raw_string doc_title;
+ std::string doc_id;
+ std::string doc_title;
+ std::string doc_title_raw;
 
     // main output stream
         collector phrase;

Modified: branches/quickbook-1.5-spirit2/template.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/template.cpp (original)
+++ branches/quickbook-1.5-spirit2/template.cpp 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -417,7 +417,7 @@
 
                 for(unsigned int i = 0; i < size; ++i)
                 {
- std::string callout_id = state.doc_id.value +
+ std::string callout_id = state.doc_id +
                         boost::lexical_cast<std::string>(detail::callout_id + i);
 
                     std::string code;
@@ -482,7 +482,7 @@
         if(x.symbol->callouts.size()) {
             callout_list list;
             BOOST_FOREACH(callout_source const& c, x.symbol->callouts) {
- std::string callout_id = state.doc_id.value +
+ std::string callout_id = state.doc_id +
                     boost::lexical_cast<std::string>(detail::callout_id++);
 
                 std::string callout_value;

Modified: branches/quickbook-1.5-spirit2/test/doc-info-1.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/doc-info-1.gold (original)
+++ branches/quickbook-1.5-spirit2/test/doc-info-1.gold 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,17 +1,20 @@
 <?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="document_information_1" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+<article id="karel_vom_u00e1_u010dka_and_tom_u00e1_u0161_martin_u00edk" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Document Information 1</title>
+ <title>Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k</title>
   <articleinfo>
     <authorgroup>
     <author>
- <firstname>Joe</firstname> <surname>Blow</surname>
+ <firstname>Matti</firstname> <surname>Meik&#xE4;l&#xE4;inen</surname>
     </author>
     <author>
- <firstname>Jane</firstname> <surname>Doe</surname>
+ <firstname>Pero</firstname> <surname>Peri&#x107;</surname>
     </author>
     </authorgroup>
+ <copyright>
+ <year>2010</year> <holder>Me&#xF0;al-J&#xF3;n and J&#xF3;na J&#xF3;nsd&#xF3;ttir</holder>
+ </copyright>
     <articlepurpose>
       Inline code test: <code>1 + 2</code>
     </articlepurpose>

Modified: branches/quickbook-1.5-spirit2/test/doc-info-1.quickbook
==============================================================================
--- branches/quickbook-1.5-spirit2/test/doc-info-1.quickbook (original)
+++ branches/quickbook-1.5-spirit2/test/doc-info-1.quickbook 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,6 +1,7 @@
-[article Document Information 1
-[quickbook 1.5]
-[authors [Blow, Joe], [Doe, Jane]]
+[article Karel Vom\u00E1\u010Dka and Tom\u00E1\u0161 Martin\u00EDk
+[quickbook 1.6]
+[authors [Meik\u00E4l\u00E4inen, Matti][Peri\u0107, Pero]]
+[copyright 2010 Me\u00F0al-J\u00F3n and J\u00F3na J\u00F3nsd\u00F3ttir]
 [source-mode teletype]
 [purpose Inline code test: `1 + 2`]
 [category tests]

Modified: branches/quickbook-1.5-spirit2/test/doc-info-2.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/doc-info-2.gold (original)
+++ branches/quickbook-1.5-spirit2/test/doc-info-2.gold 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,20 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<library id="document_information_1" name="Document Information 1" dirname="document_information_1"
-last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+<library id="karel_vom__xe1___x10d_ka_and_tom__xe1___x161__martin__xed_k" name="Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k"
+dirname="karel_vom__xe1___x10d_ka_and_tom__xe1___x161__martin__xed_k" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
   <libraryinfo>
     <authorgroup>
     <author>
- <firstname>Joe</firstname> <surname>Blow</surname>
+ <firstname>Matti</firstname> <surname>Meik&#xE4;l&#xE4;inen</surname>
     </author>
     <author>
- <firstname>Jane</firstname> <surname>Doe</surname>
+ <firstname>Pero</firstname> <surname>Peri&#x107;</surname>
     </author>
     </authorgroup>
+ <copyright>
+ <year>2010</year> <holder>Me&#xF0;al-J&#xF3;n and J&#xF3;na J&#xF3;nsd&#xF3;ttir</holder>
+ </copyright>
     <librarypurpose>
       Inline code test: <code>1 + 2</code>
     </librarypurpose>
     <librarycategory name="category:tests"></librarycategory> <librarycategory name="category:irrelevance"></librarycategory>
   </libraryinfo>
- <title>Document Information 1</title>
+ <title>Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k</title>
 </library>

Modified: branches/quickbook-1.5-spirit2/test/doc-info-2.quickbook
==============================================================================
--- branches/quickbook-1.5-spirit2/test/doc-info-2.quickbook (original)
+++ branches/quickbook-1.5-spirit2/test/doc-info-2.quickbook 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,6 +1,7 @@
-[library Document Information 1
+[library Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k
 [quickbook 1.5]
-[authors [Blow, Joe] [Doe, Jane]]
+[authors [Meik&#xE4;l&#xE4;inen, Matti],[Peri&#x107;, Pero]]
+[copyright 2010 Me&#xF0;al-J&#xF3;n and J&#xF3;na J&#xF3;nsd&#xF3;ttir]
 [source-mode teletype]
 [purpose Inline code test: `1 + 2`]
 [category tests]

Modified: branches/quickbook-1.5-spirit2/test/xml-escape_1_2.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/xml-escape_1_2.gold (original)
+++ branches/quickbook-1.5-spirit2/test/xml-escape_1_2.gold 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,15 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<library id="test_that______are_being_escaped_" name="Test that &amp;, &lt; are being escaped."
-dirname="test_that______are_being_escaped_" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+<library id="test_that__amp____lt__are_being_escaped_" name="Test that &amp;, &lt; are being escaped."
+dirname="test_that__amp____lt__are_being_escaped_" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <libraryinfo>
+ <legalnotice>
+ <para>
+ &amp; should be &amp;amp;, &lt; should &amp;lt;
+ </para>
+ </legalnotice>
     <librarypurpose>
       &amp; should be &amp;amp;, &lt; should &amp;lt;
     </librarypurpose>
   </libraryinfo>
   <title>Test that &amp;, &lt; are being escaped.</title>
- <section id="test_that______are_being_escaped_.escapes___explicitly_written_markup">
+ <section id="test_that__amp____lt__are_being_escaped_.escapes___explicitly_written_markup">
     <title>Escapes &amp; explicitly written markup</title>
     <itemizedlist>
       <listitem>

Modified: branches/quickbook-1.5-spirit2/test/xml-escape_1_2.quickbook
==============================================================================
--- branches/quickbook-1.5-spirit2/test/xml-escape_1_2.quickbook (original)
+++ branches/quickbook-1.5-spirit2/test/xml-escape_1_2.quickbook 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,6 +1,7 @@
-[library Test that &, < are being escaped.
+[library Test that &amp;, &lt; are being escaped.
     [quickbook 1.2]
- [purpose & should be &amp;, < should &lt;]
+ [purpose &amp; should be &amp;amp;, &lt; should &amp;lt;]
+ [license &amp; should be &amp;amp;, &lt; should &amp;lt;]
 ]
 
 [section Escapes & explicitly written markup]

Modified: branches/quickbook-1.5-spirit2/test/xml-escape_1_5.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/xml-escape_1_5.gold (original)
+++ branches/quickbook-1.5-spirit2/test/xml-escape_1_5.gold 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,16 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<library id="test_that______are_being_escaped_" name="Test that &amp;, &lt; are being escaped."
-dirname="test_that______are_being_escaped_" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+<library id="test_that__amp____lt__are_being_escaped_" name="Test that &amp;, &lt; are being escaped."
+dirname="test_that__amp____lt__are_being_escaped_" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <libraryinfo>
+ <legalnotice>
+ <para>
+ &amp; should be &amp;amp;, &lt; should &amp;lt;
+ </para>
+ </legalnotice>
     <librarypurpose>
       &amp; should be &amp;amp;, &lt; should &amp;lt;
     </librarypurpose>
   </libraryinfo>
   <title>Test that &amp;, &lt; are being escaped.</title>
- <section id="test_that______are_being_escaped_.escapes___explicitly_written_markup">
- <title><link linkend="test_that______are_being_escaped_.escapes___explicitly_written_markup">Escapes
+ <section id="test_that__amp____lt__are_being_escaped_.escapes___explicitly_written_markup">
+ <title><link linkend="test_that__amp____lt__are_being_escaped_.escapes___explicitly_written_markup">Escapes
     &amp; explicitly written markup</link></title>
     <itemizedlist>
       <listitem>

Modified: branches/quickbook-1.5-spirit2/test/xml-escape_1_5.quickbook
==============================================================================
--- branches/quickbook-1.5-spirit2/test/xml-escape_1_5.quickbook (original)
+++ branches/quickbook-1.5-spirit2/test/xml-escape_1_5.quickbook 2010-08-31 16:03:07 EDT (Tue, 31 Aug 2010)
@@ -1,6 +1,7 @@
-[library Test that &, < are being escaped.
+[library Test that &amp;, &lt; are being escaped.
     [quickbook 1.5]
     [purpose & should be &amp;, < should &lt;]
+ [license & should be &amp;, < should &lt;]
 ]
 
 [section Escapes & explicitly written markup]


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