X-Git-Url: https://git.armaanb.net/?a=blobdiff_plain;f=src%2Fstagit-index.c;h=2a23e8f943dd4de5df20c96ade90564193172515;hb=0bb810d3a94a225fbc7cf099bd92608de0baa45b;hp=5454edb0a2fbae91e7cb0aa9944b2c185e5bd2ec;hpb=515bec49452f7691c022be27e2cf80c7e517cf41;p=stagit.git diff --git a/src/stagit-index.c b/src/stagit-index.c index 5454edb..2a23e8f 100644 --- a/src/stagit-index.c +++ b/src/stagit-index.c @@ -8,6 +8,10 @@ #include +#ifdef HAS_CMARK +#include +#endif + #include "cp.h" static git_repository *repo; @@ -75,11 +79,35 @@ writeheader(char *path) fprintf(fp, "\n\n", relpath); fprintf(fp, "\n", relpath); fputs("\n\n", fp); - fprintf(fp, "\n\n" - "\n" + "

", relpath); xmlencode(fp, description, strlen(description)); - fputs("

\n
\"\"

", relpath); + fprintf(fp, "

\n" - "
\n
\n
\n" + fputs("\n", fp); + + FILE *longdesc = fopen("desc.md", "r"); + if (longdesc == NULL) longdesc = fopen("desc", "r"); + if (longdesc != NULL) { + char c = fgetc(longdesc); +#ifdef HAS_CMARK + char buf[2048]; + while (c != EOF) { + strncat(buf, &c, 1); + c = fgetc(longdesc); + } + char *md = cmark_markdown_to_html(buf, strlen(buf), CMARK_OPT_DEFAULT); + fprintf(fp, md, relpath); + free(md); +#else + fputs("

\n", fp); + while (c != EOF) { + fprintf(fp, &c, relpath); + c = fgetc(longdesc); + } +#endif + fclose(longdesc); + } + + fputs("

\n
\n
\n" "\n" "" ""
NameDescriptionOwnerLast commit