tapas

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

commit 6020ff2d9c351521f1d4aaabb972dfaf2ca28d76
parent 14509d80f2aa0ee7753a5fa3733880c211a548d7
Author: Chris Noxz <chris@noxz.tech>
Date:   Mon, 10 Feb 2020 15:11:33 +0100

Add support for hyperlinks

Diffstat:
Mtapas.c | 35+++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/tapas.c b/tapas.c @@ -67,6 +67,7 @@ typedef struct { char site_content[BUF_SIZE]; char organization[BUF_SIZE]; char url[BUF_SIZE]; + char url_raw[BUF_SIZE]; } Referece; struct State { @@ -196,7 +197,8 @@ setattr(char type, char *val) case 's': strncpy(state.ref->site_name, val, BUF_SIZE); break; case 'c': strncpy(state.ref->site_content, val, BUF_SIZE); break; case 'o': strncpy(state.ref->organization, val, BUF_SIZE); break; - case 'u': strncpy(state.ref->url, val, BUF_SIZE); break; + case 'u': strncpy(state.ref->url, val, BUF_SIZE); + strncpy(state.ref->url_raw, val, BUF_SIZE); break; } } @@ -290,21 +292,26 @@ format_other() proto = strstr(state.ref->url, "://"); findreplace(state.ref->url, "/", "/\\:\\%", proto ? (proto - state.ref->url) + 3: 0); - switch (settings.macroset) { case ms_ms: - fprintf(stdout, - "%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, - settings.retrieved, - state.ref->additions, - settings.from, - state.ref->url - ); break; + fprintf(stdout, ".rm PDFHREF.TEXT.COLOUR\n"); + fprintf(stdout, ".ds PDFHREF.TEXT.COLOUR apa:h\n"); + fprintf(stdout, + "%s%s\n.XP\n%s (%s). \n.I \"%s\" \".\"\n%s %s, %s \n" + ".pdfhref W -D \"%s\" -A \"\\c\" -- \"%s\"\n.\n", + ".defcolor apa:h ", + settings.hrefcolor, + state.ref->author, + state.ref->publication_date, + state.ref->site_name, + settings.retrieved, + state.ref->additions, + settings.from, + state.ref->url_raw, + state.ref->url + ); + fprintf(stdout, ".als PDFHREF.TEXT.COLOUR PDFHREF.TEXT.COLOR\n"); break; + break; } }