+/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
+ * BSD-style license. Please see the COPYING file for details.
+ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "database.h"
#include "json.h"
-void json_generate_one_record(yajl_gen g, const char *author, struct blerg *b, uint64_t record) {
+void json_generate_one_record(yajl_gen g, const char *author, struct blerg *b, uint64_t record, int brief) {
char *data;
char number[21];
int len;
return;
}
+ if (brief && len > 150) {
+ len = 150;
+ /* This is a bit of a hackish way to add an ellipsis, and will
+ * probably cause weird results if we overwrite part of a UTF-8
+ * char */
+ data[149] = '.';
+ data[148] = '.';
+ data[147] = '.';
+ }
+
yajl_gen_map_open(g);
if (author != NULL) {
yajl_gen_string(g, "author", 6);