Imported cb2bib-1.3.3

Summary: Imported cb2bib-1.3.3
Keywords:

Imported cb2bib-1.3.3
into Git repository
parent 35741084
2009-09-10 REALEASE OF VERSION 1.3.3
2009-09-06 Added 'fix string: context' search type
2009-08-26 Optimized search in files, and implemented fast matching for approximate strings
2009-08-26 Fixed compiler -Werror=format-security errors in qDebug calls
2009-08-18 Added --sloppy switch for --doc2bib and --txt2bib actions
2009-08-11 Fixed export entries from search browser
2009-08-06 Added relevant Prism metadata recognition
2009-08-03 Fixed possible separator duplication in keywords
2009-08-03 Wrote a more clarifying documentation for automatic extractions
2009-08-01 Fixed a regression not converting '2nd' and '3rd' PubMed author suffixes
2009-07-27 REALEASE OF VERSION 1.3.2
2009-07-27 Do not ask if document should be saved when closing search results browser
2009-07-27 Added <<citeid>> document ID placeholder that keeps both IDs syncronized
......
......@@ -40,6 +40,8 @@ f_icondir=/usr/share/pixmaps
f_qmake=NO
f_make=NO
f_disable_cbpoll=NO
f_disable_lzo=NO
while test -n "$1"; do
case $1 in
......@@ -61,12 +63,15 @@ while test -n "$1"; do
--qmakepath | -qmakepath)
shift; unset f_qmake ; f_qmake=$1
;;
-h | -help | --help)
-h | --help | -help)
f_help=y
;;
--disable_cbpoll | -disable_cbpoll)
f_disable_cbpoll=y
;;
--disable_lzo | -disable_lzo)
f_disable_lzo=y
;;
*)
echo $1: unknown argument
f_help=y
......@@ -93,6 +98,7 @@ Options:
[default: /usr/bin]
--datadir dir Data installation directory
[default: /usr/share/bin/cb2bib]
--disable_lzo Disables linking with lzo library
Unix/Linux only:
--desktopdatadir dir Desktop data installation directory
......@@ -239,23 +245,29 @@ sed 's%^.*desktop.path .*$%desktop.path = '$f_desktopdatadir'%g' tmp.pro > src/s
sed 's%^.*icons.path .*$%icons.path = '$f_icondir'%g' src/src.pro > tmp.pro
mv -f tmp.pro src/src.pro
if test "$f_disable_cbpoll" = y; then
echo "Setting clipboardPoll Disabled"
echo "Setting clipboardPoll disabled"
sed 's% disable_cbpoll%%g' src/src.pro > tmp.pro
sed 's%^CONFIG.*= %CONFIG += disable_cbpoll %g' tmp.pro > src/src.pro
else
echo "Setting clipboardPoll Enabled (Unix/Linux only)"
echo "Setting clipboardPoll enabled (Unix/Linux only)"
sed 's% disable_cbpoll%%g' src/src.pro > tmp.pro
mv -f tmp.pro src/src.pro
fi
sed 's%^const QString C2B_DATA_DIR.*$%const QString C2B_DATA_DIR("'$f_datadir'/");%g' src/c2b/cb2bib_parameters.h > tmp.par
mv -f tmp.par src/c2b/cb2bib_parameters.h
f_configs=
if test "$f_disable_lzo" = y; then
echo "Setting lzo disabled"
f_configs="-config disable_lzo"
fi
if test "$platform" = Darwin; then
echo "Running $f_qmake -spec macx-g++ -o Makefile"
$f_qmake -spec macx-g++ -o Makefile
echo "Running $f_qmake -spec macx-g++ $f_configs -o Makefile"
$f_qmake -spec macx-g++ $f_configs -o Makefile
else
echo "Running $f_qmake -o Makefile"
$f_qmake -o Makefile
echo "Running $f_qmake $f_configs -o Makefile"
$f_qmake $f_configs -o Makefile
fi
echo " "
......@@ -272,4 +284,7 @@ else
echo " permissions. Also, it will set cb2bib, c2bimport, and c2bciter"
echo " desktop files."
echo "-----------------------------------------------------------------------"
echo "- NOTE: cb2Bib requires lzo library. If it were unavailable in your"
echo " platform, reconfigure using --disable_lzo."
echo "-----------------------------------------------------------------------"
fi
......@@ -3,7 +3,7 @@ AA|Astron. Astrophys.|Astronomy and Astrophysics
AAC|Antimicrob. Agents Chemother.|Antimicrobial Agents and Chemotherapy
AAM|Adv. Appl. Math.|Advances in Applied Mathematics
AAM|Adv. Appl. Microbiol.|Advances in Applied Microbiology
AAMOP|Adv. At. Mol. Opt. Phy.|Advances in Atomic Molecular and Optical Physics
AAMOP|Adv. At. Mol. Opt. Phys.|Advances in Atomic, Molecular, and Optical Physics
AAQA|An. Asoc. Quim. Argent.|Anales de la Asociacion Quimica Argentina
AB|Acta Biotechnol.|Acta Biotechnologica
AB|Anal. Biochem.|Analytical Biochemistry
......@@ -36,6 +36,7 @@ ACIP|Acta Cienc. Indica, Phys.|Acta Ciencia Indica Phyics
ACIS|Adv. Colloid Interface Sci.|Advances in Colloid and Interface Science
ACM|Adv. Compos. Mater|Advanced Composite Materials
ACM|Appl. Compos. Mater.|Applied Composite Materials
ACMTMS|ACM Trans. Math. Softw.|ACM Transactions on Mathematical Software
ACP|Adv. Chem. Phys.|Advances in Chemical Physics
ACR|Acc. Chem. Res.|Accounts of Chemical Research
ACR|Ann. Chim. (Rome)|Annali di Chimica
......@@ -585,8 +586,8 @@ JAC|J. Antimicrob. Chemother.|Journal of Antimicrobial Chemotherapy
JAC|J. Appl. Crystallogr.|Journal of Applied Crystallography
JAC|J. Autom. Chem.|Journal of Automatic Chemistry
JACS0|J. Am. Ceram. Soc.|Journal of the American Ceramic Society
JACS1|J. Amer. Chem. Soc.|Journal of the American Chemical Society
JACS|J. Am. Chem. Soc.|Journal of the American Chemical Society
JACS1|J. Amer. Chem. Soc.|Journal of the American Chemical Society
JAE|J. Appl. Electrochem.|Journal of Applied Electrochemistry
JAFC|J. Agric. Food. Chem.|Journal of Agricultural and Food Chemistry
JA|J. Adhes.|Journal of Adhesion
......@@ -761,6 +762,7 @@ JMC|J. Med. Chem.|Journal of Medicinal Chemistry
JMC|J. Mol. Catal.|Journal of Molecular Catalysis
JMCWM|J. Mater. Cycles Waste Manage.|Journal of Material Cycles and Waste Management
JMEP|J. Mater. Eng. Perform.|Journal of Materials Engineering and Performance
JMAP|J. Math. Anal. Appl.|Journal of Mathematical Analysis and Applications
JMGM|J. Mol. Graphics Modell.|Journal of Molecular Graphics and Modelling
JM|J. Microencapsulation|Journal of Microencapsulation
JML|J. Mol. Liq.|Journal of Molecular Liquids
......@@ -1009,6 +1011,7 @@ MTOM|Metalloved. Term. Obrab. Met.|Metallovedenie i Termicheskaya Obrabotka Meta
MTS|Macromol. Theory Simul.|Macromolecular Theory and Simulations
MWE|Mine Water Environ.|Mine Water and the Environment
MW|Materialwiss. Werkstofftech.|Materialwissenschaft und Werkstofftechnik
NA|Numer. Algor.|Numerical Algorithms
NAR|Nucleic Acids Res.|Nucleic Acids Research
NATOASISSA|NATO ASI Ser., Ser. A|NATO ASI Series, Series A Life Sciences
NATOASISSB|NATO ASI Ser., Ser. B|NATO ASI Series, Series B Physics
......
......@@ -81,8 +81,6 @@ text-decoration: underline;
.index {
background-color: #AEAEA3;
border-color: #72726A;
#background-color: #818B93;
#border-color: black;
border-style: solid;
border-width: 1px;
font-family: sans-serif;
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bookmarkPlugin.h"
......@@ -62,7 +62,7 @@ void bookmarkPlugin::parseBookmarks()
const QStringList bm_parts(bookmarks.at(i).split('|', QString::KeepEmptyParts));
if (bm_parts.count() != 4)
{
qDebug(tr("[cb2bib] bookmarkPlugin::parseBookmarks: Syntax error at '%1'").arg(bookmarks.at(i)).toLatin1());
c2bUtils::warn(tr("bookmarkPlugin::parseBookmarks: Syntax error at '%1'").arg(bookmarks.at(i)));
continue;
}
QAction* act = addAction(bm_parts.at(0), this, SLOT(openBookmark()));
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef BOOKMARKPLUGIN_H
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "c2b.h"
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef C2B_H
......
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
*
* Class implementation of the approximate search algorithm
......@@ -12,29 +12,82 @@
#include "compositePattern.h"
#include "substringMatcher.h"
#define C2B_DEBUG_APPROXIMATEPATTERN 0
#if C2B_DEBUG_APPROXIMATEPATTERN
#endif
class approximatePattern : public compositePattern
{
public:
approximatePattern(const QString newPattern, Qt::CaseSensitivity newCs);
~approximatePattern();
approximatePattern();
approximatePattern(const QString& pattern, const Qt::CaseSensitivity cs);
inline ~approximatePattern() {}
void setPattern(const QString& pattern, const Qt::CaseSensitivity cs = Qt::CaseSensitive);
inline bool matches(const QString& str) const
{
_matched_length = -1;
if (str.length() == 0)
return false;
if (_is_multipattern)
{
for (int i = 0; i < _subpattern_count; ++i)
if (_submatchers.at(i).indexIn(str) != -1)
return true;
return false;
}
else
return _regexp.indexIn(str) != -1;
}
inline int indexIn(const QString& str, const int from = 0) const
{
_matched_length = -1;
if (str.length() == 0)
return -1;
int index;
if (_is_multipattern)
{
for (int i = 0; i < _subpattern_count; ++i)
{
_p0[i] = _submatchers.at(i).indexIn(str, from);
_pn[i] = _p0.at(i) + _submatchers.at(i).matchedLength();
}
mergeIndices(&index, str);
}
else
{
index = _regexp.indexIn(str, from);
_matched_length = _regexp.matchedLength();
}
return index;
}
inline const QVector<substringMatcher>& submatchers() const
{
return _submatchers;
}
private:
QList<int> ppEnds;
QList<int> ppStarts;
QString wordPattern(const QString& word, Qt::CaseSensitivity cs) const;
QStringList patternPieces;
QStringList pre;
QStringList suf;
const QStringList splitWord(const QString& word);
const QStringList splitWord(const QString& word) const;
int stretch(int piece_i, int piece_j) const;
int wordCount(const QString& str) const;
void setPattern();
void mergeIndices(int* index_in, const QString& str) const;
void splitPattern();
void splitPattern(const QString& p, QStringList* w, QList<int>* ws, QList<int>* we) const;
QList<int> _piece_ends;
QList<int> _piece_starts;
QStringList _prefixes;
QStringList _string_pieces;
QStringList _suffixes;
QVector<substringMatcher> _submatchers;
};
#endif
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "authorString.h"
......@@ -18,9 +18,6 @@
authorString::authorString()
{}
authorString::~authorString()
{}
/** \page authorproc
......@@ -142,7 +139,7 @@ QString authorString::toBibTeX(const QString& author, bool full_form)
c2bUtils::debug(author_i);
author_i.replace(QRegExp("\\.{0,1}\\s{0,1}-"), "-"); // Abbreviated cases, eg M.-H. Something
author_i.replace(QRegExp("[^-'\\w,]"), " "); // Only these characters compose a name; keep commas
author_i = author_i.simplified();
author_i = c2bUtils::simplifyString(author_i);
// Split author name
QStringList fore_name_parts;
......@@ -238,7 +235,7 @@ QString authorString::toBibTeX(const QString& author, bool full_form)
_author_string.replace(QRegExp("_JR\\b", Qt::CaseInsensitive), " Jr");
_author_string.replace(QRegExp(author::prefixes + '_', Qt::CaseInsensitive), "\\1 ");
_author_string.replace(QRegExp("\\b" + author::double_initials + '_', Qt::CaseInsensitive), "\\1.");
_author_string = _author_string.simplified();
_author_string = c2bUtils::simplifyString(_author_string);
return _author_string;
}
......@@ -538,7 +535,7 @@ void encoder::encode(const QString& raw)
scapePattern("aL+[nN]{1,2}");
scapePattern("a[nNw]&L+[nN]{1,2}"); // in Linear and / Sublinear Time
scapePattern(":L+[nN]{1,2}");
scapePattern(":L+[InN]{1,2}"); // ... Structure Classification: / A Survey
scapePattern("[nN]*&L[nN]L"); // Not an & for author
}
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef AUTHORSTRING_H
......@@ -17,7 +17,7 @@
namespace author
{
static const QString double_initials("(Al|Ch|Kh|Th|Ya|Yu|Zs)");
static const QString double_initials("(Al|Ch|Kh|Md|Th|Xh|Ya|Yu|Zs)");
static const QString prefixes("(da|de|dal|del|der|di|do|du|dos|la|le|lo|van|vande|von|zur)");
static const QString name("(?:\\w[-'\\w]{1,})");
......@@ -50,7 +50,7 @@ inline QString& simplifyString(QString& author, const bool full = false)
author.replace(simplify_string_rx4, " ");
author.remove(simplify_string_rx5); // Better remove if no conflict. It will help to not confuse with chemical formula.
author.replace(simplify_string_rx6, " ");
author = author.simplified();
author = c2bUtils::simplifyString(author);
return author;
}
......@@ -99,7 +99,7 @@ struct encoder
if (code.at(i) != 'L')
code[i] = c;
}
void scapePattern(const QString pattern, const QChar c = ' ')
void scapePattern(const QString& pattern, const QChar c = ' ')
{
QRegExp rx(pattern, Qt::CaseSensitive);
rx.setMinimal(true);
......@@ -147,7 +147,7 @@ class authorString
public:
authorString();
~authorString();
inline ~authorString() {}
QString toBibTeX(const QString& author, bool full_form = false);
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bibExtractor.h"
......@@ -23,6 +23,7 @@ bibExtractor::bibExtractor(QObject* parento) : QObject(parento), cout(*(new QTex
_bpP = new bibParser(this);
_mpP = new metadataParser(_bpP, this);
_networkQP = new networkQuery(_bpP, this);
init();
}
bibExtractor::bibExtractor(bibParser* bp, metadataParser* mp, networkQuery* nq, QObject* parento) :
......@@ -78,7 +79,7 @@ int bibExtractor::extract(const QStringList& input_fns, const QString& output_fn
const QString text(c2bUtils::fileToString(input_fn));
extract(text);
}
if (_settingsP->value("cb2Bib/MovePdf").toBool() && !_document_fn.isEmpty() && _bpP->fieldCount() > 0)
if (_settingsP->value("cb2Bib/MovePdf").toBool() && !_document_fn.isEmpty() && isReliable())
{
const QString file(_bpP->documentFilename(_document_fn, output_fn));
const QString target_doc_fn(c2bUtils::documentAbsoluteName(_settingsP->value("cb2Bib/RelativePdfDirectory").toBool(),
......@@ -87,11 +88,11 @@ int bibExtractor::extract(const QStringList& input_fns, const QString& output_fn
QDir doc_dir(doc_dirname);
if (!doc_dir.exists())
if (!doc_dir.mkpath(doc_dirname))
logMessage(tr("Unable to create directory %1.").arg(doc_dirname));
logMessage(tr("Error: Unable to create directory %1.").arg(doc_dirname));
if (doc_dir.exists())
{
const QString CopyMovePdf(_settingsP->value("cb2Bib/CopyMovePdf").toString());
logMessage(tr("Copying/moving %1...").arg(_document_fn));
logMessage(tr("Copying/moving to %1...").arg(target_doc_fn));
_networkQP->networkPtr()->getFile(_document_fn, target_doc_fn, CopyMovePdf, this, SLOT(copyMoveEnded(bool)));
_event_loop->exec();
if (_is_copymove_ok)
......@@ -101,7 +102,7 @@ int bibExtractor::extract(const QStringList& input_fns, const QString& output_fn
QString mp_error;
if (!_mpP->insertMetadata(_bpP->currentReference(), target_doc_fn, &mp_error))
{
logMessage(tr("Unable to insert metadata to file %1.").arg(target_doc_fn));
logMessage(tr("Warning: Unable to insert metadata to file %1.").arg(target_doc_fn));
logMessage(mp_error);
}
}
......@@ -109,23 +110,28 @@ int bibExtractor::extract(const QStringList& input_fns, const QString& output_fn
}
else
{
logMessage(tr("Skipping file field %1.").arg(_document_fn));
_document_fn.clear();
if (_settingsP->cl_sloppy)
{
logMessage(tr("Warning: Skipping file field %1.").arg(_document_fn));
_document_fn.clear();
}
else
_bpP->clearCurrentReference();
}
}
}
if (_bpP->fieldCount() > 0)
if (isReliable())
{
if (!_document_fn.isEmpty())
_bpP->setField("file", _document_fn);
bibtex += _bpP->toBibTeX();
}
else
logMessage(tr("Empty reference for file %1.").arg(input_fn));
logMessage(tr("Warning: Skip writing reference for file %1.").arg(input_fn));
logMessage("");
}
if (bibtex.isEmpty())
logMessage(tr("No reference extracted."));
logMessage(tr("Warning: No reference extracted."));
else
{
logMessage(tr("Writing %1...").arg(output_fn));
......@@ -147,10 +153,12 @@ int bibExtractor::extract(const QString& text, QString* bibtex)
_input_type = PlainText;
extract(text);
*bibtex = _bpP->toBibTeX();
if (_bpP->fieldCount() > 0)
if (_bpP->isAutoRecognized() > 0)
return 0;
else
else if (_bpP->fieldCount() > 0)
return 1;
else
return 2;
}
void bibExtractor::extract(const QString& text)
......@@ -173,7 +181,7 @@ void bibExtractor::_extract(const QString& text)
_bpP->clearCurrentReference();
if (text.trimmed().isEmpty())
{
logMessage(tr("Empty input string."));
logMessage(tr("Warning: Empty input string."));
return;
}
_bpP->setReferenceType("article");
......@@ -206,7 +214,7 @@ void bibExtractor::copyMoveEnded(bool ok)
void bibExtractor::proxyLogMessage() const
{
_networkQP->networkPtr()->cancelDownload();
logMessage(tr("Error: Proxy authentication dialog is disabled in command line mode."));
logMessage(tr("Warning: Proxy authentication dialog is disabled in command line mode."));
}
void bibExtractor::logMessage(const QString& ms) const
......@@ -214,12 +222,20 @@ void bibExtractor::logMessage(const QString& ms) const
cout << "[cb2bib] " << ms << endl;
}
bool bibExtractor::isReliable() const
{
if (_settingsP->cl_sloppy)
return _bpP->fieldCount() > 0;
else
return _bpP->isAutoRecognized();
}
QString bibExtractor::documentToString(const QString& fn) const
{
document doc(fn, document::FirstPage);
const QString text(doc.toString());
if (!doc.errorString().isEmpty())
logMessage(doc.errorString());
logMessage("Error: " + doc.errorString());
if (_settingsP->value("cb2Bib/AddMetadata").toBool())
{
// Add metadata to document text
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef BIBEXTRACTOR_H
......@@ -47,6 +47,7 @@ private:
QTextStream& cout;
bibParser* _bpP;
bool _is_copymove_ok;
bool isReliable() const;
metadataParser* _mpP;
networkQuery* _networkQP;
settings* _settingsP;
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bibParser.h"
......@@ -98,7 +98,9 @@ QString bibParser::parse(const QString& field, const QString& value, const QStri
else if (field == "keywords")
{
v.replace(" - ", ",");
v = v.split(QRegExp("[^\\w\\s-]"), QString::SkipEmptyParts).join(", ");
QStringList kl(v.split(QRegExp("[^\\w\\s-]"), QString::SkipEmptyParts));
kl.removeAll(" ");
v = kl.join(", ");
v.replace(QRegExp("\\s+,"), ",");
v = v.toLower();
}
......@@ -126,7 +128,7 @@ QString bibParser::parse(const QString& field, const QString& value, const QStri
if (!init_value.isEmpty())
v = init_value + ": " + v;
}
return v.simplified();
return c2bUtils::simplifyString(v);
}
/**
......@@ -209,7 +211,7 @@ QString bibParser::excerpt(const QString& text, const QStringList& hints) const
txt.replace(QRegExp("\\b(january|february|march|april|may|june|july|august|september|october|november|december)\\b",
Qt::CaseInsensitive), " ");
txt = hints.join(" ") + ' ' + txt;
txt = txt.simplified();
txt = c2bUtils::simplifyString(txt);
const QStringList txtlist(txt.split(' ', QString::SkipEmptyParts));
QStringList txtlistSimp;
for (int i = 0; i < qMin(15, txtlist.count()); ++i)
......@@ -348,7 +350,7 @@ void bibParser::parse(const QString& text, QString* out_text, QString* out_tagte
otext = ' ' + otext;
ottext = otext;
ottext.replace(QRegExp("[\\n\\r]\\s*([A-Z]{1,4}\\s*-)"), "][\\1");
ottext = ottext.simplified();
ottext = c2bUtils::simplifyString(ottext);
if (!ottext.contains(QRegExp("\\[FAU\\s+-")))
ottext.replace(QRegExp("\\[(AU\\s*-\\s*[-'\\w]+)"), "[F\\1 ");
QStringList fList(ottext.split("]["));
......@@ -450,7 +452,7 @@ void bibParser::parse(const QString& text, QString* out_text, QString* out_tagte
QRegExp rx(ItemX);
rx.setMinimal(true);
if (!rx.isValid())
qDebug(tr("[cb2Bib] RegExp |%1| is not valid.").arg(ItemX).toLatin1());
c2bUtils::warn(tr("RegExp |%1| is not valid").arg(ItemX));
const QStringList list(fieldset.split(' ', QString::SkipEmptyParts));
const int efields(list.count());
......@@ -461,8 +463,7 @@ void bibParser::parse(const QString& text, QString* out_text, QString* out_tagte
c2bUtils::debug(tr("Position: |%1|").arg(npos));
if (efields != cfields)
{
qDebug(tr("[cb2Bib] RegExp |%1| is not valid. Mismatch between expected and actual captures.")
.arg(ItemX).toLatin1());
c2bUtils::warn(tr("RegExp |%1| is not valid. Mismatch between expected and actual captures").arg(ItemX));
npos = -1;
}
nfilters++;
......@@ -520,13 +521,13 @@ void bibParser::checkRegExpFile(const QString& fn)
{
if (fn.isEmpty())
{
qDebug(QObject::tr("[cb2Bib] No regular expression file especified.").toLatin1());
c2bUtils::warn(tr("No regular expression file especified"));
return;
}
QFileInfo fi(fn);
if (!fi.exists() || !fi.isReadable())
{
qDebug(QObject::tr("[cb2Bib] Could not open regular expression file %1 for reading.").arg(fn).toLatin1());
c2bUtils::warn(tr("Could not open regular expression file %1 for reading").arg(fn));
return;
}
}
......@@ -559,7 +560,7 @@ QString bibParser::setTags(const QString& text) const
for (int i = 0; i < n - 1; i++)
tagged_text += spText.at(i) + QString("<Tab%1>").arg(i + 1);
tagged_text += spText[n-1];
tagged_text = tagged_text.simplified();
tagged_text = c2bUtils::simplifyString(tagged_text);
return tagged_text;
}
......@@ -570,6 +571,6 @@ QString bibParser::removeTags(const QString& text) const
clean.remove("]]");
clean.replace(QRegExp("<NewLine\\d+>"), " ");
clean.replace(QRegExp("<Tab\\d+>"), " ");
clean = clean.simplified();
clean = c2bUtils::simplifyString(clean);
return clean;
}
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef BIBPARSER_H
......@@ -18,6 +18,7 @@ class heuristicBibParser;
class idMaker;
class preprocess;
/**
Class for bibliographic reference parsing and manipulation
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bibPreparser.h"
......@@ -19,9 +19,6 @@ bibPreparser::bibPreparser(QObject* parento) : QObject(parento)
m_out_file = settingsP->tempPath() + "/cb2bib_clipborad_out.tmp_" + settingsP->applicationPid();
}
bibPreparser::~bibPreparser()
{}
void bibPreparser::preparse(const QString& text, QString* out_text)
{
......
/***************************************************************************
* Copyright (C) 2004-2009 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.3.2. Licensed under the GNU GPL version 3.
* cb2Bib version 1.3.3. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef BIBPREPARSER_H
......@@ -21,7 +21,7 @@ class bibPreparser : public QObject
public:
bibPreparser(QObject* parento = 0);
~bibPreparser();
inline ~bibPreparser() {}