Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68609 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-02-01 19:19:38


Author: danieljames
Date: 2011-02-01 19:19:24 EST (Tue, 01 Feb 2011)
New Revision: 68609
URL: http://svn.boost.org/trac/boost/changeset/68609

Log:
Nicer link break warnings.
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 43 +++++++++++++++++++++++++++++++++++----
   branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp | 1
   branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp | 1
   3 files changed, 40 insertions(+), 5 deletions(-)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.cpp 2011-02-01 19:19:24 EST (Tue, 01 Feb 2011)
@@ -51,9 +51,23 @@
         if(!actions.output_pre(phrase)) return;
 
         file_position const pos = first.get_position();
- detail::outwarn(actions.filename, pos.line)
- << "in column:" << pos.column << ", "
- << "[br] and \\n are deprecated" << ".\n";
+ if(*first == '\\')
+ {
+ detail::outwarn(actions.filename, pos.line)
+ << "in column:" << pos.column << ", "
+ << "'\\n' is deprecated, pleases use '[br]' instead" << ".\n";
+ }
+
+ if(!actions.warned_about_breaks)
+ {
+ detail::outwarn(actions.filename, pos.line)
+ << "line breaks generate invalid boostbook"
+ << " (will only note first occurrence)."
+ << "\n";
+
+ actions.warned_about_breaks = true;
+ }
+
         phrase << break_mark;
     }
 
@@ -499,10 +513,18 @@
         }
     }
 
- void image_action::operator()(iterator, iterator) const
+ void image_action::operator()(iterator first, iterator) const
     {
         if(!actions.output_pre(phrase)) return;
 
+ if(!fs::portable_posix_name(image_fileref))
+ {
+ detail::outwarn(actions.filename, first.get_position().line)
+ << "Image path isn't portable: "
+ << detail::utf8(image_fileref)
+ << std::endl;
+ }
+
         // Find the file basename and extension.
         //
         // Not using Boost.Filesystem because I want to stay in UTF-8.
@@ -511,6 +533,7 @@
         std::string::size_type pos;
         std::string stem,extension;
 
+ // TODO: This doesn't work for windows paths
         pos = image_fileref.rfind('/');
         stem = pos == std::string::npos ?
             image_fileref :
@@ -1320,7 +1343,17 @@
     {
         // Given a source file and the current filename, calculate the
         // path to the source file relative to the output directory.
- fs::path path = detail::generic_to_path(std::string(first, last));
+
+ std::string path_text(first, last);
+ if(!fs::portable_posix_name(path_text))
+ {
+ detail::outwarn(actions.filename, first.get_position().line)
+ << "Path isn't portable: "
+ << detail::utf8(path_text)
+ << std::endl;
+ }
+
+ fs::path path = detail::generic_to_path(path_text);
         if (!path.is_complete())
         {
             fs::path infile = fs::absolute(actions.filename).normalize();

Modified: branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp 2011-02-01 19:19:24 EST (Tue, 01 Feb 2011)
@@ -76,6 +76,7 @@
         , saved_anchors()
         , no_eols(true)
         , suppress(false)
+ , warned_about_breaks(false)
 
     // actions
         , error(*this)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp 2011-02-01 19:19:24 EST (Tue, 01 Feb 2011)
@@ -125,6 +125,7 @@
         string_list saved_anchors;
         bool no_eols;
         bool suppress;
+ bool warned_about_breaks;
 
     // push/pop the states and the streams
         void copy_macros_for_write();


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