Better coding style

This commit is contained in:
2020-05-10 12:37:22 +02:00
parent aa4600b588
commit 8ca55cb710
3 changed files with 20 additions and 22 deletions

View File

@@ -3,7 +3,7 @@ import 'dart:html' as html show HttpRequest, Element, querySelector;
import 'package:html/parser.dart' show parse;
import 'package:html/dom.dart' as dom show Element;
final excluded_keywords = ['index', 'CONTRIBUTING', 'LICENSE', 'README'];
final excluded_keywords = {'index', 'CONTRIBUTING', 'LICENSE', 'README'};
// Get the sitemap content
Future<String> fetchRemoteSitemap() async {
@@ -31,7 +31,9 @@ Map<String, String> detectPages(List<dom.Element> sitemap, [String prefix]) {
final text = elem.firstChild.text;
links[url] = (prefix == null) ? text : '$text ($prefix)';
} else {
final prefix = elem.firstChild.text;
prefix = (prefix == null)
? elem.firstChild.text
: '$prefix / ${elem.firstChild.text}';
final ul = elem.children[0].children;
links.addAll(detectPages(ul, prefix));
}
@@ -68,4 +70,5 @@ Future<html.Element> getSitemap() async {
drop_container = html.querySelector('#drop-page');
} while (drop_container != null);
pages.forEach((link) => drop_container.append(link));
return drop_container;
}