Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65370 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2010-09-09 18:45:42


Author: danieljames
Date: 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
New Revision: 65370
URL: http://svn.boost.org/trac/boost/changeset/65370

Log:
Add biblioid support to quickbook.
Text files modified:
   trunk/tools/quickbook/src/actions_class.cpp | 1 +
   trunk/tools/quickbook/src/actions_class.hpp | 5 +++++
   trunk/tools/quickbook/src/doc_info_actions.cpp | 16 +++++++++++++++-
   trunk/tools/quickbook/src/doc_info_grammar.cpp | 15 +++++++++++++--
   trunk/tools/quickbook/test/doc-info-1.gold | 1 +
   trunk/tools/quickbook/test/doc-info-1.quickbook | 3 ++-
   trunk/tools/quickbook/test/doc-info-2.gold | 2 ++
   trunk/tools/quickbook/test/doc-info-2.quickbook | 4 +++-
   8 files changed, 42 insertions(+), 5 deletions(-)

Modified: trunk/tools/quickbook/src/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.cpp (original)
+++ trunk/tools/quickbook/src/actions_class.cpp 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -82,6 +82,7 @@
         , extract_name_first(name.first, phrase)
         , extract_doc_last_revision(doc_last_revision, phrase)
         , extract_doc_category(doc_category, phrase)
+ , extract_doc_biblioid(doc_biblioid.second, phrase)
         , code(out, phrase, *this)
         , code_block(phrase, phrase, *this)
         , inline_code(phrase, *this)

Modified: trunk/tools/quickbook/src/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.hpp (original)
+++ trunk/tools/quickbook/src/actions_class.hpp 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -33,6 +33,8 @@
         typedef std::vector<author> author_list;
         typedef std::pair<string_list, docinfo_string> copyright_item;
         typedef std::vector<copyright_item> copyright_list;
+ typedef std::pair<std::string, docinfo_string> biblioid_item;
+ typedef std::vector<biblioid_item> biblioid_list;
         typedef std::pair<char, int> mark_type;
         static int const max_template_depth = 100;
 
@@ -48,8 +50,10 @@
         author_list doc_authors;
         docinfo_string doc_license;
         docinfo_string doc_last_revision;
+ biblioid_list doc_biblioid_items;
         std::string include_doc_id;
         //temporary state
+ biblioid_item doc_biblioid;
         docinfo_string doc_id_tmp;
         author name;
         copyright_item copyright;
@@ -132,6 +136,7 @@
         phrase_to_docinfo_action extract_name_first;
         phrase_to_docinfo_action extract_doc_last_revision;
         phrase_to_docinfo_action extract_doc_category;
+ phrase_to_docinfo_action extract_doc_biblioid;
 
         code_action code;
         code_action code_block;

Modified: trunk/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_actions.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_actions.cpp 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -281,6 +281,20 @@
             }
         }
 
+ for (actions::biblioid_list::const_iterator
+ it = actions.doc_biblioid_items.begin(),
+ end = actions.doc_biblioid_items.end();
+ it != end; ++it)
+ {
+ tmp << " <biblioid class=\""
+ << it->first
+ << "\">"
+ << it->second.get(103)
+ << "</biblioid>"
+ << "\n"
+ ;
+ }
+
         std::string value = tmp.str();
         if(!value.empty())
         {
@@ -291,4 +305,4 @@
             ;
         }
     }
-}
\ No newline at end of file
+}

Modified: trunk/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_grammar.cpp 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -33,8 +33,8 @@
                         doc_info, doc_title, doc_version, doc_id, doc_dirname,
                         doc_copyright, doc_purpose, doc_category, doc_authors,
                         doc_author, comment, space, hard_space, doc_license,
- doc_last_revision, doc_source_mode, phrase, quickbook_version,
- char_;
+ doc_last_revision, doc_source_mode, doc_biblioid,
+ phrase, quickbook_version, char_;
         phrase_grammar common;
         cl::symbols<> doc_types;
 
@@ -80,6 +80,7 @@
                     | doc_license
                     | doc_last_revision
                     | doc_source_mode
+ | doc_biblioid
                     )
>> space >> ']' >> +cl::eol_p
                 )
@@ -178,6 +179,16 @@
                 ) [cl::assign_a(actions.source_mode)]
             ;
 
+ doc_biblioid =
+ "biblioid"
+ >> hard_space
+ >> (+cl::alnum_p) [cl::assign_a(actions.doc_biblioid.first)]
+ >> hard_space
+ >> (+(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_biblioid]
+ [cl::push_back_a(actions.doc_biblioid_items, actions.doc_biblioid)]
+ ;
+
         comment =
             "[/" >> *(cl::anychar_p - ']') >> ']'
             ;

Modified: trunk/tools/quickbook/test/doc-info-1.gold
==============================================================================
--- trunk/tools/quickbook/test/doc-info-1.gold (original)
+++ trunk/tools/quickbook/test/doc-info-1.gold 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -19,5 +19,6 @@
       Inline code test: <code>1 + 2</code>
     </articlepurpose>
     <articlecategory name="category:tests"></articlecategory> <articlecategory name="category:irrelevance"></articlecategory>
+ <biblioid class="uri">http://www.boost.org/tools/quickbook/test/doc-info-1.quickbook>
   </articleinfo>
 </article>

Modified: trunk/tools/quickbook/test/doc-info-1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/doc-info-1.quickbook (original)
+++ trunk/tools/quickbook/test/doc-info-1.quickbook 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -6,4 +6,5 @@
 [purpose Inline code test: `1 + 2`]
 [category tests]
 [category irrelevance]
-]
\ No newline at end of file
+[biblioid uri
http://www.boost.org/tools/quickbook/test/doc-info-1.quickbook]
+]

Modified: trunk/tools/quickbook/test/doc-info-2.gold
==============================================================================
--- trunk/tools/quickbook/test/doc-info-2.gold (original)
+++ trunk/tools/quickbook/test/doc-info-2.gold 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -19,6 +19,8 @@
       Inline code test: <code>1 + 2</code>
     </librarypurpose>
     <librarycategory name="category:tests"></librarycategory> <librarycategory name="category:irrelevance"></librarycategory>
+ <biblioid class="uri">http://www.boost.org/tools/quickbook/test/doc-info-2.quickbook>
+ <biblioid class="isbn">0-937383-18-X</biblioid>
   </libraryinfo>
   <title>Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k</title>
 </library>

Modified: trunk/tools/quickbook/test/doc-info-2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/doc-info-2.quickbook (original)
+++ trunk/tools/quickbook/test/doc-info-2.quickbook 2010-09-09 18:45:39 EDT (Thu, 09 Sep 2010)
@@ -6,6 +6,8 @@
 [purpose Inline code test: `1 + 2`]
 [category tests]
 [category irrelevance]
+[biblioid uri
http://www.boost.org/tools/quickbook/test/doc-info-2.quickbook]
+[biblioid isbn 0-937383-18-X]
 ]
 
-[/ Some comment]
\ No newline at end of file
+[/ Some comment]


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