|
1 | 1 | import 'dart:collection'; |
2 | 2 | import 'dart:io'; |
3 | 3 |
|
| 4 | +import 'package:path/path.dart' as p; |
| 5 | + |
4 | 6 | const _doxygenTags = <String>[ |
5 | 7 | 'brief', |
6 | 8 | 'details', |
@@ -50,7 +52,7 @@ final _codeBlockStartRegExp = RegExp( |
50 | 52 | final _versionedTizenLibraryPathRegExp = RegExp( |
51 | 53 | r'(^|[\\/])lib[\\/](\d+\.\d+)[\\/]tizen\.dart$', |
52 | 54 | ); |
53 | | -final _pathSeparatorRegExp = RegExp(r'[\\/]'); |
| 55 | +final _listRegExp = RegExp(r'^\d+\.\s'); |
54 | 56 | final _topLevelDeclarationRegExp = RegExp( |
55 | 57 | r'^(typedef|(?:abstract|final)\s+class|class|enum)\s+', |
56 | 58 | ); |
@@ -172,7 +174,7 @@ void main(List<String> args) { |
172 | 174 | if (bindingDir.existsSync()) { |
173 | 175 | for (final entry in bindingDir.listSync()) { |
174 | 176 | if (entry is File) { |
175 | | - final fileName = entry.path.split(_pathSeparatorRegExp).last; |
| 177 | + final fileName = p.basename(entry.path); |
176 | 178 | if (fileName.startsWith('generated_bindings') && |
177 | 179 | fileName.endsWith('.dart')) { |
178 | 180 | pathsToProcess.add(entry.path); |
@@ -311,7 +313,7 @@ bool _shouldHideTopLevelGeneratedBindingsDeclarations(String? path) { |
311 | 313 | return false; |
312 | 314 | } |
313 | 315 |
|
314 | | - final fileName = path.split(_pathSeparatorRegExp).last; |
| 316 | + final fileName = p.basename(path); |
315 | 317 | return fileName == 'generated_bindings.dart'; |
316 | 318 | } |
317 | 319 |
|
@@ -1064,7 +1066,7 @@ String _mergeDocText(String current, String next) { |
1064 | 1066 | final nextTrimmed = next.trimLeft(); |
1065 | 1067 | if (nextTrimmed.startsWith('- ') || |
1066 | 1068 | nextTrimmed.startsWith('* ') || |
1067 | | - RegExp(r'^\d+\.\s').hasMatch(nextTrimmed)) { |
| 1069 | + _listRegExp.hasMatch(nextTrimmed)) { |
1068 | 1070 | return '$current\n$next'; |
1069 | 1071 | } |
1070 | 1072 | return '$current $next'; |
|
0 commit comments