40 |
|
} |
41 |
|
} |
42 |
|
|
43 |
< |
if (siteIndex != "" && siteMap != "") |
43 |
> |
if (!siteIndex.empty() && !siteMap.empty()) |
44 |
|
{ |
45 |
|
XMLPlatformUtils::Initialize(); |
46 |
|
XPathEvaluator::initialize(); |
81 |
|
|
82 |
|
if (list == 0) return; |
83 |
|
|
84 |
+ |
comment << evaluator.evaluate(support, document, |
85 |
+ |
XalanDOMString("comment()").c_str())->str(); |
86 |
+ |
|
87 |
+ |
if (debug) cerr << "comment = " << comment.str() << '\n'; |
88 |
+ |
|
89 |
|
item = evaluator.createXPath(XalanDOMString("item").c_str()); |
90 |
|
address = evaluator.createXPath(XalanDOMString("link/@address").c_str()); |
91 |
|
link = evaluator.createXPath(XalanDOMString("link").c_str()); |
103 |
|
{ |
104 |
|
NodeRefList nodes = evaluator.selectNodeList(support, list, *item); |
105 |
|
|
106 |
< |
for (int index = 0; index < nodes.getLength(); index++) |
106 |
> |
for (int index(0); index < nodes.getLength(); ++index) |
107 |
|
{ |
108 |
|
XalanNode* node = nodes.item(index); |
109 |
|
ostringstream url, title; |
138 |
|
NodeRefList nodes = evaluator.selectNodeList(support, document, |
139 |
|
XalanDOMString("/index/page").c_str()); |
140 |
|
|
141 |
< |
for (int index = 0; index < nodes.getLength(); index++) |
141 |
> |
for (int index(0); index < nodes.getLength(); ++index) |
142 |
|
{ |
143 |
|
XalanNode* node = nodes.item(index); |
144 |
|
ostringstream address; |
163 |
|
if (page == matcher(string("^Douglas\\sThrift's\\sWebsite\\s\\|\\sDou") |
164 |
|
+ "glas\\sThrift's\\sBlog:\\s(.+)$")) |
165 |
|
{ |
166 |
< |
if (Matcher("^\\w+\\s\\d\\d\\d\\d\\sArchives$") == matcher[1]) |
166 |
> |
if (Matcher("^\\w+\\s\\d{4}\\sArchives$") == matcher[1]) |
167 |
|
{ |
168 |
|
page.setTitle(matcher[1]); |
169 |
|
|
194 |
|
|
195 |
|
bool SiteMapper::newIndex(vector<Page>& pages, Page& page) |
196 |
|
{ |
197 |
< |
for (unsigned index = 0; index < pages.size(); index++) |
197 |
> |
for (unsigned index(0); index < pages.size(); ++index) |
198 |
|
{ |
199 |
|
if (pages[index] == page.getAddress()) |
200 |
|
{ |
206 |
|
|
207 |
|
pages[index] = page; |
208 |
|
|
209 |
+ |
cout << "Updated: " << page.getUrl() << '\n'; |
210 |
+ |
|
211 |
|
return true; |
212 |
|
} |
213 |
|
else if (matcher('^' + pages[index].getPath()) == page) |
236 |
|
<< "<?xml-stylesheet type=\"text/xsl\" href=\"stylesheets/sitemap.xsl" |
237 |
|
<< "\"?>\n" |
238 |
|
<< "<!DOCTYPE page SYSTEM \"stylesheets/page.dtd\">\n" |
239 |
< |
<< "<!-- $Id$ -->\n" |
239 |
> |
<< "<!--" << comment.str() << "-->\n" |
240 |
|
<< "<page>\n" |
241 |
|
<< "\t<title>Sitemap</title>\n" |
242 |
|
<< "\t<section>\n" |
243 |
|
<< "\t\t<list>\n"; |
244 |
|
|
245 |
< |
for (unsigned index = 0; index < pages.size(); index++) |
245 |
> |
for (unsigned index(0); index < pages.size(); ++index) |
246 |
|
{ |
247 |
|
if (newPages.find(pages[index].getAddress()) != newPages.end()) |
248 |
|
{ |
263 |
|
void SiteMapper::newMap(vector<Page>& pages, const string& childOf, |
264 |
|
multimap<string, Page>& newPages) |
265 |
|
{ |
266 |
< |
for (unsigned index = 0; index < pages.size(); index++) |
266 |
> |
for (unsigned index(0); index < pages.size(); ++index) |
267 |
|
{ |
268 |
|
newMap(pages[index].getChildren(), pages[index].getPath(), newPages); |
269 |
|
} |
270 |
|
|
271 |
< |
for (multimap<string, Page>::iterator itor = newPages.lower_bound(childOf); |
271 |
> |
for (multimap<string, Page>::iterator itor(newPages.lower_bound(childOf)); |
272 |
|
itor != newPages.upper_bound(childOf); itor++) |
273 |
|
{ |
274 |
+ |
cout << "Added: " << itor->second.getUrl() << '\n'; |
275 |
+ |
|
276 |
|
pages.push_back(itor->second); |
277 |
|
} |
278 |
|
|