Added keywords to be excluded from page listing
This commit is contained in:
parent
d86bb23c88
commit
004a333ffe
@ -3,6 +3,8 @@ import 'dart:html' show HttpRequest;
|
||||
import 'package:html/parser.dart' show parse;
|
||||
import 'package:html/dom.dart' show Element;
|
||||
|
||||
final excluded_keywords = ['index', 'CONTRIBUTING', 'LICENSE', 'README'];
|
||||
|
||||
// Get the sitemap content
|
||||
Future<String> getSitemap() async {
|
||||
const path = 'sitemap.html';
|
||||
@ -18,9 +20,12 @@ Future<String> getSitemap() async {
|
||||
Map<String, String> detectPages(List<Element> sitemap, [String prefix]) {
|
||||
final links = <String, String>{};
|
||||
for (var elem in sitemap) {
|
||||
if (elem.outerHtml.contains('index')) {
|
||||
continue;
|
||||
} else if (elem.innerHtml.startsWith('<a')) {
|
||||
for(var kw in excluded_keywords) {
|
||||
if (elem.outerHtml.contains(kw)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (elem.innerHtml.startsWith('<a')) {
|
||||
elem = elem.firstChild;
|
||||
final url = elem.attributes['href'];
|
||||
final text = elem.firstChild.text;
|
||||
|
Reference in New Issue
Block a user