mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
XDXF: Fix handling of "revision" attribute and "iref" tag
This commit is contained in:
parent
1387a8b5bd
commit
043a10cc98
6
xdxf.cc
6
xdxf.cc
|
@ -38,6 +38,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QRegExp>
|
||||||
|
|
||||||
#include <QSemaphore>
|
#include <QSemaphore>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
@ -1208,7 +1209,10 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||||
idxHeader.langTo = LangCoder::findIdForLanguageCode3( str.c_str() );
|
idxHeader.langTo = LangCoder::findIdForLanguageCode3( str.c_str() );
|
||||||
|
|
||||||
bool isLogical = ( stream.attributes().value( "format" ) == "logical" );
|
bool isLogical = ( stream.attributes().value( "format" ) == "logical" );
|
||||||
idxHeader.revisionNumber = stream.attributes().value( "revision" ).toString().toUInt();
|
|
||||||
|
QRegExp regNum( "\\d+" );
|
||||||
|
regNum.indexIn( stream.attributes().value( "revision" ).toString() );
|
||||||
|
idxHeader.revisionNumber = regNum.cap().toUInt();
|
||||||
|
|
||||||
idxHeader.articleFormat = isLogical ? Logical : Visual;
|
idxHeader.articleFormat = isLogical ? Logical : Visual;
|
||||||
|
|
||||||
|
|
|
@ -310,8 +310,12 @@ string convert( string const & in, DICT_TYPE type, map < string, string > const
|
||||||
{
|
{
|
||||||
QDomElement el = nodes.at( 0 ).toElement();
|
QDomElement el = nodes.at( 0 ).toElement();
|
||||||
|
|
||||||
|
QString ref = el.attribute( "href" );
|
||||||
|
if( ref.isEmpty() )
|
||||||
|
ref = el.text();
|
||||||
|
|
||||||
|
el.setAttribute( "href", ref );
|
||||||
el.setTagName( "a" );
|
el.setTagName( "a" );
|
||||||
el.setAttribute( "href", el.text() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abbreviations
|
// Abbreviations
|
||||||
|
|
Loading…
Reference in a new issue