Introduction
Introduction Statistics Contact Development Disclaimer Help
use the new escaping style in geomyidae for links - stagit-gopher - static git …
git clone git://git.codemadness.org/stagit-gopher
Log
Files
Refs
README
LICENSE
---
commit dc940cae641026d49ef94d021d7a335c5b3689b3
parent a67bac151fe0a30eccfcf6593f1666d0995085db
Author: Hiltjo Posthuma <[email protected]>
Date: Tue, 26 Jul 2022 23:53:30 +0200
use the new escaping style in geomyidae for links
[| is now skipped. Escape entries only if needed, cleaning up the output a bit.
Lines starting with 't' don't need to be escaped.
Diffstat:
M stagit-gopher-index.c | 3 ++-
M stagit-gopher.c | 15 +++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c
@@ -173,7 +173,8 @@ void
writeheader(FILE *fp)
{
if (description[0]) {
- putchar('t');
+ if (description[0] == '[')
+ fputs("[|", fp);
gphtext(fp, description, strlen(description));
fputs("\n\n", fp);
}
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -463,9 +463,9 @@ gphtextnl(FILE *fp, const char *s, size_t len)
size_t i, n = 0;
for (i = 0; s[i] && i < len; i++) {
- /* escape with 't' at the start of a line */
- if (!n && (s[i] == 't' || s[i] == '['))
- putc('t', fp);
+ /* escape '[' with "[|" at the start of a line */
+ if (!n && s[i] == '[')
+ fputs("[|", fp);
switch (s[i]) {
case '\t': fputs(" ", fp);
@@ -592,7 +592,8 @@ printtimeshort(FILE *fp, const git_time *intime)
void
writeheader(FILE *fp, const char *title)
{
- putc('t', fp);
+ if (title[0] == '[')
+ fputs("[|", fp);
gphtext(fp, title, strlen(title));
if (title[0] && strippedname[0])
fputs(" - ", fp);
@@ -795,7 +796,8 @@ printshowfile(FILE *fp, struct commitinfo *ci)
if (git_patch_get_hunk(&hunk, &nhunklines, patch, j))
break;
- putc('t', fp);
+ if (hunk->header_len > 0 && hunk->header[0] == '[')
+ fputs("[|", fp);
gphtext(fp, hunk->header, hunk->header_len);
putc('\n', fp);
@@ -1024,7 +1026,8 @@ writeblob(git_object *obj, const char *fpath, const char …
fp = efopen(fpath, "w");
writeheader(fp, filename);
- putc('t', fp);
+ if (filename[0] == '[')
+ fputs("[|", fp);
gphtext(fp, filename, strlen(filename));
fprintf(fp, " (%zuB)\n", filesize);
fputs("---\n", fp);
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.