From 67962188eac31d922ad18344af3d60636e0dca21 Mon Sep 17 00:00:00 2001 From: vxern Date: Sun, 22 Aug 2021 15:40:58 +0100 Subject: [PATCH] Formatted files in accordance with `dartfmt` --- .gitignore | 4 +- CHANGELOG.md | 6 +- example/example.dart | 4 +- lib/src/parser.dart | 13 ++--- lib/src/utils.dart | 4 +- pubspec.lock | 131 ------------------------------------------- pubspec.yaml | 2 +- 7 files changed, 16 insertions(+), 148 deletions(-) delete mode 100644 pubspec.lock diff --git a/.gitignore b/.gitignore index 3c8a157..7fecf94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ # Files and directories created by pub. .dart_tool/ .packages - -# Conventional directory for build output. -build/ +pubspec.lock \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c08ceb..6450003 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,4 +6,8 @@ - Fixed the reading of the contents of `robots.txt` - Fixed the parsing of rule fields to `Rule`s - - Added `example.dart` \ No newline at end of file + - Added `example.dart` + +## 1.1.0+1 + + - Formatted files in accordance with `dartfmt` \ No newline at end of file diff --git a/example/example.dart b/example/example.dart index c9270a6..fd25b8b 100644 --- a/example/example.dart +++ b/example/example.dart @@ -7,7 +7,7 @@ Future main() async { await robots.read(); // Print the ruleset for (final ruleset in robots.rulesets) { - // Print the user-agent the ruleset applies to + // Print the user-agent the ruleset applies to print(ruleset.appliesTo); if (ruleset.allows.isNotEmpty) { print('Allows:'); @@ -29,4 +29,4 @@ Future main() async { // True, it can print(robots.canVisitPath('/wordcollector/robots_txt', userAgent: '*')); return; -} \ No newline at end of file +} diff --git a/lib/src/parser.dart b/lib/src/parser.dart index 4865674..4170186 100644 --- a/lib/src/parser.dart +++ b/lib/src/parser.dart @@ -3,7 +3,6 @@ import 'package:web_scraper/web_scraper.dart'; import 'package:robots_txt/src/rule.dart'; import 'package:robots_txt/src/ruleset.dart'; -import 'package:robots_txt/src/utils.dart'; /// Abstracts away the rather convoluted declaration for an element with two /// fields; 'title' and 'attributes'. 'attributes' is a map containing the @@ -95,19 +94,17 @@ class Robots { /// regular expression for later matching RegExp convertFieldPathToExpression(String pathDeclaration) { // Collapse duplicate slashes and wildcards into singles - final collapsed = pathDeclaration - .replaceAll('/+', '/') - .replaceAll('*+', '*'); + final collapsed = + pathDeclaration.replaceAll('/+', '/').replaceAll('*+', '*'); final normalised = collapsed.endsWith('*') ? collapsed.substring(0, collapsed.length - 1) : collapsed; - final withWildcardsReplaced = normalised - .replaceAll('.', r'\.') - .replaceAll('*', '.*'); + final withWildcardsReplaced = + normalised.replaceAll('.', r'\.').replaceAll('*', '.*'); final withTrailingText = withWildcardsReplaced.contains(r'$') ? withWildcardsReplaced.split(r'$')[0] : '$withWildcardsReplaced.*'; - return RegExp(withTrailingText, caseSensitive: false, dotAll: true); + return RegExp(withTrailingText, caseSensitive: false, dotAll: true); } /// Extracts the key and value from [target] and puts it into a `MapEntry` diff --git a/lib/src/utils.dart b/lib/src/utils.dart index a3119d5..5be7745 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -1,3 +1,3 @@ /// Taking the singular form of [word], morph it according to [count] -String pluralise(String word, int count) => - '${count == 0 ? 'no' : count} ${count == 0 || count > 1 ? '${word}s' : word}'; +String pluralise(String word, int count) => '${count == 0 ? 'no' : count} ' + '${count == 0 || count > 1 ? '${word}s' : word}'; diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index b5dbabb..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,131 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - ansicolor: - dependency: transitive - description: - name: ansicolor - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.2" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.17.0" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.15.0" - http: - dependency: transitive - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.3" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "4.0.0" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.1" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - sprint: - dependency: "direct main" - description: - name: sprint - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2+2" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - web_scraper: - dependency: "direct main" - description: - name: web_scraper - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.4" - words: - dependency: "direct dev" - description: - name: words - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+2" -sdks: - dart: ">=2.13.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 56aecc0..abae3b1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ publish_to: https://pub.dev name: robots_txt -version: 1.1.0 +version: 1.1.0+1 description: Lightweight, sturdy and fully-documented parser of the `robots.txt` file.