|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62470 - in trunk/tools/quickbook: detail doc test
From: daniel_james_at_[hidden]
Date: 2010-06-06 03:23:10
Author: danieljames
Date: 2010-06-06 03:23:09 EDT (Sun, 06 Jun 2010)
New Revision: 62470
URL: http://svn.boost.org/trac/boost/changeset/62470
Log:
Deal with invalid docinfo details. Refs #1281.
Warn when boostbook attributes are used for docbook document types and
don't output them.
Text files modified:
trunk/tools/quickbook/detail/actions.cpp | 48 +++++++++++++++++++++++++++++++--------
trunk/tools/quickbook/detail/quickbook.cpp | 2
trunk/tools/quickbook/doc/quickbook.qbk | 1
trunk/tools/quickbook/test/quickbook-manual.gold | 3 --
4 files changed, 40 insertions(+), 14 deletions(-)
Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-06-06 03:23:09 EDT (Sun, 06 Jun 2010)
@@ -14,6 +14,7 @@
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/join.hpp>
#include "./quickbook.hpp"
#include "./actions.hpp"
#include "./utils.hpp"
@@ -1523,6 +1524,8 @@
void write_document_info(collector& out, quickbook::actions& actions)
{
+ std::vector<std::string> invalid_attributes;
+
out << " <" << actions.doc_type << "info>\n";
if(!actions.doc_authors.empty())
@@ -1563,25 +1566,50 @@
if (!actions.doc_purpose.empty())
{
- out << " <" << actions.doc_type << "purpose>\n"
- << " " << actions.doc_purpose
- << " </" << actions.doc_type << "purpose>\n"
- << "\n"
- ;
+ if (actions.doc_type == "library")
+ {
+ out << " <" << actions.doc_type << "purpose>\n"
+ << " " << actions.doc_purpose
+ << " </" << actions.doc_type << "purpose>\n"
+ << "\n"
+ ;
+ }
+ else
+ {
+ invalid_attributes.push_back("purpose");
+ }
}
if (!actions.doc_category.empty())
{
- out << " <" << actions.doc_type << "category name=\"category:"
- << actions.doc_category
- << "\"></" << actions.doc_type << "category>\n"
- << "\n"
- ;
+ if (actions.doc_type == "library")
+ {
+ out << " <" << actions.doc_type << "category name=\"category:"
+ << actions.doc_category
+ << "\"></" << actions.doc_type << "category>\n"
+ << "\n"
+ ;
+ }
+ else
+ {
+ invalid_attributes.push_back("category");
+ }
}
out << " </" << actions.doc_type << "info>\n"
<< "\n"
;
+
+ if(!invalid_attributes.empty())
+ {
+ detail::outwarn(actions.filename.native_file_string(),1)
+ << (invalid_attributes.size() > 1 ?
+ "Invalid attributes" : "Invalid attribute")
+ << " for '" << actions.doc_type << "': "
+ << boost::algorithm::join(invalid_attributes, ", ")
+ << "\n"
+ ;
+ }
}
void phrase_to_string_action::operator()(iterator first, iterator last) const
Modified: trunk/tools/quickbook/detail/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/detail/quickbook.cpp (original)
+++ trunk/tools/quickbook/detail/quickbook.cpp 2010-06-06 03:23:09 EDT (Sun, 06 Jun 2010)
@@ -1,4 +1,4 @@
-j/*=============================================================================
+/*=============================================================================
Copyright (c) 2002 2004 2006 Joel de Guzman
Copyright (c) 2004 Eric Niebler
http://spirit.sourceforge.net/
Modified: trunk/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- trunk/tools/quickbook/doc/quickbook.qbk (original)
+++ trunk/tools/quickbook/doc/quickbook.qbk 2010-06-06 03:23:09 EDT (Sun, 06 Jun 2010)
@@ -195,6 +195,7 @@
[h3 Version 1.5.2 - Boost 1.44.0]
* Generate more valid boostbook (still invalid in a few places).
+* Warn about invalid doc_info members.
[endsect]
Modified: trunk/tools/quickbook/test/quickbook-manual.gold
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
==============================================================================
--- trunk/tools/quickbook/test/quickbook-manual.gold (original)
+++ trunk/tools/quickbook/test/quickbook-manual.gold 2010-06-06 03:23:09 EDT (Sun, 06 Jun 2010)
@@ -21,9 +21,6 @@
file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>)
</para>
</legalnotice>
- <articlepurpose>
- <emphasis>WikiWiki</emphasis> style documentation tool
- </articlepurpose>
</articleinfo>
<section id="quickbook.intro">
<title><link linkend="quickbook.intro"> Introduction</link></title>