aboutsummaryrefslogtreecommitdiff
path: root/src/stasis_indexer.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-08-26 15:29:58 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-08-26 15:30:42 -0400
commit43020d3bbd07f6583d4385e361b974c899389b70 (patch)
tree5eae968c857558350d114911406f67a861650661 /src/stasis_indexer.c
parentb91f8c354b60f9db22d4ad65a1e6f72b13c8b693 (diff)
downloadstasis-43020d3bbd07f6583d4385e361b974c899389b70.tar.gz
Tweak pandoc command and add a style sheet
Diffstat (limited to 'src/stasis_indexer.c')
-rw-r--r--src/stasis_indexer.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/stasis_indexer.c b/src/stasis_indexer.c
index 4f57a86..34f8ecf 100644
--- a/src/stasis_indexer.c
+++ b/src/stasis_indexer.c
@@ -119,12 +119,7 @@ int indexer_load_metadata(struct Delivery *ctx, const char *filename) {
} else if (!strcmp(name, "codename")) {
ctx->meta.codename = strdup(value);
} else if (!strcmp(name, "platform")) {
- ctx->system.platform = calloc(DELIVERY_PLATFORM_MAX, sizeof(*ctx->system.platform));
- char **platform = split(value, " ", 0);
- ctx->system.platform[DELIVERY_PLATFORM] = platform[DELIVERY_PLATFORM];
- ctx->system.platform[DELIVERY_PLATFORM_CONDA_SUBDIR] = platform[DELIVERY_PLATFORM_CONDA_SUBDIR];
- ctx->system.platform[DELIVERY_PLATFORM_CONDA_INSTALLER] = platform[DELIVERY_PLATFORM_CONDA_INSTALLER];
- ctx->system.platform[DELIVERY_PLATFORM_RELEASE] = platform[DELIVERY_PLATFORM_RELEASE];
+ ctx->system.platform = split(value, " ", 0);
} else if (!strcmp(name, "arch")) {
ctx->system.arch = strdup(value);
} else if (!strcmp(name, "time")) {
@@ -238,6 +233,15 @@ int indexer_make_website(struct Delivery *ctx) {
return 0;
}
+ char *css_filename = calloc(PATH_MAX, sizeof(*css_filename));
+ if (!css_filename) {
+ SYSERROR("unable to allocate string for CSS file path: %s", strerror(errno));
+ return -1;
+ }
+
+ sprintf(css_filename, "%s/%s", globals.sysconfdir, "stasis_pandoc.css");
+ int have_css = access(css_filename, F_OK | R_OK) == 0;
+
struct StrList *dirs = strlist_init();
strlist_append(&dirs, ctx->storage.delivery_dir);
strlist_append(&dirs, ctx->storage.results_dir);
@@ -269,7 +273,16 @@ int indexer_make_website(struct Delivery *ctx) {
// Converts a markdown file to html
strcpy(cmd, "pandoc ");
+ strcat(cmd, "--embed-resources ");
strcat(cmd, "--standalone ");
+ strcat(cmd, "-f markdown+alerts ");
+ strcat(cmd, "-f markdown+autolink_bare_uris ");
+ if (have_css) {
+ strcat(cmd, "--css ");
+ strcat(cmd, css_filename);
+ }
+ strcat(cmd, " ");
+ strcat(cmd, "--metadata title=\"STASIS\" ");
strcat(cmd, "-o ");
strcat(cmd, fullpath_dest);
strcat(cmd, " ");