// Wiki // // Douglas Thrift // // $Id$ #include #include #include "Wiki.hpp" Wiki::Wiki(const cse::String &sitemap, const cse::String &base, ext::Queue &queue, api::ThreadMutex &queueLock, const _R &command) : CommandRunner(sitemap, queue, queueLock) { api::Cout << _B("Wiki") << ios::NewLine; Entries(command->root, _S() << base << command->path); } void Wiki::Entries(const api::Path &directory, const cse::String &base) { cse::String wiki(client.GetProperty(_B("GoogleTron:Wiki"), directory.GetPath())); if (wiki != _B("PmWiki")) throw ext::NotImplementedException(wiki); api::Path wikiDirectory(directory.GetChild(_B("wiki.d"))); ext::RedBlackSet excludes(GetProperties >(_B("GoogleTron:Exclude"), wikiDirectory.GetPath())); ext::RedBlackSet sections(GetProperties >(_B("GoogleTron:Section"), wikiDirectory.GetPath())); api::Pcre::RegEx wikiEntry(_B("^([^a-z].*)\\.([^a-z].*)$")); _foreach (const _L, entry, client.GetEntries(wikiDirectory.GetPath())) { api::Pcre::RegEx::Match match; if (!entry->GetName().StartsWith('.') && !excludes.Contains(entry->GetName()) && (match = wikiEntry(entry->GetName())) && sections.Contains(match[1])) api::Cout << match[1] << _B("/") << match[2] << ios::NewLine; } }