diff --git a/README.md b/README.md
index 42b62302..71fc492c 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ This code has been run and tested on Windows XP/Vista/7, Ubuntu Linux, Mac OS X.
sudo apt-get install git pkg-config build-essential qt4-qmake \
libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev \
libqt4-dev libqtwebkit-dev libxtst-dev liblzo2-dev libbz2-dev \
- libao-dev libavutil-dev libavformat-dev libtiff5-dev libeb-dev
+ libao-dev libavutil-dev libavformat-dev libtiff5-dev libeb16-dev
## How to build
diff --git a/locale/fr_FR.ts b/locale/fr_FR.ts
index 0985d673..1ada16b9 100644
--- a/locale/fr_FR.ts
+++ b/locale/fr_FR.ts
@@ -748,7 +748,7 @@ between classic and school orthography in cyrillic)
-
+ Bases de données serveur
diff --git a/mediawiki.cc b/mediawiki.cc
index b0a74fac..8262a7c2 100644
--- a/mediawiki.cc
+++ b/mediawiki.cc
@@ -370,10 +370,11 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
// audio url
articleString.replace( QRegExp( "dictPtr->getId() )+ "dictPtr->getId() ) + "]*(upload\\.wikimedia\\.org/wikipedia/commons/[^\"'&]*\\.ogg)[^>]*>\\s*<[^<]*"),
- QString::fromStdString(addAudioLink("\"http://\\1\"",this->dictPtr->getId())+
- ""));
+ articleString.replace( QRegExp( ""),
+ QString::fromStdString(addAudioLink( string( "\"" ) + wikiUrl.scheme().toStdString() + "://\\1\"", this->dictPtr->getId() ) +
+ "" ) );
// In those strings, change any underscores to spaces
for( ; ; )
{
diff --git a/webmultimediadownload.cc b/webmultimediadownload.cc
index 01557e7b..326c3c46 100644
--- a/webmultimediadownload.cc
+++ b/webmultimediadownload.cc
@@ -49,7 +49,7 @@ bool WebMultimediaDownload::isAudioUrl( QUrl const & url )
{
// Note: we check for forvo sound links explicitly, as they don't have extensions
- return url.scheme() == "http" && (
+ return ( url.scheme() == "http" || url.scheme() == "https" ) && (
Filetype::isNameOfSound( url.path().toUtf8().data() ) || url.host() == "apifree.forvo.com" );
}
diff --git a/zim.cc b/zim.cc
index c9a085bb..5175f63a 100644
--- a/zim.cc
+++ b/zim.cc
@@ -423,6 +423,8 @@ quint32 readArticle( ZimFile & file, ZIM_header & header, quint32 articleNumber,
class ZimDictionary: public BtreeIndexing::BtreeDictionary
{
+ enum LINKS_TYPE { UNKNOWN, SLASH, NO_SLASH };
+
Mutex idxMutex;
Mutex zimMutex, idxResourceMutex;
File::Class idx;
@@ -432,6 +434,7 @@ class ZimDictionary: public BtreeIndexing::BtreeDictionary
ZimFile df;
ZIM_header zimHeader;
set< quint32 > articlesIndexedForFTS;
+ LINKS_TYPE linksType;
public:
@@ -512,7 +515,8 @@ ZimDictionary::ZimDictionary( string const & id,
BtreeDictionary( id, dictionaryFiles ),
idx( indexFile, "rb" ),
idxHeader( idx.read< IdxHeader >() ),
- df( FsEncoding::decode( dictionaryFiles[ 0 ].c_str() ) )
+ df( FsEncoding::decode( dictionaryFiles[ 0 ].c_str() ) ),
+ linksType( UNKNOWN )
{
// Open data file
@@ -632,11 +636,48 @@ string ZimDictionary::convert( const string & in )
if ( !list[4].isEmpty() ) // a title, ex: title="Precambrian/Chaotian"
tag = list[4].split("\"")[1];
- tag.remove( QRegExp(".*/") ).
- remove( QRegExp( "\\.(s|)htm(l|)$", Qt::CaseInsensitive ) ).
- replace( "_", "%20" ).
- prepend( "" );
+
+ // Check type of links inside articles
+ if( linksType == UNKNOWN && tag.indexOf( '/' ) >= 0 )
+ {
+ QString word = QUrl::fromPercentEncoding( tag.toLatin1() );
+ word.remove( QRegExp( "\\.(s|)htm(l|)$", Qt::CaseInsensitive ) ).
+ replace( "_", " " );
+
+ vector< WordArticleLink > links;
+ links = findArticles( gd::toWString( word ) );
+
+ if( !links.empty() )
+ {
+ linksType = SLASH;
+ }
+ else
+ {
+ word.remove( QRegExp(".*/") );
+ links = findArticles( gd::toWString( word ) );
+ if( !links.empty() )
+ {
+ linksType = NO_SLASH;
+ links.clear();
+ }
+ }
+ }
+
+ if( linksType == SLASH || linksType == UNKNOWN )
+ {
+ tag.remove( QRegExp( "\\.(s|)htm(l|)$", Qt::CaseInsensitive ) ).
+ replace( "_", "%20" ).
+ prepend( "" );
+ }
+ else
+ {
+ tag.remove( QRegExp(".*/") ).
+ remove( QRegExp( "\\.(s|)htm(l|)$", Qt::CaseInsensitive ) ).
+ replace( "_", "%20" ).
+ prepend( "" );
+ }
text.replace( pos, list[0].length(), tag );
pos += tag.length() + 1;