From 2ab268d5b1c6da916e3e03d547e39711c2f4fd87 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 20 Dec 2015 17:09:51 +0100 Subject: [PATCH] use relative url in header, escape name and description too --- urmoms.c | 73 ++++++++++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/urmoms.c b/urmoms.c index 57b99b4..89a8d5a 100644 --- a/urmoms.c +++ b/urmoms.c @@ -111,39 +111,6 @@ err: return NULL; } -int -writeheader(FILE *fp) -{ - fputs("" - "\n\n" - "\n" - "\n", fp); - fprintf(fp, "%s%s%s\n", name, description[0] ? " - " : "", description); - fprintf(fp, "\n", relpath); - fprintf(fp, "\n", - name, relpath); - fprintf(fp, "\n", relpath); - fputs("\n\n\n", fp); - fprintf(fp, "" - "
\"\"

%s

%s
\n", - relpath, name, description); - fprintf(fp, "Log | ", relpath); - fprintf(fp, "Files", relpath); - if (hasreadme) - fprintf(fp, " | README", relpath); - if (haslicense) - fprintf(fp, " | LICENSE", relpath); - fputs("
\n
\n", fp); - - return 0; -} - -int -writefooter(FILE *fp) -{ - return !fputs("
\n", fp); -} - FILE * efopen(const char *name, const char *flags) { @@ -244,6 +211,46 @@ printtimeshort(FILE *fp, const git_time *intime) printtimeformat(fp, intime, "%Y-%m-%d %H:%M"); } +int +writeheader(FILE *fp) +{ + fputs("" + "\n\n" + "\n" + "\n", fp); + xmlencode(fp, name, strlen(name)); + if (description[0]) + fputs(" - ", fp); + xmlencode(fp, description, strlen(description)); + fprintf(fp, "\n\n", relpath); + fprintf(fp, "\n", + name, relpath); + fprintf(fp, "\n", relpath); + fputs("\n\n\n
", fp); + fprintf(fp, "\"\"", + relpath, relpath); + fputs("

", fp); + xmlencode(fp, name, strlen(name)); + fputs("

", fp); + xmlencode(fp, description, strlen(description)); + fputs("
\n", fp); + fprintf(fp, "Log | ", relpath); + fprintf(fp, "Files", relpath); + if (hasreadme) + fprintf(fp, " | README", relpath); + if (haslicense) + fprintf(fp, " | LICENSE", relpath); + fputs("
\n
\n", fp); + + return 0; +} + +int +writefooter(FILE *fp) +{ + return !fputs("
\n", fp); +} + void writeblobhtml(FILE *fp, const git_blob *blob) { -- libgit2 1.1.1