Commit Graph

155 Commits

Author SHA1 Message Date
Juergen Spitzmueller
8365eabd6f Make paper search function accessible and customizable 2020-08-27 08:48:55 +02:00
Scott Kostyshak
4c0073cd03 Whitespace 2020-08-20 21:51:29 -04:00
Pavel Sanda
e648202e7e Allow LyX to find pdfs and urls of citation references and follow them from context menu.
Currently tested:
- url & doi fields for bibtex.
- all documented eprinttypes of biblatex
- absolute paths of first entry of 'file' field for jabref and kbibtex
- external script searching for author + year pdf

Additional polishing will follow.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg212505.html
2020-08-20 09:12:54 +02:00
Richard Kimberly Heck
8ae0841826 Whitespace 2020-07-08 12:38:05 -04:00
Thibaut Cuvelier
3883b85f49 New DocBook support 2020-07-08 08:42:16 +02:00
Thibaut Cuvelier
a6b07608d8 Rename XHTMLStream to XMLStream, move it to another file, and prepare for DocBook adoption.
xml.cpp/h also merges functionalities from sgml.cpp/h.
2020-06-15 13:01:56 +02:00
Richard Kimberly Heck
c506f304bc Fix a number of issues that were stopping compilation with MSVC 19.
Patch from Thibaut Cuvelier, modified slightly by me (mostly for style).
2020-05-04 19:45:58 -04:00
Richard Kimberly Heck
4a81983edd Avoid a copy. 2020-02-29 05:55:20 -05:00
Richard Kimberly Heck
5b5b6998cb Use more ranges 2020-02-28 01:06:22 -05:00
Jean-Marc Lasgouttes
d9edf32b67 Remove some useless expressions
Spotted by cppcheck
2019-10-27 00:09:05 +02:00
Richard Kimberly Heck
c2f5c850d9 Use const & 2019-09-13 11:49:29 -04:00
Jean-Marc Lasgouttes
714113655a Follow some of the performance advice from cppcheck
Most of that is changing string to string const &.
2019-09-13 16:23:49 +02:00
Juergen Spitzmueller
1386a3d8fd Allow for multiple use of same key in qualified citation lists
File format change

Fixes: #11618, #11632
2019-08-07 13:00:29 +02:00
Juergen Spitzmueller
623f7b4795 Truncate long citation label in the middle rather than the end.
Fixes: #10769
2019-07-09 14:48:11 +02:00
Juergen Spitzmueller
bebc184054 Display full author list with Natbib (non-BibTeX) if requested 2019-04-19 09:33:31 +02:00
Juergen Spitzmueller
5db4d712ef Differentiate Buffer strings and GUI strings in citeengines
The former need to be translated to the buffer language, the latter to
the GUI language.

Fixes: #10946
2018-01-27 14:29:41 +01:00
Jean-Marc Lasgouttes
eebea6284d Simplify code in BiblioInfo.cpp
... and avoid MSVC warning

Fixes bug #10905
2017-12-14 15:43:04 +01:00
Enrico Forestieri
c16ccdb5fd Fix issue with regular expressions
At least with gcc 6.4, if the first parameter passed to
regex_match() is afterward changed, the second one gets
corrupted. This is avoided by using a temporary string.
2017-10-15 15:29:33 +02:00
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Juergen Spitzmueller
5685080356 Correct restoration of citation style selection between engine switches
We stored the combo position index, but this changes on engine switch.

This also fixes a crash due to out-of-bound index at engine switch.

Fixes: #10692
2017-06-10 14:29:07 +02:00
Juergen Spitzmueller
1a8fd56333 Consider text-mode accents of the form {\v a} in BiblioInfo
Fixes #9340.
2017-03-19 16:15:03 +01:00
Juergen Spitzmueller
1eba2c92da Improve BibTeX name parsing #4
Handle name prefix (aka "von" part) as a separate entity, just like
BibTeX and Biblatex do. This allows to omit or reposition it in
accordance to the current style ("Goethe, Johann Wolfgang" or
"von Goethe, Johann Wolfgang" or "Goethe, Johann Wolfgang von" are all
valid and used).

LyX's name parser should now be on par with BibTeX's.
2017-03-19 14:03:48 +01:00
Juergen Spitzmueller
7489cab6c9 Replace "junior" with the more generic term "suffix". 2017-03-19 13:33:56 +01:00
Juergen Spitzmueller
5fdcca4c06 Improve BibTeX name parsing #3
Correctly handle name suffix ("Jr.-part")
2017-03-19 12:42:18 +01:00
Juergen Spitzmueller
9f4df64f23 Allow for simple conditions in name scheme.
I.e., only output a comma between last and first name if there is
a first name.
2017-03-19 11:45:42 +01:00
Juergen Spitzmueller
08500c1a7c Improve BibTeX name parsing #2
Also consider grouping when looking for name separators.

Cases such as {{Barnes and Noble, Inc.}} are now handled correctly.
2017-03-19 11:44:22 +01:00
Juergen Spitzmueller
ee26e7fadf Improve BibTeX name parsing #1
Consider groupings of name parts via {...}
2017-03-19 11:41:33 +01:00
Richard Heck
322331c53a Fix problem noted at bug #10582.
When we have a name with more than two parts, but no "von",
it was coming out as, e.g.:
	Obama, Barack Hussain Obama
