Commit 1a6ab7b6 authored by Filippo Rusconi's avatar Filippo Rusconi

New upstream version 1.9.9

parent c1694cd6
2018-09-07 RELEASE OF VERSION 1.9.9
2018-09-06 Fixed gcc compiler warning (Thanks to F. Rusconi)
2018-09-05 Updated abbreviations.txt file
2018-09-05 Added alternate abbreviation and full journal processing
2018-08-27 Set to remove conflicting braces on extern author strings
2018-08-27 Updated netqinf.txt file, set reliable queries only
2018-08-27 Added merge metadata actions to netqinf syntax
2018-08-27 Added parsers for arXiv and Crossref
2018-08-23 Fixed break of query chain on single network error
2018-08-07 RELEASE OF VERSION 1.9.8
2018-08-07 Updated bookmark and abbreviation files
2018-08-05 Ported deprecated jsMath newcommand macros to MathJax
2018-08-05 Fixed sub and sup scripts conflicting with MathJax
2018-07-27 Added PDF user manual
2018-07-27 Updated documentation and improved navigation
2017-06-28 RELEASE OF VERSION 1.9.7
2017-06-27 Set MathJax default local for increased security (Thanks to F. Rusconi)
2017-06-27 Fixed broken Cross Ref link
......
The cb2Bib. Copyright (C) 2004-2017 by Pere Constans
The cb2Bib. Copyright (C) 2004-2018 by Pere Constans
The cb2Bib includes third party GPL and LGPL code that is copyrighted by others:
......
......@@ -2,7 +2,7 @@
#-------------------------------------------------------------------------------
# c2bciter -- Wrapper for calling cb2Bib Citer
# cb2Bib Tools
# Copyright (C) 2004-2017 by Pere Constans
# Copyright (C) 2004-2018 by Pere Constans
# constans@molspaces.com
#
# Copyright (C) 2009 by Filippo Rusconi
......
......@@ -2,7 +2,7 @@
#-------------------------------------------------------------------------------
# c2bimport -- Script for calling cb2Bib in "Download Reference to cb2Bib" mode
# cb2Bib Tools
# Copyright (C) 2004-2017 by Pere Constans
# Copyright (C) 2004-2018 by Pere Constans
# constans@molspaces.com
#
# Copyright (C) 2009 by Filippo Rusconi
......
[Desktop Entry]
Comment=Bibliographic Reference Extracting Tool
Comment[ca]=Eina per extreure referències bibliogràfiques
Comment=Bibliographic Reference Extracting and Managing Tool
Comment[ca]=Eina per extreure i gestionar referències bibliogràfiques
Exec=cb2bib --bibedit %F
GenericName=Reference Extracting Tool
GenericName[ca]=Eina per extreure referències
GenericName=Bibliographic Reference Tool
GenericName[ca]=Eina per a bibliografies
Icon=cb2bib
MimeType=text/x-bibtex;
Name=cb2Bib
......
......@@ -3,7 +3,7 @@
# bib2pdf -- Script to convert BibTeX files to PDF
# cb2Bib Tools
#
# Copyright (C) 2005-2017 by Pere Constans
# Copyright (C) 2005-2018 by Pere Constans
# constans@molspaces.com
#
# Improvements and modifications:
......
......@@ -3,7 +3,7 @@
# isi2bib -- Script to convert ISI format to BibTeX
# cb2Bib Tools
#
# Copyright (C) 2005-2017 by Pere Constans
# Copyright (C) 2005-2018 by Pere Constans
# constans@molspaces.com
#
# Improvements and modifications:
......
......@@ -3,7 +3,7 @@
# ris2bib -- Script to convert RIS format to BibTeX
# cb2Bib Tools
#
# Copyright (C) 2005-2017 by Pere Constans
# Copyright (C) 2005-2018 by Pere Constans
# constans@molspaces.com
#
# Improvements and modifications:
......
......@@ -281,6 +281,7 @@ fi
echo
sed -i -e 's%^.*cb2bibdata\.path .*$%cb2bibdata.path = '$f_datadir'%g' \
-e 's%^.*cb2bibdoc\.path .*$%cb2bibdoc.path = '$f_datadir'/doc%g' \
-e 's%^.*target\.path .*$%target.path = '$f_bindir'%g' \
-e 's%^.*script\.path .*$%script.path = '$f_bindir'%g' \
-e 's%^.*desktop\.path .*$%desktop.path = '$f_desktopdatadir'%g' \
......
This diff is collapsed.
This diff is collapsed.
# cb2Bib 0.6.0 Pattern:
American Chemical Society Publications
article
journal volume number pages year title author abstract
^(.+), (\d+) \(([\d|\-|\s]+)\), ([\d|\-|\s]+), (\d\d\d\d)\..+<NewLine3>(.+)<NewLine4>(.+)<NewLine5>.+Abstract:<NewLine\d+>(.+)$
# cb2Bib 0.6.0 Pattern:
PNAS Table of Contents Alert
article
title author journal year volume pages
^(.+)<Tab1>(.+)(PNAS) (\d\d\d\d)\;(\d+) ([\d|\-|\s]+).+$
# cb2Bib 0.6.0 Pattern:
Wiley InterScience Journal Abstracts
article
journal volume pages year title author keywords abstract
^(.+)<NewLine1>Volume (\d+), Issue.+, Pages ([\d|\-|\s]+)<NewLine2>Published Online:.+(\d\d\d\d)<NewLine3>.+<NewLine11>(.+)<NewLine12>(.+)<NewLine13>.+KEYWORDS(.+)ABSTRACT(.+)$
# cb2Bib 0.6.0 Pattern:
ISI Web of Knowledge Table of Contents Alert
article
title author journal volume pages year abstract
^Title:(.+)Authors:(.+)Source:(.+), (\d+) \(.+\): ([\d|\-|\s]+); .+ (\d\d\d\d)<NewLine6>Abstract:(.+)$
# cb2Bib 0.6.0 Pattern:
DBLP Article
article
author title journal volume pages year
^([^:]+): ([^\.]+)\. (.+) (\d+)\(.+\): ([\d|\-|\s]+) \((\d\d\d\d)\)$
# cb2Bib 0.6.0 Pattern:
Nature from Fisrt Paragraph
article
journal volume pages year title author abstract
^(Nature) (\d+), ([\d|\-|\s]+) \(.+ (\d\d\d\d)\).+ <NewLine1>(.+)<NewLine2>(.+)<NewLine3>.+<NewLine\d+> <NewLine\d+>.+<NewLine\d+> <NewLine\d+>(.+)$
# cb2Bib 0.6.0 Pattern:
ScienceDirect
article
journal volume number year pages title author abstract keywords
^(.+)<NewLine1> Volume (\d+), Issues* ([\d|\-|\s]+), .+ (\d\d\d\d), Pages ([\d|\-|\s]+) <NewLine2>.+Copyright .+ Elsevier [^<]+<NewLine\d+>([^<]+)<NewLine\d+> <NewLine\d+>([^<]+)<NewLine\d+>.+Abstract<NewLine\d+>(.+)<NewLine\d+>Author Keywords:(.+)$
# cb2Bib 0.6.0 Pattern:
ScienceDirect (Keywords: instead of Author Keywords:)
article
journal volume number year pages title author abstract keywords
^(.+)<NewLine1> Volume (\d+), Issues* ([\d|\-|\s]+), .+ (\d\d\d\d), Pages ([\d|\-|\s]+) <NewLine2>.+Copyright .+ Elsevier [^<]+<NewLine\d+>([^<]+)<NewLine\d+> <NewLine\d+>([^<]+)<NewLine\d+>.+Abstract<NewLine\d+>(.+)<NewLine\d+>Keywords:(.+)$
# cb2Bib 0.6.0 Pattern:
ScienceDirect (No Author Keywords)
article
journal volume number year pages title author abstract
^(.+)<NewLine1> Volume (\d+), Issues* ([\d|\-|\s]+), .+ (\d\d\d\d), Pages ([\d|\-|\s]+) <NewLine2>.+Copyright .+ Elsevier [^<]+<NewLine\d+>([^<]+)<NewLine\d+> <NewLine\d+>([^<]+)<NewLine\d+>.+Abstract<NewLine\d+>(.+)$
# cb2Bib 0.6.0 Pattern:
IOP Electronic Journals
article
year journal volume pages title author abstract
^.+ (\d\d\d\d) (.+) (\d+) ([\d|\-|\s]+)<NewLine1>(.+)<NewLine2>(.+)<NewLine3>.+Abstract\. (.+)$
# cb2Bib 0.6.0 Pattern:
PubMed Search
article
journal year volume pages
^(.+) (\d\d\d\d).*;(\d+).*:([\w\d|\-|\s]+)\..*$
# cb2Bib 0.6.0 Pattern:
JSTOR
article
title author journal volume number month year pages abstract
^(.+)<NewLine1>(.+)<NewLine\d>(.+)[,>]\s*Vol\.\s*(\d+),\s*No\.\s*(\d+).+\((.+),\s*(\d\d\d\d)\),\s*p{1,2}\.([\d|\-|\s]+)\.{0,1}.+Abstract(.+)$
# cb2Bib 0.6.0 Pattern:
JSTOR (No Abstract)
article
title author journal volume number month year pages
^(.+)<NewLine1>(.+)<NewLine\d>(.+)[,>]\s*Vol\.\s*(\d+),\s*No\.\s*(\d+).+\((.+),\s*(\d\d\d\d)\),\s*p{1,2}\.([\d|\-|\s]+)\.{0,1}$
# cb2Bib 0.8.1 Pattern:
# cb2Bib 0.0.1 Pattern:
PDF Import Example
article
journal volume pages year title author abstract
^(Ars Magna), (\d+), ([\d\-–\s]+), (\d\d\d\d)<NewLine1>(.+)<NewLine3>(.+)<NewLine5>.+SUMMARY(.+)<NewLine13>.+$
# cb2Bib 0.8.1 Pattern:
# cb2Bib 0.0.1 Pattern:
Example with Multiple Author Sets
article
journal volume pages year title author author abstract
^(Journal Name), (\d+), ([\d|\-|\s]+), (\d\d\d\d) <NewLine1><NewLine2> <NewLine3>(.+)<NewLine4><NewLine5> <NewLine6>(.+)<NewLine7>.+<NewLine10>(.+)<NewLine11>.+Abstract:(.+)$
# cb2Bib 1.0.1 Pattern:
JCP
article
title journal volume pages year author abstract
^(.+)<NewLine1>(.+) (\d+), ([\d\-–\s]+) \((\d\d\d\d)\);.+<NewLine10>(.+)<NewLine11>.+<NewLine1\d>(.+)©.+$
# cb2Bib 1.2.0 Pattern:
PROLA
article
journal volume number pages year title author abstract
^APS » PROLA »(.+)» Volume([\s\d]+)» Issue([\s\d]+)<NewLine1>.+([\d\-–\s]+)\((\d\d\d\d)\)<NewLine3>(.+)<NewLine4>.+<NewLine10>(.+)<NewLine11>.+<NewLine13>(.+)<NewLine\d+><NewLine\d+>.+$
This source diff could not be displayed because it is too large. You can view the blob instead.
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bookmarkPlugin.h"
......@@ -47,7 +47,7 @@ void bookmarkPlugin::parseBookmarks()
{
clear();
const QString bmf(c2bUtils::fileToString(_bookmark_file));
QStringList bookmarks(bmf.split('\n', QString::KeepEmptyParts));
QStringList bookmarks(bmf.split(QRegExp("[\\r\\n]"), QString::KeepEmptyParts));
const QRegExp _bookmark("^editorbookmark=");
const QRegExp _separator("^editorbookmark=\\s*$");
for (int i = 0; i < bookmarks.count(); ++i)
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef BOOKMARKPLUGIN_H
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "c2b.h"
......@@ -18,7 +18,7 @@
/**
Global resources for the cb2Bib
Global resources for cb2Bib
*/
c2b::c2b(QWidget* main, QObject* parento) : QObject(parento)
{
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef C2B_H
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
*
* Class implementation of the approximate search algorithm
* P. Constans. Approximate textual retrieval. arXiv:0705.0751v1, 2007.
* P. Constans. Approximate textual retrieval. arXiv:0705.0751, 2007.
***************************************************************************/
#include "approximatePattern.h"
......@@ -112,7 +112,7 @@ void approximatePattern::setPattern(const QString& pattern, const Qt::CaseSensit
submatcher.append(sm);
subpattern.append(sp);
substring.append(ss);
_ranks.append(stretch_product * triads::textFrequency(ss)); // Rank according expectation (arXiv:0705.0751v1, Eq. 6)
_ranks.append(stretch_product * triads::textFrequency(ss)); // Rank according expectation (arXiv:0705.0751, Eq. 6)
++_subpattern_count;
}
set_sort_index();
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
*
* Class implementation of the approximate search algorithm
* P. Constans. Approximate textual retrieval. arXiv:0705.0751v1, 2007.
* P. Constans. Approximate textual retrieval. arXiv:0705.0751, 2007.
***************************************************************************/
#ifndef APPROXIMATEPATTERN_H
#define APPROXIMATEPATTERN_H
......
/***************************************************************************
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "arxivXml.h"
arxivXml::arxivXml(const QString& xml) : QXmlStreamReader()
{
_reference.clearReference();
addData(xml);
readReference();
}
void arxivXml::readReference()
{
if (hasError())
return;
QStringList authors;
while (reading("entry"))
if (name() == "author")
appendAuthor(&authors);
else if (name() == "journal_ref")
readField("note");
else if (name() == "title")
readField("title");
else if (name() == "summary")
readField("abstract");
else if (name() == "doi")
readField("doi");
else if (name() == "id")
processId();
else if (name() == "published")
processDate();
_reference["author"] = authors.join(", ");
}
void arxivXml::readField(const QString& field)
{
readNext();
_reference[field] = text().toString();
}
void arxivXml::processId()
{
readNext();
QRegExp rxarxiv("abs/(.+)$");
if (text().toString().contains(rxarxiv))
{
QString aid(rxarxiv.cap(1));
aid.remove(QRegExp("v\\d{1,2}$"));
_reference["eprint"] = aid;
_reference["journal"] = "arXiv:" + aid;
_reference["url"] = c2bUtils::arxivUrl.arg(aid);
}
}
void arxivXml::processDate()
{
readNext();
_reference["year"] = text().toString().left(4);
}
void arxivXml::appendAuthor(QStringList* authors)
{
while (reading("name"))
if (name() == "name")
{
readNext();
authors->append(text().toString());
}
}
bool arxivXml::reading(const QString& tag)
{
if (tokenType() == NoToken)
while (!atEnd())
if (readNext() == StartElement && name() == tag)
return true;
while (!atEnd())
{
TokenType t = readNext();
if (t == StartElement)
return true;
else if (t == EndElement && name() == tag)
return false;
}
return false;
}
/***************************************************************************
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef ARXIVXML_H
#define ARXIVXML_H
#include "bibReference.h"
#include <QXmlStreamReader>
class arxivXml : public QXmlStreamReader
{
public:
explicit arxivXml(const QString& xml);
inline ~arxivXml() {}
inline const bibReference& reference() const
{
return _reference;
}
private:
void readReference();
bool reading(const QString& tag);
void appendAuthor(QStringList* authors);
void processDate();
void processId();
void readField(const QString& field);
bibReference _reference;
};
#endif
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "authorString.h"
/** \page authorproc Processing of author's names
/** \page authorproc Processing of Author Names
The cb2Bib automatically processes the author names string. It uses a set
of heuristic rules. First, the authors separator is identified. And second,
it is decided whether or not author names are in natural or reverse order,
or in the 'Abcd, E., F. Ghij, ...' mixed order.
cb2Bib automatically processes the author names string. It uses a set of
heuristic rules. First, the authors separator is identified. And second, it
is decided whether or not author names are in natural or reverse order, or
in the 'Abcd, E., F. Ghij, ...' mixed order.
*/
authorString::authorString() : _full_form(false)
......@@ -29,7 +29,7 @@ authorString::authorString() : _full_form(false)
- Remove any character except <tt>-',;&\\.\\s\\w</tt>
- Simplify White Spaces
- Simplify white spaces
- Consider composing prefixes <tt>(da|de|dal|del|der|di|do|du|dos|la|le|van|vande|von)</tt>
......@@ -59,6 +59,9 @@ QString authorString::toBibTeX(const QString& author, bool full_form)
{
_full_form = full_form;
_author_string = author;
// BibTeX braces interfere with authorString, remove them even though some BibTeX meaning might be lost
_author_string.remove('{');
_author_string.remove('}');
author::simplifyString(_author_string, true);
as_unifier.unifyNames(_author_string);
const bool has_comma(_author_string.contains(','));
......@@ -478,7 +481,7 @@ QString fromMedline(const QString& author)
/**
Implementation of author field extraction
P. Constans. A Simple Extraction Procedure for Bibliographical Author Field.
arXiv:0902.0755v1, 2009.
arXiv:0902.0755, 2009.
*/
void encoder::encode(const QString& raw)
{
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef AUTHORSTRING_H
......@@ -74,7 +74,7 @@ struct unifier
/**
Implementation of author field extraction
P. Constans. A Simple Extraction Procedure for Bibliographical Author Field.
arXiv:0902.0755v1, 2009.
arXiv:0902.0755, 2009.
*/
struct encoder
{
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bibExtractor.h"
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#ifndef BIBEXTRACTOR_H
......
/***************************************************************************
* Copyright (C) 2004-2017 by Pere Constans
* Copyright (C) 2004-2018 by Pere Constans
* constans@molspaces.com
* cb2Bib version 1.9.7. Licensed under the GNU GPL version 3.
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution.
***************************************************************************/
#include "bibParser.h"
#include "arxivXml.h"
#include "authorString.h"
#include "bibPreparser.h"
#include "crJson.h"
#include "document.h"
#include "heuristicBibParser.h"
#include "idMaker.h"
......@@ -93,14 +95,20 @@ QString bibParser::parse(const QString& field, const QString& value, const QStri
}
else if (field == "doi")
v.remove(QRegExp("^.+(?=10\\.[\\d\\.]+/\\S+)"));
else if (field == "url")
{
// Remove redundant DOI URLs
if (v.contains("doi.org/10."))
v.clear();
}
else if (field == "isbn")
v.remove(' ');
else if (field == "journal")
{
if (_settingsP->value("cb2Bib/SetJournalsToFullname").toBool())
v = _journal_dbP->retrieveFull(v);
v = fullJournal(v);
else
v = _journal_dbP->retrieve(v);
v = abbreviatedJournal(v);
}
else if (field == "keywords")
{
......@@ -154,7 +162,7 @@ bibReference& bibParser::parse(bibReference& reference)
return reference;
}
QString bibParser::setJournalsToFull(const QString& text)
QString bibParser::setJournalsToFull(const QString& text, const bool alternate)
{
QString substituted_text(text);
QRegExp jnre("\\bjournal\\s*=\\s*[\\{\"](.*)[\\}\"]", Qt::CaseInsensitive);
......@@ -168,7 +176,7 @@ QString bibParser::setJournalsToFull(const QString& text)
{
QString line(jnre.cap(0));
const QString jn(jnre.cap(1));
line.replace(jn, fullJournal(jn));
line.replace(jn, alternate ? alternateFullJournal(jn) : fullJournal(jn));
substituted_text.replace(pos, jnre.matchedLength(), line);
pos += line.length();
nj++;
......@@ -180,7 +188,7 @@ QString bibParser::setJournalsToFull(const QString& text)
return (substituted_text);
}
QString bibParser::setJournalsToAbbreviated(const QString& text)
QString bibParser::setJournalsToAbbreviated(const QString& text, const bool alternate)
{
QString substituted_text(text);
QRegExp jnre("\\bjournal\\s*=\\s*[\\{\"](.*)[\\}\"]", Qt::CaseInsensitive);
......@@ -194,7 +202,7 @@ QString bibParser::setJournalsToAbbreviated(const QString& text)
{
QString line(jnre.cap(0));
const QString jn(jnre.cap(1));
line.replace(jn, abbreviatedJournal(jn));
line.replace(jn, alternate ? alternateAbbreviatedJournal(jn) : abbreviatedJournal(jn));
substituted_text.replace(pos, jnre.matchedLength(), line);
pos += line.length();
nj++;
......@@ -283,7 +291,7 @@ void bibParser::preparse(const QString& text, QString* out_text)
_preparserP->preparse(text, out_text);
}
/** \page bibproc Extracting data from the clipboard
/** \page clipboard Extracting Data from the Clipboard
Clipboard contents is processed according to the following rules:
......@@ -293,7 +301,8 @@ void bibParser::preparse(const QString& text, QString* out_text)
- Check if input stream is already a BibTeX entry. If so, process entry.
- Check if input stream is a PubMed XML or Medline entry. If so, process entry.
- Check if input stream is, in this order of preference, a PubMed XML,
arXiv XML, CR JSON, or Medline entry. If so, process entry.
- Preprocess author names: PI JOAN III -> Pi III, J.
(care of name prefixes, suffixes, and removal of ambiguities).
......@@ -308,17 +317,20 @@ void bibParser::preparse(const QString& text, QString* out_text)
- Remove leading and trailing white spaces, TABs and CRs.
- "\r\n", "\n" and/or "\r" replaced by the line indicator tag "<NewLineN>".
- "\r\n", "\n" and/or "\r" replaced by the line indicator tag <code><NewLineN></code>.
- Replace "\t" and ten or more consecutive "\s" by the tabular tag "<TabN>".
- Replace "\t" and ten or more consecutive "\s" by the tabular tag <code><TabN></code>.
- Simplify White Spaces
- Simplify white spaces
- Start the automatic recognition engine.
If the automatic recognition engine fails, optionally, a heuristic guessing
will be performed. See also \ref heuristicguess and \ref metadata.
will be performed.
See also \ref heuristics and \ref metadata.
*/
void bibParser::parse(const QString& text, QString* out_text, QString* out_tagtext)
......@@ -340,13 +352,84 @@ void bibParser::parse(const QString& text, QString* out_text, QString* out_tagte
return;
}
if (otext.contains("<PubmedArticle>"))
const QString pubmed_identifier("<PubmedArticle>");
if (otext.contains(pubmed_identifier))
{
pubmedXml pxml(metadataSection(otext, pubmed_identifier));
if (pxml.hasError())
{
_auto_recognized_string = tr("Error parsing 'PubMed XML': %1.").arg(pxml.errorString());
_auto_recognized = false;
}
else
{
_current_reference = pxml.reference();
parse(_current_reference);
currentReferenceUpdated();
_auto_recognized_string = tr("Processed as 'PubMed XML'.");
_auto_recognized = true;
}
emit statusMessage(_auto_recognized_string);