Skip to content

Commit 6735430

Browse files
committed
publish: add project URL
1 parent c39a26e commit 6735430

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

+stdlib/is_url.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
%% IS_URL is true if the string is a URL.
2+
% e.g. https://example.invalid is true
3+
14
function y = is_url(s)
25
arguments
36
s (1,1) string

Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Self-tests can be run from that matlab-stdlib/ directory:
2121
buildtool
2222
```
2323

24+
URLs (e.g. https://, s3:// and similar) are treated as not existing.
25+
2426
[API Documentation](https://geospace-code.github.io/matlab-stdlib)
2527

2628
Most Matlab-stdlib filesystem functions work without the

buildfile.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ function publishTask(~)
3030

3131
publish_gen_index_html("stdlib", ...
3232
"A standard library of functions for Matlab.", ...
33+
"https://github.com/geospace-code/matlab-stdlib", ...
3334
outdir)
3435
end

private/publish_gen_index_html.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
% * https://www.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html
88
%
99
% for package code -- assumes no classes and depth == 1
10-
function publish_gen_index_html(pkg_name, tagline, outdir)
10+
function publish_gen_index_html(pkg_name, tagline, project_url, outdir)
11+
arguments
12+
pkg_name (1,1) string
13+
tagline (1,1) string
14+
project_url (1,1) string
15+
outdir (1,1) string
16+
end
1117

1218
pkg = what("+" + pkg_name);
1319
% "+" avoids picking up cwd of same name
@@ -28,6 +34,7 @@ function publish_gen_index_html(pkg_name, tagline, outdir)
2834
"<h1>" + pkg_name + " API</h1>", ...
2935
"<p>" + tagline + "</p>", ...
3036
"<p>" + git_txt + "</p>", ...
37+
"<p>Project URL: <a href=" + project_url + ">" + project_url + "</a></p>", ...
3138
"<h2>API Reference</h2>"];
3239
fid = fopen(readme, 'w');
3340
fprintf(fid, join(txt, "\n"));
@@ -39,15 +46,13 @@ function publish_gen_index_html(pkg_name, tagline, outdir)
3946
doc_fn = publish(pkg_name + "." + name, evalCode=false, outputDir=outdir);
4047
disp(doc_fn)
4148

42-
% inject summary into Readme.md
49+
% inject summary for each function into Readme.md
4350
summary = split(string(help(pkg_name + "." + name)), newline);
4451
words = split(strip(summary(1)), " ");
4552

46-
% purposefully this will error if no docstring
53+
% error if no docstring
4754
fname = words(1);
48-
if(lower(fname) ~= lower(name))
49-
error("fname %s does not match name %s", fname, name)
50-
end
55+
assert(lower(fname) == lower(name), "fname %s does not match name %s \nis there a docstring at the top of the .m file?", fname, name)
5156

5257
line = "<a href=" + name + ".html>" + fname + "</a> ";
5358
if(length(words) > 1)

0 commit comments

Comments
 (0)