i.e., with the last name appearing twice.

Also adds a check for names without spaces, which would have given:
	Pele, Pele

This was not the original issue at #10582, so that bug is still
open (though I cannot reproduce it).
2017-03-12 16:43:15 -04:00
Richard Heck
8414c38e4b Whitespace and const'ing. 2017-03-12 16:27:36 -04:00
Jean-Marc Lasgouttes
e2f2915f8e Be careful about unparsable bibtex years
Handle gracefully the case where the regex that parses a year fails.

This is a fixup to ba171930 (spotted by coverity).
2017-03-10 10:35:03 +01:00
Richard Heck
4569010b66 Add a comment. 2017-03-08 17:34:07 -05:00
Jean-Marc Lasgouttes
dee0ea0c21 Make a test clearer
This should hopefully please coverity now. For some reason, the
annotation did not work. Should it be in lower case?
2017-03-08 17:03:48 +01:00
Juergen Spitzmueller
68ab4023cc Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:

\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...

with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)

See the biblatex manual, sec. 3.8.3., for details.

File format change.
2017-01-21 14:25:17 +01:00
Juergen Spitzmueller
a751c5b846 Extend and improve name list handling
This allows to generate different name lists depending on the need and
context.

Also addresses #8489.
2017-01-09 17:54:56 +01:00
Juergen Spitzmueller
b81b439dec No punctuation in labels! 2017-01-08 15:24:39 +01:00
Juergen Spitzmueller
dbbefcd321 Dynamically set final punctuation of bib entries
Fullcite does not need the punct.
2017-01-07 17:55:38 +01:00
Juergen Spitzmueller
53654b430e Make max_key_size limit adjustable
This _must_ be increased for xhtml output of fullcite, else we get
fragmentary html code.

I am aware of the reason for this size limit (#8944) and have carefully
checked that this is not affected.
2017-01-07 17:46:18 +01:00
Juergen Spitzmueller
2ff40fba72 Add a couple more BiblioInfo conditionals
* ifentrytype:<type> whether we are a specific entry type (e.g. "book")

* export: export context (as opposed to dialog or workarea)

* second: whether we are in the second item of a list (useful when you
  need to separate by " and " or ", and "
2017-01-07 17:45:51 +01:00
Juergen Spitzmueller
378a2c8257 Outsource jurabib specials to the style file. 2017-01-07 17:40:23 +01:00
Juergen Spitzmueller
eba2f0479e Implement display of starred cite commands
This entails a change of getAbbrAuthor to getAuthorList (the default is
still abbreviated with respect to MaxCiteItems, but the list can be, at
explicit request, shortened or full notwithstanding MaxCiteItems.
2017-01-07 17:32:45 +01:00
Juergen Spitzmueller
6933051747 Implement display of forceUpperCase 2017-01-07 17:21:41 +01:00
Juergen Spitzmueller
3a0d1d1049 Implement CiteItem in the chain
This allows us to get rid of many idiosyncratic arguments and gives us
a cleaner chain (plus easier extensibility).
2017-01-07 17:17:02 +01:00
Juergen Spitzmueller
e6666bd62a Generalize starred cite commands
Not all of them expand the author list. Thus rename the parameter to
hasStarredVersion and provide a means to adjust the GUI accordingly.
2017-01-03 17:25:41 +01:00
Juergen Spitzmueller
958f6193ed Differentiate InsetCite
Next to the cmd name, introduce optional latex names (that might differ
from the cmd name) and aliases (that are "obsoleted by" the cmd).

This enhances portability between the engines.
2017-01-03 13:11:11 +01:00
Juergen Spitzmueller
0b4d9d8d4a Generalize uppercase test
Biblatex has \Textcite and friends.
2017-01-03 13:01:41 +01:00
Juergen Spitzmueller
b941d93974 Amend 2c4673af58
Also consider xrefs in crossref'ed entries.
2016-09-20 11:34:17 +02:00
Juergen Spitzmueller
67da1431de Improve info display for biblatex databases, part III
When resolving biblatex's xdata references, consider that xdata fields
can contain a comma-separated list of keys, not just a single key like
crossref.
2016-09-19 19:09:42 +02:00
Juergen Spitzmueller
1c725c913c Regex fix for endyear
As of biblatex 3.5, years and endyears can be negative (BCE).
2016-09-18 12:59:43 +02:00
Juergen Spitzmueller
2c4673af58 Improve info display for biblatex databases, part II
In addition to the classic crossref, biblatex introduces xdata
references in order to source-out common data of entries. Entries
that have "xdata = {somekey}" just inherit all fields from the
respective @xdata entry, if the field is not already defined in
the entry itself (just like crossref, with the exception that @xdata
entries themselves are _never_ output on their own). @xdata entries can
themselves inherit to other @xdata entries (ad infinitum). So you can,
for instance, setup an xdata entry for a book series with series name
that inherits an xdata entry with information of the publisher
(publisher, address). Any book of that series would just need to refer
to the series xdata and add the number.

BiblioInfo now checks, in addition to crossrefs, for such xdata
references and inherits missing fields.

Nte that biblatex also introduces an "xref" field as an alternative to
crossref. We must not care about that, since the point of xref is that
it does not inherit fields from the target (just cites that one if a
given number of refs to it exist)
2016-09-18 12:44:12 +02:00