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 11## 0.28.5-dev
22* Support the latest version of ` package:analyzer ` .
33* Fix hyperlinks to overriden methods (#1994 ).
4+ * Add an option to exclude version in footer info (#1982 ).
45
56## 0.28.4
67* ** 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
13761376
13771377 bool get injectHtml => optionSet['injectHtml' ].valueAt (context);
13781378
1379+ bool get excludeFooterVersion => optionSet['excludeFooterVersion' ].valueAt (context);
1380+
13791381 ToolConfiguration get tools => optionSet['tools' ].valueAt (context);
13801382
13811383 /// _input is only used to construct synthetic options.
@@ -1611,6 +1613,8 @@ Future<List<DartdocOption>> createDartdocOptions() async {
16111613 DartdocOptionArgOnly <bool >('verboseWarnings' , true ,
16121614 help: 'Display extra debugging information and help with warnings.' ,
16131615 negatable: true ),
1616+ DartdocOptionFileOnly <bool >('excludeFooterVersion' , false ,
1617+ help: 'Excludes the package version number in the footer text' ),
16141618 DartdocOptionFileOnly <ToolConfiguration >('tools' , ToolConfiguration .empty,
16151619 convertYamlToType: ToolConfiguration .fromYamlMap,
16161620 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 {
49934993
49944994 final bool hasEmbedderSdk;
49954995
4996+ bool get hasFooterVersion => ! config.excludeFooterVersion;
4997+
49964998 PackageGraph get packageGraph => this ;
49974999
49985000 /// Map of package name to Package.
Original file line number Diff line number Diff line change 22
33< footer >
44 < 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}}
69 </ span >
710
811 <!-- footer-text placeholder -->
Original file line number Diff line number Diff line change @@ -230,5 +230,28 @@ void main() {
230230 File outFile = File (path.join (tempDir.path, 'index.html' ));
231231 expect (outFile.readAsStringSync (), contains ('footer text include' ));
232232 });
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+
233255 }, timeout: Timeout .factor (4 ));
234256}
257+
Original file line number Diff line number Diff line change 88 linkTo :
99 url : ' https://nonexistingsuperpackage.topdomain/%n%/%v%'
1010 showUndocumentedCategories : true
11+ excludeFooterVersion : true
You can’t perform that action at this time.
0 commit comments