diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-05 19:05:36 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-05 19:05:36 +0300 |
commit | b9ce4093ed176e3614e2ea2cc2416cd1070dc1df (patch) | |
tree | 5d25b5bdae65b4d67ec42b28fc9414a407872f02 | |
parent | 04a8e5fc92b2187658e729dc4bed8fb2562caead (diff) |
Gempub: Relative links are considered navigable
-rw-r--r-- | src/gempub.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gempub.c b/src/gempub.c index e1f246ac..0f0345dc 100644 --- a/src/gempub.c +++ b/src/gempub.c | |||
@@ -85,13 +85,17 @@ static void parseNavigationLinks_Gempub_(const iGempub *d) { | |||
85 | init_RegExpMatch(&m); | 85 | init_RegExpMatch(&m); |
86 | if (matchRange_RegExp(linkPattern, line, &m)) { | 86 | if (matchRange_RegExp(linkPattern, line, &m)) { |
87 | iBeginCollect(); | 87 | iBeginCollect(); |
88 | iGempubNavLink link; | ||
89 | init_GempubNavLink(&link); | ||
90 | const iRangecc url = capturedRange_RegExpMatch(&m, 1); | 88 | const iRangecc url = capturedRange_RegExpMatch(&m, 1); |
91 | set_String(&link.url, absoluteUrl_String(url_GmRequest(index), collectNewRange_String(url))); | 89 | iUrl parts; |
92 | setRange_String(&link.label, capturedRange_RegExpMatch(&m, 2)); | 90 | init_Url(&parts, collectNewRange_String(url)); |
93 | trim_String(&link.label); | 91 | if (isEmpty_Range(&parts.scheme)) { |
94 | pushBack_Array(d->navLinks, &link); | 92 | iGempubNavLink link; |
93 | init_GempubNavLink(&link); | ||
94 | set_String(&link.url, absoluteUrl_String(url_GmRequest(index), collectNewRange_String(url))); | ||
95 | setRange_String(&link.label, capturedRange_RegExpMatch(&m, 2)); | ||
96 | trim_String(&link.label); | ||
97 | pushBack_Array(d->navLinks, &link); | ||
98 | } | ||
95 | iEndCollect(); | 99 | iEndCollect(); |
96 | } | 100 | } |
97 | } | 101 | } |