Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions buildfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) );
Expand Down
1 change: 1 addition & 0 deletions docmaker.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tbx/docmaker/+docmaker/GitHub.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
end

obj.Hostname = hostname;
obj.Token_ = token;
obj.Token_ = docmaker.MarkdownConverter.normalizeToken( token );

end % constructor

Expand Down Expand Up @@ -95,4 +95,4 @@

end % methods

end % classdef
end % classdef
2 changes: 1 addition & 1 deletion tbx/docmaker/+docmaker/GitLab.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
end

obj.Hostname = hostname;
obj.Token_ = token;
obj.Token_ = docmaker.MarkdownConverter.normalizeToken( token );

end % constructor

Expand Down
19 changes: 18 additions & 1 deletion tbx/docmaker/+docmaker/MarkdownConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,21 @@
xml = md2xml( md )
end

end % classdef
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
6 changes: 3 additions & 3 deletions tbx/docmaker/+docmaker/converter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -74,4 +74,4 @@
tf = HAS_SECRETS; % retrieve
end

end % hasSecrets
end % hasSecrets
28 changes: 28 additions & 0 deletions tests/+docmaker/tconverter.m
Original file line number Diff line number Diff line change
@@ -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