mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
reference shortening in ePubs; updated TODO
This commit is contained in:
parent
fbce4d979a
commit
b783fa99b9
3 changed files with 19 additions and 12 deletions
5
TODO.1.5
5
TODO.1.5
|
@ -8,13 +8,14 @@ litres: author photos
|
|||
* <hr/> tag
|
||||
* the SJ book:
|
||||
** empty pages at start (in emulator)
|
||||
** hyperlinks (including button image)
|
||||
DONE hyperlinks (including button image)
|
||||
** TOC!!!
|
||||
* Network library initialization in ProcessHyperlinkAction :(
|
||||
* "Use embedded fonts" option
|
||||
* "Scan hidden directories" option
|
||||
* ePub:
|
||||
DONE reference resolver (Имя розы)
|
||||
** reference shortening in native code (like java code shortening)
|
||||
DONE reference shortening in native code (like java code shortening)
|
||||
DONE large covers (cover mark for images in native code)
|
||||
* "modes" for wallpapers: tile, fullscreen, etc.
|
||||
* zip: re-use open files
|
||||
|
|
|
@ -346,10 +346,16 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt
|
|||
const FBTextKind hyperlinkType = MiscUtil::referenceType(href);
|
||||
std::string link = MiscUtil::decodeHtmlURL(href);
|
||||
if (hyperlinkType == INTERNAL_HYPERLINK) {
|
||||
link = (link[0] == '#') ?
|
||||
reader.myReferenceName + link :
|
||||
reader.myReferenceDirName + link;
|
||||
link = ZLFileUtil::normalizeUnixPath(link);
|
||||
if (link[0] == '#') {
|
||||
link = reader.myReferenceAlias + link;
|
||||
} else {
|
||||
const size_t index = link.find('#');
|
||||
if (index == std::string::npos) {
|
||||
link = reader.fileAlias(reader.myReferenceDirName + link);
|
||||
} else {
|
||||
link = reader.fileAlias(reader.myReferenceDirName + link.substr(0, index)) + link.substr(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
myHyperlinkStack.push(hyperlinkType);
|
||||
bookReader(reader).addHyperlinkControl(hyperlinkType, link);
|
||||
|
@ -359,7 +365,7 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt
|
|||
const char *name = reader.attributeValue(xmlattributes, "name");
|
||||
if (name != 0) {
|
||||
bookReader(reader).addHyperlinkLabel(
|
||||
reader.myReferenceName + "#" + MiscUtil::decodeHtmlURL(name)
|
||||
reader.myReferenceAlias + "#" + MiscUtil::decodeHtmlURL(name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -488,12 +494,12 @@ XHTMLReader::XHTMLReader(BookReader &modelReader) : myModelReader(modelReader) {
|
|||
}
|
||||
|
||||
bool XHTMLReader::readFile(const ZLFile &file, const std::string &referenceName) {
|
||||
myModelReader.addHyperlinkLabel(referenceName);
|
||||
|
||||
fillTagTable();
|
||||
|
||||
myPathPrefix = MiscUtil::htmlDirectoryPrefix(file.path());
|
||||
myReferenceName = referenceName;
|
||||
myReferenceAlias = fileAlias(referenceName);
|
||||
myModelReader.addHyperlinkLabel(myReferenceAlias);
|
||||
|
||||
const int index = referenceName.rfind('/', referenceName.length() - 1);
|
||||
myReferenceDirName = referenceName.substr(0, index + 1);
|
||||
|
||||
|
@ -528,7 +534,7 @@ void XHTMLReader::startElementHandler(const char *tag, const char **attributes)
|
|||
static const std::string HASH = "#";
|
||||
const char *id = attributeValue(attributes, "id");
|
||||
if (id != 0) {
|
||||
myModelReader.addHyperlinkLabel(myReferenceName + HASH + id);
|
||||
myModelReader.addHyperlinkLabel(myReferenceAlias + HASH + id);
|
||||
}
|
||||
|
||||
const std::string sTag = ZLUnicodeUtil::toLower(tag);
|
||||
|
|
|
@ -82,7 +82,7 @@ private:
|
|||
|
||||
BookReader &myModelReader;
|
||||
std::string myPathPrefix;
|
||||
std::string myReferenceName;
|
||||
std::string myReferenceAlias;
|
||||
std::string myReferenceDirName;
|
||||
bool myPreformatted;
|
||||
bool myNewParagraphInProgress;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue