diff --git a/buildfile.m b/buildfile.m index 40119a6..19d9c93 100644 --- a/buildfile.m +++ b/buildfile.m @@ -83,6 +83,11 @@ function packageTask( ~ ) s.ToolboxName = v.Name; s.ToolboxVersion = v.Version; +% Specify the package name from R2026b +if ~isMATLABReleaseOlderThan( "R2026b" ) + s.PackageName = s.Name; +end % if + if getenv( "GITHUB_ACTIONS" ) == "true" % Check version and tag compatibility for release ref = string( getenv( "GITHUB_REF" ) ); diff --git a/docmaker.json b/docmaker.json index a40dc0a..0979880 100644 --- a/docmaker.json +++ b/docmaker.json @@ -1,4 +1,5 @@ { + "Name":"MATLAB_DocMaker", "Identifier":"ae82d5d2-45be-4fc5-a01b-70d8bb905ca2", "Summary":"Create MATLAB toolbox documentation from Markdown documents and MATLAB scripts", "Description":"With DocMaker, you can:\n* write documentation in Markdown and convert to HTML for viewing in MATLAB\n* run MATLAB scripts and capture output as images for inclusion in documentation\n* create MATLAB documentation index files from a Markdown table of contents", diff --git a/tbx/docmaker/+docmaker/GitHub.m b/tbx/docmaker/+docmaker/GitHub.m index 870b1c9..e7683fb 100644 --- a/tbx/docmaker/+docmaker/GitHub.m +++ b/tbx/docmaker/+docmaker/GitHub.m @@ -32,7 +32,7 @@ end obj.Hostname = hostname; - obj.Token_ = token; + obj.Token_ = docmaker.MarkdownConverter.normalizeToken( token ); end % constructor @@ -95,4 +95,4 @@ end % methods -end % classdef \ No newline at end of file +end % classdef diff --git a/tbx/docmaker/+docmaker/GitLab.m b/tbx/docmaker/+docmaker/GitLab.m index c28fd82..6b83669 100644 --- a/tbx/docmaker/+docmaker/GitLab.m +++ b/tbx/docmaker/+docmaker/GitLab.m @@ -32,7 +32,7 @@ end obj.Hostname = hostname; - obj.Token_ = token; + obj.Token_ = docmaker.MarkdownConverter.normalizeToken( token ); end % constructor diff --git a/tbx/docmaker/+docmaker/MarkdownConverter.m b/tbx/docmaker/+docmaker/MarkdownConverter.m index ef2a473..ddfa0d3 100644 --- a/tbx/docmaker/+docmaker/MarkdownConverter.m +++ b/tbx/docmaker/+docmaker/MarkdownConverter.m @@ -10,4 +10,21 @@ xml = md2xml( md ) end -end % classdef \ No newline at end of file + methods ( Static, Access = protected ) + + function token = normalizeToken( token ) + %normalizeToken Normalize an access token + + arguments + token(1, 1) string + end + + if ~ismissing( token ) && strlength( token ) == 0 + token = missing; + end + + end % normalizeToken + + end % methods ( Access = protected ) + +end % classdef diff --git a/tbx/docmaker/+docmaker/converter.m b/tbx/docmaker/+docmaker/converter.m index 36b35cb..424cd86 100644 --- a/tbx/docmaker/+docmaker/converter.m +++ b/tbx/docmaker/+docmaker/converter.m @@ -18,11 +18,11 @@ switch lower( n ) case "github" h = getValue( "GitHub hostname", "api.github.com" ); - t = getValue( "GitHub token", "" ); + t = getValue( "GitHub token", missing ); c = docmaker.GitHub( h, t ); case "gitlab" h = getValue( "GitLab hostname", "www.gitlab.com" ); - t = getValue( "GitLab token", "" ); + t = getValue( "GitLab token", missing ); c = docmaker.GitLab( h, t ); otherwise error( "docmaker:Unhandled", "Unknown converter ""%s"".", n ) @@ -74,4 +74,4 @@ tf = HAS_SECRETS; % retrieve end -end % hasSecrets \ No newline at end of file +end % hasSecrets diff --git a/tests/+docmaker/tconverter.m b/tests/+docmaker/tconverter.m new file mode 100644 index 0000000..7f98b54 --- /dev/null +++ b/tests/+docmaker/tconverter.m @@ -0,0 +1,28 @@ +classdef tconverter < matlab.unittest.TestCase + %TCONVERTER Tests for DocMaker converter configuration. + + methods ( Test ) + + function tEmptyGitHubTokenIsMissing( testCase ) + + converter = docmaker.GitHub( "api.github.com", "" ); + + testCase.verifyClass( converter, "docmaker.GitHub" ) + testCase.verifyTrue( ismissing( converter.Token ), ... + "An empty GitHub token should not authenticate requests." ) + + end % tEmptyGitHubTokenIsMissing + + function tEmptyGitLabTokenIsMissing( testCase ) + + converter = docmaker.GitLab( "gitlab.com", "" ); + + testCase.verifyClass( converter, "docmaker.GitLab" ) + testCase.verifyTrue( ismissing( converter.Token ), ... + "An empty GitLab token should not authenticate requests." ) + + end % tEmptyGitLabTokenIsMissing + + end % methods ( Test ) + +end % classdef