Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86700 - in trunk/tools/quickbook: src test/include test/include/glob1 test/include/glob1/glob1-1 test/include/glob2 test/include/glob2/glob2-1
From: dnljms_at_[hidden]
Date: 2013-11-14 14:20:39


Author: danieljames
Date: 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013)
New Revision: 86700
URL: http://svn.boost.org/trac/boost/changeset/86700

Log:
Only match files when the whole glob matches.

Added:
   trunk/tools/quickbook/test/include/glob-1_7.gold (contents, props changed)
   trunk/tools/quickbook/test/include/glob-1_7.quickbook (contents, props changed)
   trunk/tools/quickbook/test/include/glob1/
   trunk/tools/quickbook/test/include/glob1/a.qbk (contents, props changed)
   trunk/tools/quickbook/test/include/glob1/glob1-1/
   trunk/tools/quickbook/test/include/glob1/glob1-1/b.qbk (contents, props changed)
   trunk/tools/quickbook/test/include/glob2/
   trunk/tools/quickbook/test/include/glob2/a.qbk (contents, props changed)
   trunk/tools/quickbook/test/include/glob2/glob2-1/
   trunk/tools/quickbook/test/include/glob2/glob2-1/b.qbk (contents, props changed)
Text files modified:
   trunk/tools/quickbook/src/include_paths.cpp | 23 ++++++++++++++---------
   trunk/tools/quickbook/test/include/Jamfile.v2 | 1 +
   trunk/tools/quickbook/test/include/glob-1_7.gold | 32 ++++++++++++++++++++++++++++++++
   trunk/tools/quickbook/test/include/glob-1_7.quickbook | 27 +++++++++++++++++++++++++++
   trunk/tools/quickbook/test/include/glob1/a.qbk | 1 +
   trunk/tools/quickbook/test/include/glob1/glob1-1/b.qbk | 1 +
   trunk/tools/quickbook/test/include/glob2/a.qbk | 3 +++
   trunk/tools/quickbook/test/include/glob2/glob2-1/b.qbk | 1 +
   8 files changed, 80 insertions(+), 9 deletions(-)

Modified: trunk/tools/quickbook/src/include_paths.cpp
==============================================================================
--- trunk/tools/quickbook/src/include_paths.cpp Thu Nov 14 14:19:54 2013 (r86699)
+++ trunk/tools/quickbook/src/include_paths.cpp 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -96,8 +96,7 @@
         if (prev != std::string::npos)
             dir /= fs::path(path.substr(0, prev));
 
- if (next == std::string::npos) next = path.size();
- else ++next;
+ if (next != std::string::npos) ++next;
 
         boost::string_ref glob(
                 path.data() + glob_begin,
@@ -114,18 +113,24 @@
             if (!quickbook::glob(glob, detail::path_to_generic(f))) continue;
 
             // If it's a file we add it to the results.
- if (fs::is_regular_file(dir_i->status()))
+ if (next == std::string::npos)
             {
- result.insert(quickbook_path(
- dir/f,
- state.abstract_file_path.parent_path()/dir/f
- ));
+ if (fs::is_regular_file(dir_i->status()))
+ {
+ result.insert(quickbook_path(
+ dir/f,
+ state.abstract_file_path.parent_path()/dir/f
+ ));
+ }
             }
             // If it's a matching dir, we recurse looking for more files.
             else
             {
- include_search_glob(result, dir/f,
- path.substr(next), state);
+ if (!fs::is_regular_file(dir_i->status()))
+ {
+ include_search_glob(result, dir/f,
+ path.substr(next), state);
+ }
             }
         }
     }

Modified: trunk/tools/quickbook/test/include/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/include/Jamfile.v2 Thu Nov 14 14:19:54 2013 (r86699)
+++ trunk/tools/quickbook/test/include/Jamfile.v2 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -42,4 +42,5 @@
     [ quickbook-test nested_compatibility-1_5 ]
     [ quickbook-test nested_compatibility-1_6 ]
     [ quickbook-test template_include-1_7 ]
+ [ quickbook-test glob-1_7 ]
     ;

Added: trunk/tools/quickbook/test/include/glob-1_7.gold
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/glob-1_7.gold 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -0,0 +1,32 @@
+<?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="glob_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Glob Test</title>
+ <section id="glob_test.t1_1">
+ <title><link linkend="glob_test.t1_1">Test 1.1</link></title>
+ <para>
+ A
+ </para>
+ </section>
+ <section id="glob_test.t1_2">
+ <title><link linkend="glob_test.t1_2">Test 1.2</link></title>
+ <para>
+ B
+ </para>
+ </section>
+ <section id="glob_test.t2_1">
+ <title><link linkend="glob_test.t2_1">Test 2.1</link></title>
+ <para>
+ A
+ </para>
+ <para>
+ B
+ </para>
+ </section>
+ <section id="glob_test.t2_2">
+ <title><link linkend="glob_test.t2_2">Test 2.2</link></title>
+ <para>
+ B
+ </para>
+ </section>
+</article>

Added: trunk/tools/quickbook/test/include/glob-1_7.quickbook
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/glob-1_7.quickbook 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -0,0 +1,27 @@
+[article Glob Test
+[quickbook 1.7]
+]
+
+[section:t1_1 Test 1.1]
+
+[include glob1/*]
+
+[endsect] [/t1_1]
+
+[section:t1_2 Test 1.2]
+
+[include glob1/*/*]
+
+[endsect] [/t1_2]
+
+[section:t2_1 Test 2.1]
+
+[include glob2/*]
+
+[endsect] [/t2_1]
+
+[section:t2_2 Test 2.2]
+
+[include glob2/*/*]
+
+[endsect] [/t2_2]

Added: trunk/tools/quickbook/test/include/glob1/a.qbk
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/glob1/a.qbk 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -0,0 +1 @@
+A

Added: trunk/tools/quickbook/test/include/glob1/glob1-1/b.qbk
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/glob1/glob1-1/b.qbk 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -0,0 +1 @@
+B

Added: trunk/tools/quickbook/test/include/glob2/a.qbk
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/glob2/a.qbk 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -0,0 +1,3 @@
+A
+
+[include */*.qbk]

Added: trunk/tools/quickbook/test/include/glob2/glob2-1/b.qbk
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/glob2/glob2-1/b.qbk 2013-11-14 14:20:38 EST (Thu, 14 Nov 2013) (r86700)
@@ -0,0 +1 @@
+B


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