diff --git a/stagit.c b/stagit.c
@@ -73,7 +73,6 @@ static char *licensefiles[] = { "HEAD:LICENSE", "HEAD:COPYING" };
static char *license;
static char *readmefiles[] = { "HEAD:README", "HEAD:README.md", "HEAD:README.adoc" };
static char *readme;
-static bool fancy_readme = false; /* wether or not do we hace a fancy README */
static long long nlogcommits = -1; /* < 0 indicates not used */
/* cache */
@@ -493,21 +492,8 @@ void writeheader(FILE *fp, const char *title)
if (submodules)
fprintf(fp, "<li><a href=\"%sfile/%s.html\">Submodules</a></li>\n",
relpath, submodules);
-
if (readme)
- {
- if (fancy_readme)
- {
- fprintf(fp, "<li><a href=\"%sREADME.html\">README</a></li>\n",
- relpath);
- }
- else
- {
- fprintf(fp, "<li><a href=\"%sfile/%s.html\">README</a></li>\n",
- relpath, readme);
- }
- }
-
+ fprintf(fp, "<li><a href=\"%s\">README</a></li>\n", readme);
if (license)
fprintf(fp, "<li><a href=\"%sfile/%s.html\">LICENSE</a></li>\n",
relpath, license);
@@ -1268,16 +1254,22 @@ int main(int argc, char *argv[])
char *ext = readme + strlen("README.");
// If the README is a Markdown file, use CMark to render it as HTML
- if (!strcmp(ext, "md") || !strcmp(ext, "MD"))
+ if (!strcmp(ext, "md"))
{
readme = "README.html";
- fancy_readme = true;
fp = efopen(readme, "w");
writeheader(fp, "README");
write_markdown_readme(fp, (git_blob*)obj);
+ writefooter(fp);
fclose(fp);
}
+ else
+ {
+ char *tmp;
+ sprintf(tmp, "%sfile/%s.html", realpath, readme);
+ readme = tmp;
+ }
}
git_object_free(obj);
}