From 23e31410556e9b4e22c3742b2b137bd5d96abac8 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 29 May 2021 07:17:45 +0300 Subject: Gempub: Fixed glitches in DocumentWidget --- src/gempub.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/gempub.c') 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) { set_String(&link.url, absoluteUrl_String(url_GmRequest(index), collectNewRange_String(url))); setRange_String(&link.label, capturedRange_RegExpMatch(&m, 2)); trim_String(&link.label); + if (isEmpty_String(&link.label)) { + setRange_String(&link.label, url); + } pushBack_Array(d->navLinks, &link); } iEndCollect(); @@ -280,7 +283,7 @@ static void appendProperty_Gempub_(const iGempub *d, const char *label, } } -static iBool isRemote_Gempub_(const iGempub *d) { +iBool isRemote_Gempub(const iGempub *d) { return !equalCase_Rangecc(urlScheme_String(&d->baseUrl), "file"); } @@ -295,7 +298,7 @@ iString *coverPageSource_Gempub(const iGempub *d) { } appendCStr_String(out, "\n"); appendProperty_Gempub_(d, "${gempub.meta.author}:", author_GempubProperty, out); - if (!isRemote_Gempub_(d)) { + if (!isRemote_Gempub(d)) { appendFormat_String(out, "\n=> %s " book_Icon " ${gempub.cover.view}\n", cstr_String(indexPageUrl_Gempub(d))); if (hasProperty_Gempub_(d, cover_GempubProperty)) { @@ -306,12 +309,12 @@ iString *coverPageSource_Gempub(const iGempub *d) { else { iString *key = collectNew_String(); /* TODO: add a helper for this */ toString_Sym(SDLK_s, KMOD_PRIMARY, key); - appendCStr_String(out, "\n${gempub.cover.viewlocal} "); - appendFormat_String(out, - cstr_Lang("error.unsupported.suggestsave"), - cstr_String(key), - saveToDownloads_Label); - appendCStr_String(out, "\n"); + appendCStr_String(out, "\n${gempub.cover.viewlocal}\n"); +// appendFormat_String(out, +// cstr_Lang("error.unsupported.suggestsave"), +// cstr_String(key), +// saveToDownloads_Label); +// appendCStr_String(out, "\n"); } appendCStr_String(out, "\n## ${gempub.cover.aboutbook}\n"); appendProperty_Gempub_(d, "${gempub.meta.version}:", version_GempubProperty, out); -- cgit v1.2.3