tapas

[discontinued] A small program used for compiling refer output into the APA reference format.
git clone https://noxz.tech/git/tapas.git
Log | Files | README | LICENSE

commit: d6fd69e9d81d1de509370f3e54d07f55b5fac86b
parent: 9e49193874e0345f42604fef28a80dfa221df4b5
author: Chris Noxz <chris@noxz.tech>
date:   Mon, 2 Dec 2019 20:51:44 +0100
Fix formatting and add href colorization
Mtapas.c9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tapas.c b/tapas.c
@@ -38,6 +38,7 @@
 #define STR_FR      ".ds APA_FR "
 #define STR_RE      ".ds APA_RE "
 #define STR_MS      ".ds APA_MS "
+#define STR_HC      ".ds APA_HC "
 
 typedef struct {
     char author[BUF_SIZE];
@@ -81,6 +82,7 @@ struct Settings {
     char in[BUF_SIZE];
     char from[BUF_SIZE];
     char retrieved[BUF_SIZE];
+    char hrefcolor[BUF_SIZE];
     char ms[BUF_SIZE];
 };
 struct Settings settings;
@@ -259,7 +261,9 @@ format_other()
     switch (settings.macroset) {
     case ms_ms:
     fprintf(stdout,
-        ".XP\n%s (%s). \n.I \"%s\" \".\"\n%s %s, %s %s\n",
+        "%s%s\n.XP\n%s (%s). \n.I \"%s\" \".\"\n%s %s, %s \\m[apa:h]%s\\m[].\n",
+        ".defcolor apa:h ",
+        settings.hrefcolor,
         state.ref->author,
         state.ref->publication_date,
         state.ref->site_name,
@@ -361,6 +365,8 @@ loadstr(char *line)
         trim(settings.from);
     else if (readstr(line, STR_RE, settings.retrieved, BUF_SIZE))
         trim(settings.retrieved);
+    else if (readstr(line, STR_HC, settings.hrefcolor, BUF_SIZE))
+        trim(settings.hrefcolor);
     else if (readstr(line, STR_MS, settings.ms, BUF_SIZE))
         trim(settings.ms);
     else
@@ -398,6 +404,7 @@ main(int arc, char *argv[])
     strcpy(settings.in, "In");
     strcpy(settings.from, "from");
     strcpy(settings.retrieved, "Retrieved");
+    strcpy(settings.hrefcolor, "rgb 0f 0.325f 0.525f");
     strcpy(settings.ms, "");
 
     /* default state */