add $STAGIT_BASEURL environment variable to make Atom links absolute
With feedback from adc, thanks!
This commit is contained in:
parent
d1c528fb5a
commit
7968c0bc9c
10
stagit.1
10
stagit.1
|
@ -1,4 +1,4 @@
|
||||||
.Dd July 19, 2020
|
.Dd March 4, 2021
|
||||||
.Dt STAGIT 1
|
.Dt STAGIT 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -103,6 +103,14 @@ favicon image.
|
||||||
.It style.css
|
.It style.css
|
||||||
CSS stylesheet.
|
CSS stylesheet.
|
||||||
.El
|
.El
|
||||||
|
.Sh ENVIRONMENT
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Ev STAGIT_BASEURL
|
||||||
|
Base URL to make links in atom.xml absolute.
|
||||||
|
For example: STAGIT_BASE_URL="https://git.codemadness.org/stagit/".
|
||||||
|
.El
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr stagit-index 1
|
.Xr stagit-index 1
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
|
|
8
stagit.c
8
stagit.c
|
@ -58,6 +58,7 @@ struct referenceinfo {
|
||||||
|
|
||||||
static git_repository *repo;
|
static git_repository *repo;
|
||||||
|
|
||||||
|
static const char *baseurl = ""; /* base URL to make absolute RSS/Atom URI */
|
||||||
static const char *relpath = "";
|
static const char *relpath = "";
|
||||||
static const char *repodir;
|
static const char *repodir;
|
||||||
|
|
||||||
|
@ -807,8 +808,8 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag)
|
||||||
xmlencode(fp, ci->summary, strlen(ci->summary));
|
xmlencode(fp, ci->summary, strlen(ci->summary));
|
||||||
fputs("</title>\n", fp);
|
fputs("</title>\n", fp);
|
||||||
}
|
}
|
||||||
fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"commit/%s.html\" />\n",
|
fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"%scommit/%s.html\" />\n",
|
||||||
ci->oid);
|
baseurl, ci->oid);
|
||||||
|
|
||||||
if (ci->author) {
|
if (ci->author) {
|
||||||
fputs("<author>\n<name>", fp);
|
fputs("<author>\n<name>", fp);
|
||||||
|
@ -1184,6 +1185,9 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ((p = getenv("STAGIT_BASEURL")))
|
||||||
|
baseurl = p;
|
||||||
|
|
||||||
if (git_repository_open_ext(&repo, repodir,
|
if (git_repository_open_ext(&repo, repodir,
|
||||||
GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {
|
GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {
|
||||||
fprintf(stderr, "%s: cannot open repository\n", argv[0]);
|
fprintf(stderr, "%s: cannot open repository\n", argv[0]);
|
||||||
|
|
Loading…
Reference in a new issue