[fbreader] Fixed FB2 footnotes
FB2 reader strips the leading hash sign from href, XHTML wasn't doing it. Unified their behavior.
This commit is contained in:
parent
02d86ffa67
commit
7a7067869d
2 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Jolla Ltd.
|
||||
* Copyright (C) 2015-2018 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* 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<ZLTextModel> note = iModel->footnoteModel(ref);
|
||||
shared_ptr<ZLTextModel> 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) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
||||
* Copyright (C) 2016-2017 Slava Monich <slava.monich@jolla.com>
|
||||
* Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* 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);
|
||||
|
|
Loading…
Reference in a new issue