6 |
|
|
7 |
|
#include <cxx/standard.hh> |
8 |
|
|
9 |
+ |
#include <api/pcre/regex.hpp> |
10 |
+ |
|
11 |
|
#include "Wiki.hpp" |
12 |
|
|
13 |
< |
Wiki::Wiki(const cse::String &sitemap, const cse::String &base, ext::Queue<Url> &queue, api::ThreadMutex &queueLock, const _R<WikiCommand> &command) : CommandRunner(sitemap, base, queue, queueLock) |
13 |
> |
Wiki::Wiki(const cse::String &sitemap, const cse::String &base, ext::Queue<Url> &queue, api::ThreadMutex &queueLock, const _R<WikiCommand> &command) : CommandRunner(sitemap, queue, queueLock) |
14 |
|
{ |
15 |
|
api::Cout << _B("Wiki") << ios::NewLine; |
16 |
+ |
|
17 |
+ |
Entries(command->root, _S<ios::String>() << base << command->path); |
18 |
+ |
} |
19 |
+ |
|
20 |
+ |
void Wiki::Entries(const api::Path &directory, const cse::String &base) |
21 |
+ |
{ |
22 |
+ |
cse::String wiki(client.GetProperty(_B("GoogleTron:Wiki"), directory.GetPath())); |
23 |
+ |
|
24 |
+ |
if (wiki != _B("PmWiki")) |
25 |
+ |
throw ext::NotImplementedException(wiki); |
26 |
+ |
|
27 |
+ |
api::Path wikiDirectory(directory.GetChild(_B("wiki.d"))); |
28 |
+ |
ext::RedBlackSet<cse::String> excludes(GetProperties<ext::RedBlackSet<cse::String> >(_B("GoogleTron:Exclude"), wikiDirectory.GetPath())); |
29 |
+ |
ext::RedBlackSet<cse::String> sections(GetProperties<ext::RedBlackSet<cse::String> >(_B("GoogleTron:Section"), wikiDirectory.GetPath())); |
30 |
+ |
api::Pcre::RegEx wikiEntry(_B("^([^a-z].*)\\.([^a-z].*)$")); |
31 |
+ |
|
32 |
+ |
_foreach (const _L<Subversion::Entry>, entry, client.GetEntries(wikiDirectory.GetPath())) |
33 |
+ |
{ |
34 |
+ |
api::Pcre::RegEx::Match match; |
35 |
+ |
|
36 |
+ |
if (!entry->GetName().StartsWith('.') && !excludes.Contains(entry->GetName()) && (match = wikiEntry(entry->GetName())) && sections.Contains(match[1])) |
37 |
+ |
api::Cout << match[1] << _B("/") << match[2] << ios::NewLine; |
38 |
+ |
} |
39 |
|
} |