+ rewrite "url()" directives in CSS content

This commit is contained in:
kelson42 2014-02-23 19:46:43 +01:00
parent 5e3c536ece
commit 4ca544960a

View File

@ -291,14 +291,15 @@ static int accessHandlerCallback(void *cls,
}
pthread_mutex_unlock(&readerLock);
/* Rewrite the content (add the search box) */
/* Special rewrite URL in case of ZIM file use intern *asbolute* url like /A/Kiwix */
if (mimeType.find("text/html") != string::npos) {
/* Special rewrite URL in case of ZIM file use intern *asbolute* url like /A/Kiwix */
content = replaceRegex(content, "$1$2" + humanReadableBookId + "/$3/",
"(href|src)(=[\"|\']{0,1}/)([A-Z|\\-])/");
content = replaceRegex(content, "$1$2" + humanReadableBookId + "/$3/",
"(@import[ ]+)([\"|\']{0,1}/)([A-Z|\\-])/");
} else if (mimeType.find("text/css") != string::npos) {
content = replaceRegex(content, "$1$2" + humanReadableBookId + "/$3/",
"(url|URL)(\\([\"|\']{0,1}/)([A-Z|\\-])/");
}
}