ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/Wiki.cpp
Revision: 713
Committed: 2006-03-27T00:50:21-08:00 (19 years, 3 months ago) by douglas
File size: 1413 byte(s)
Log Message:
Stuff and things...

File Contents

# User Rev Content
1 douglas 696 // Wiki
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include <cxx/standard.hh>
8    
9 douglas 713 #include <api/pcre/regex.hpp>
10    
11 douglas 696 #include "Wiki.hpp"
12    
13 douglas 713 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 douglas 696 {
15     api::Cout << _B("Wiki") << ios::NewLine;
16 douglas 713
17     Entries(command->root, _S<ios::String>() << base << command->path);
18 douglas 696 }
19 douglas 713
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     }

Properties

Name Value
svn:eol-style native
svn:keywords Id