diff --git a/app/src/BooksPageWidget.cpp b/app/src/BooksPageWidget.cpp index d693c57..2000087 100644 --- a/app/src/BooksPageWidget.cpp +++ b/app/src/BooksPageWidget.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2017 Jolla Ltd. + * Copyright (C) 2015-2018 Jolla Ltd. * Contact: Slava Monich * * You may use this file under the terms of the BSD license as follows: @@ -956,19 +956,20 @@ void BooksPageWidget::onLongPressTaskDone() } } else if (task->iKind == FOOTNOTE) { if (iModel && task->iLink.length() > 0) { - std::string ref = task->iLink.substr(1); - shared_ptr note = iModel->footnoteModel(ref); + shared_ptr note = iModel->footnoteModel(task->iLink); BooksBook* book = iModel->book(); if (!note.isNull() && book) { // Render the footnote - HDEBUG("footnote" << ref.c_str()); + HDEBUG("footnote" << QString(task->iLink.c_str())); if (iFootnoteTask) iFootnoteTask->release(this); iFootnoteTask = new FootnoteTask(task->iX, task->iY, width()*3/4, height()*10, book->path(), task->iLinkText, - QString::fromStdString(ref), note, iTextStyle, + QString::fromStdString(task->iLink), note, iTextStyle, iSettings->invertColors()); iTaskQueue->submit(iFootnoteTask, this, SLOT(onFootnoteTaskDone())); + } else { + HDEBUG("bad footnote" << QString(task->iLink.c_str())); } } } else if (task->iKind == IMAGE) { diff --git a/fbreader/fbreader/fbreader/src/formats/xhtml/XHTMLReader.cpp b/fbreader/fbreader/fbreader/src/formats/xhtml/XHTMLReader.cpp index 7006ee5..3eac38a 100644 --- a/fbreader/fbreader/fbreader/src/formats/xhtml/XHTMLReader.cpp +++ b/fbreader/fbreader/fbreader/src/formats/xhtml/XHTMLReader.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus - * Copyright (C) 2016-2017 Slava Monich + * Copyright (C) 2016-2018 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -341,7 +341,8 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt std::string link; if (type && !strcmp(type, "noteref")) { hyperlinkType = FOOTNOTE; - link = href; + link = MiscUtil::decodeHtmlURL(href); + if (link[0] == '#') link = link.substr(1); } else { hyperlinkType = MiscUtil::referenceType(href); link = MiscUtil::decodeHtmlURL(href);