summaryrefslogtreecommitdiff
path: root/src/gempub.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gempub.c')
-rw-r--r--src/gempub.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gempub.c b/src/gempub.c
index f3021add..1f5d58ce 100644
--- a/src/gempub.c
+++ b/src/gempub.c
@@ -94,6 +94,9 @@ static void parseNavigationLinks_Gempub_(const iGempub *d) {
94 set_String(&link.url, absoluteUrl_String(url_GmRequest(index), collectNewRange_String(url))); 94 set_String(&link.url, absoluteUrl_String(url_GmRequest(index), collectNewRange_String(url)));
95 setRange_String(&link.label, capturedRange_RegExpMatch(&m, 2)); 95 setRange_String(&link.label, capturedRange_RegExpMatch(&m, 2));
96 trim_String(&link.label); 96 trim_String(&link.label);
97 if (isEmpty_String(&link.label)) {
98 setRange_String(&link.label, url);
99 }
97 pushBack_Array(d->navLinks, &link); 100 pushBack_Array(d->navLinks, &link);
98 } 101 }
99 iEndCollect(); 102 iEndCollect();
@@ -280,7 +283,7 @@ static void appendProperty_Gempub_(const iGempub *d, const char *label,
280 } 283 }
281} 284}
282 285
283static iBool isRemote_Gempub_(const iGempub *d) { 286iBool isRemote_Gempub(const iGempub *d) {
284 return !equalCase_Rangecc(urlScheme_String(&d->baseUrl), "file"); 287 return !equalCase_Rangecc(urlScheme_String(&d->baseUrl), "file");
285} 288}
286 289
@@ -295,7 +298,7 @@ iString *coverPageSource_Gempub(const iGempub *d) {
295 } 298 }
296 appendCStr_String(out, "\n"); 299 appendCStr_String(out, "\n");
297 appendProperty_Gempub_(d, "${gempub.meta.author}:", author_GempubProperty, out); 300 appendProperty_Gempub_(d, "${gempub.meta.author}:", author_GempubProperty, out);
298 if (!isRemote_Gempub_(d)) { 301 if (!isRemote_Gempub(d)) {
299 appendFormat_String(out, "\n=> %s " book_Icon " ${gempub.cover.view}\n", 302 appendFormat_String(out, "\n=> %s " book_Icon " ${gempub.cover.view}\n",
300 cstr_String(indexPageUrl_Gempub(d))); 303 cstr_String(indexPageUrl_Gempub(d)));
301 if (hasProperty_Gempub_(d, cover_GempubProperty)) { 304 if (hasProperty_Gempub_(d, cover_GempubProperty)) {
@@ -306,12 +309,12 @@ iString *coverPageSource_Gempub(const iGempub *d) {
306 else { 309 else {
307 iString *key = collectNew_String(); /* TODO: add a helper for this */ 310 iString *key = collectNew_String(); /* TODO: add a helper for this */
308 toString_Sym(SDLK_s, KMOD_PRIMARY, key); 311 toString_Sym(SDLK_s, KMOD_PRIMARY, key);
309 appendCStr_String(out, "\n${gempub.cover.viewlocal} "); 312 appendCStr_String(out, "\n${gempub.cover.viewlocal}\n");
310 appendFormat_String(out, 313// appendFormat_String(out,
311 cstr_Lang("error.unsupported.suggestsave"), 314// cstr_Lang("error.unsupported.suggestsave"),
312 cstr_String(key), 315// cstr_String(key),
313 saveToDownloads_Label); 316// saveToDownloads_Label);
314 appendCStr_String(out, "\n"); 317// appendCStr_String(out, "\n");
315 } 318 }
316 appendCStr_String(out, "\n## ${gempub.cover.aboutbook}\n"); 319 appendCStr_String(out, "\n## ${gempub.cover.aboutbook}\n");
317 appendProperty_Gempub_(d, "${gempub.meta.version}:", version_GempubProperty, out); 320 appendProperty_Gempub_(d, "${gempub.meta.version}:", version_GempubProperty, out);