File tree Expand file tree Collapse file tree 6 files changed +35
-1
lines changed
testing/test_package_options Expand file tree Collapse file tree 6 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1
1
## 0.28.5-dev
2
2
* Support the latest version of ` package:analyzer ` .
3
3
* Fix hyperlinks to overriden methods (#1994 ).
4
+ * Add an option to exclude version in footer info (#1982 ).
4
5
5
6
## 0.28.4
6
7
* ** Breaking change** Change the default for ` allow-tools ` command line flag to false.
Original file line number Diff line number Diff line change @@ -1376,6 +1376,8 @@ class DartdocOptionContext extends DartdocOptionContextBase
1376
1376
1377
1377
bool get injectHtml => optionSet['injectHtml' ].valueAt (context);
1378
1378
1379
+ bool get excludeFooterVersion => optionSet['excludeFooterVersion' ].valueAt (context);
1380
+
1379
1381
ToolConfiguration get tools => optionSet['tools' ].valueAt (context);
1380
1382
1381
1383
/// _input is only used to construct synthetic options.
@@ -1611,6 +1613,8 @@ Future<List<DartdocOption>> createDartdocOptions() async {
1611
1613
DartdocOptionArgOnly <bool >('verboseWarnings' , true ,
1612
1614
help: 'Display extra debugging information and help with warnings.' ,
1613
1615
negatable: true ),
1616
+ DartdocOptionFileOnly <bool >('excludeFooterVersion' , false ,
1617
+ help: 'Excludes the package version number in the footer text' ),
1614
1618
DartdocOptionFileOnly <ToolConfiguration >('tools' , ToolConfiguration .empty,
1615
1619
convertYamlToType: ToolConfiguration .fromYamlMap,
1616
1620
help: 'A map of tool names to executable paths. Each executable must '
Original file line number Diff line number Diff line change @@ -4993,6 +4993,8 @@ class PackageGraph {
4993
4993
4994
4994
final bool hasEmbedderSdk;
4995
4995
4996
+ bool get hasFooterVersion => ! config.excludeFooterVersion;
4997
+
4996
4998
PackageGraph get packageGraph => this ;
4997
4999
4998
5000
/// Map of package name to Package.
Original file line number Diff line number Diff line change 2
2
3
3
< footer >
4
4
< span class ="no-break ">
5
- {{packageGraph.defaultPackage.name}} {{packageGraph.defaultPackage.version}}
5
+ {{packageGraph.defaultPackage.name}}
6
+ {{#packageGraph.hasFooterVersion}}
7
+ {{packageGraph.defaultPackage.version}}
8
+ {{/packageGraph.hasFooterVersion}}
6
9
</ span >
7
10
8
11
<!-- footer-text placeholder -->
Original file line number Diff line number Diff line change @@ -230,5 +230,28 @@ void main() {
230
230
File outFile = File (path.join (tempDir.path, 'index.html' ));
231
231
expect (outFile.readAsStringSync (), contains ('footer text include' ));
232
232
});
233
+
234
+ test ('--footer-text excludes version' , () async {
235
+ String _testPackagePath =
236
+ path.fromUri (_currentFileUri.resolve ('../testing/test_package_options' ));
237
+
238
+ var args = < String > [
239
+ dartdocPath,
240
+ '--output' ,
241
+ tempDir.path
242
+ ];
243
+
244
+ await subprocessLauncher.runStreamed (Platform .resolvedExecutable, args,
245
+ workingDirectory: _testPackagePath);
246
+
247
+ File outFile = File (path.join (tempDir.path, 'index.html' ));
248
+ RegExp footerRegex = RegExp ('<footer>(.*\s *?\n ?)+?</footer>' , multiLine: true );
249
+ // get footer, check for version number
250
+ RegExpMatch m = footerRegex.firstMatch (outFile.readAsStringSync ());
251
+ RegExp version = RegExp (r'(\d+\.)?(\d+\.)?(\*|\d+)' );
252
+ expect (version.hasMatch (m.group (0 )), false );
253
+ });
254
+
233
255
}, timeout: Timeout .factor (4 ));
234
256
}
257
+
Original file line number Diff line number Diff line change 8
8
linkTo :
9
9
url : ' https://nonexistingsuperpackage.topdomain/%n%/%v%'
10
10
showUndocumentedCategories : true
11
+ excludeFooterVersion : true
You can’t perform that action at this time.
0 commit comments