Commit Graph

114 Commits

Author SHA1 Message Date
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
Juergen Spitzmueller
ba17193067 Improve info display for biblatex databases
If an entry does not have a year field, check for a date field
(the common type in biblatex databases) and extract the year(s).

Candidate for branch.
2016-09-18 10:33:33 +02:00
Richard Heck
fb84ccd9fb The way this was previously, it had to fail if the GUI language
was not English: We return the the abbreviated author "One and Two",
but translated to the GUI language; then we search that for " and "
in order to pull the authors apart again.

I've just replaced the distinct routines with a single one that handles
both cases, depending upon whether a Buffer is provided as one argument.
2016-07-17 22:50:17 -04:00
Richard Heck
d5633f17e5 Fix thinko that led 2-authors citations to be displayed with "et al." 2016-07-17 22:31:54 -04:00
Richard Heck
c4ef96c030 Citation commands do not absolutely have to start with "c". 2016-07-13 14:25:46 -04:00
Richard Heck
4152c68c66 Add comment to fix coverity #111935. 2016-06-12 00:31:33 -04:00
Guillaume Munch
bb344452c8 Consistency of ellipses across the UI
Use the function support:truncateWithEllipsis() to shorten a docstring with
... at the end. Actually we use U+2026 HORIZONTAL ELLIPSIS instead of "..." when
automatically shortening strings. This is to be consistent with Qt's own
truncation and is much nicer on the screen.

This includes the bugs #9575 and #9572 regarding broken text elision in the
outliner.

Known issues (non-regressions):

* TocBackend::updateItem() should be rewritten to update all TOCs. (#8386)

* "..." should be replaced with … everywhere else on the interface (including
  translation strings).

* We should prefer to rely on QFontMetrics::elidedText() to truncate strings
  with an ellipsis whenever possible, or an equivalent for the buffer view
  dependent on the font metrics. See the warning in src/support/lstrings.h.
2015-10-05 21:16:16 +01:00
Guillaume Munch
94e992c5ed Better construction of the TOC for floats and captions
We introduce TocBuilder for building TOCs that take into account both float
insets and their captions.

* Floats without caption are shown with their content.

* Floats with a caption are shown with their caption, but clicking the entry now
  correctly moves to the float and not to the caption.

* Subsequent captions produce additional entries in the TOC.

* Figures and subfigures are correctly ordered in the outliner.

* New TOC "senseless" for captions appearing alone (a bit like broken references
are still displayed in the menu and outliner).

* Disable LFUN_CAPTION_INSERT if there is already a caption in a listing

Known issues:

* Inconsistent output for includes located inside floats

* We should record the end of the float in addition of the beginning for a more
  accurate cursor -> outliner entry conversion
2015-09-15 15:25:33 +01:00
Richard Heck
080a4d84e2 Fix bug #9296. The key may be multiple keys. 2014-10-16 16:31:03 -04:00
Richard Heck
643deb8aa0 Add a FIXME. 2014-05-23 11:36:12 -04:00
Richard Heck
b992968a15 Fix bug #9131 for development branch. There are two parts to the fix.
The firs tinvolves a thinko in BibTeXInfo::expandFormat. We were previously
counting passes through this routine, which means: one for every character,
more or less. So long strings would hit the "recursion limit". But what
we are worried about is an infinite loop caused by misues of macros, so that
is what we need to count.

This prevents the error we were previously getting, but it reveals a huge
slowdown when one tries to open a citation inset with a large nubmer of keys.
So we also limit the number of keys we try to process, and the length of the
string we try to display, when we are generating citation information.

I'm convinced that there is a deeper problem in how citation information is
generated (see the bug tracker for more info), but that will require major
surgery and a file format change
2014-05-23 11:26:45 -04:00
Richard Heck
ba17d842b4 Add some const-ref-ness, and remove some default arguments that are
never treated as defaults.
2014-05-23 11:03:17 -04:00
Richard Heck
344ea62dd0 Fix up logic of BibTeXInfo::getInfo. We don't need to process the
richtext stuff unless we actually need it.
2014-05-23 10:48:22 -04:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00
Richard Heck
2e23f1719e This is meant to be almost UINT_MAX, but needn't really be that
big, and I don't see the point of pulling in limits.h.
2014-02-13 17:55:53 -05:00
Richard Heck
b7a1eb68e1 Fix bug #8944 by introducing a maximum size for keys we process.
The problem is caused by the fact that Encodings::fromLaTeXCommand
is very slow. It's not clear to me if that can be fixed, or if that
is just how things are. Georg suggested another time that we might
use tex2lyx in or instead of convertLatexCommands() in BiblioInfo.cpp,
but I don't know if that would much faster. The author string in the
example file is 32K characters long. As long as some files tex2lyx
would convert.
2014-02-12 13:28:26 -05:00
Juergen Spitzmueller
98dd9e9b91 Fix encoding problems in citation labels by using docstring (not string) where appropriate 2013-07-20 16:05:52 +02:00
Julien Rioux
cde541d785 New \cite_engine_type default.
The default citation capability of LaTeX is not a true numerical
citation engine, rather it uses a mixture of labels/numbers. Thus
we now distinguish them: "numerical" always increments the bibitem
counter and uses its value as a numerical citation label, while
"default" only uses the bibitem counter when no label is provided.

LyX file format incremented to 471.
2013-05-16 20:39:23 +02:00
Julien Rioux
bfc731de45 Compute and output numbers for numerical citations. 2013-05-16 16:10:05 +02:00
Julien Rioux
66f44f46c2 Add modifier to jurabib and natbib (author-year) modules. 2013-05-13 20:58:12 +02:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Richard Heck
62d1e762c7 Remove debugging code. 2013-03-27 21:30:47 -04:00
Richard Heck
4df02801a6 Links between citations and bibliography entries were broken in XHTML
output, due to failure to clean the ids in the new citation stuff.

I've solved this by allowing the citation format information to contain
keys of the form "clean:key". This signals that we are to apply the
html::cleanAttr() function to the key before returning it. I.e., we
strip non-alphanumeric stuff, basically.
2013-03-27 15:59:36 -04:00
Julien Rioux
3408ca4204 Support for \fullcite in LyXHTML and text export (fixes #8491). 2013-02-06 17:37:59 +01:00
Julien Rioux
6456c2262e Move label generation from InsetBibtex to BiblioInfo.
This only move the code, but does not change the displayed labels.
Thus for numerical citation, the label is set to the cite number;
for author-year citation, the abbreviated list of authors is used
i.e. "Smith et al. 2001".

Eventually, we might want to make the label customizable, or get
it from BibTeX.
2013-02-06 17:37:58 +01:00
Julien Rioux
f51636b547 Remove unused code. 2013-02-06 17:37:57 +01:00
Julien Rioux
3f8de8fe92 Better fix for #7732: Use buffer.B_().
Also handle "and others" which is translated by BibTeX to "et al.".
2013-01-15 14:12:34 +01:00
Julien Rioux
15b2501177 LyXHTML linking from citation to bib entry for LyX 2.1 (fixes #8490).
What was previously accomplished by wrapCitation is now customizable in the
layout files. What we provide by default here corresponds roughly to the
LyX 2.0 behavior.
2013-01-10 15:32:00 +01:00
Julien Rioux
30f200a7e7 Fix cache for getInfo() with/without richtext (fixes #8486). 2013-01-08 16:34:02 +01:00
Julien Rioux
f6cd5ab863 Preserve BibTeX metadata in LyXHTML output (fixes #8451). 2013-01-08 16:33:12 +01:00
Julien Rioux
24a2c57ff0 Move richtext escaping to its own postprocessing routine. 2013-01-08 16:33:11 +01:00
Julien Rioux
e6aab49ff4 Use document language when exporting citations to LyXHTML (fixes #7732). 2013-01-07 16:00:47 +01:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Lars Gullik Bjønnes
43f6b1672b Use empty() to check empty and non-empty'ness not size()
Also add FormatList::empty().
2012-10-27 01:25:38 +02:00
Richard Heck
319e35188a Style. 2012-05-13 13:40:22 -04:00
Georg Baum
1a6c599917 Extend the notermination flag to math as well.
Math commands need it as well as text commands. At the same time, this
further unifies the checking for termination and fixes cases of wrong
output (e.g. for 0x2005).
2012-03-25 15:57:38 +02:00
Julien Rioux
1e947e3a18 Move the citation engine machinery to layouts.
Add a new layout syntax CiteEngine to define the citation commands
available for a given citation engine.

Also extend the CiteFormat syntax to allow more customization. This
mechanism, previously used to produce bibliography entries in the
citation GUI based on the BibTeX entrytype, is now also used to
produce the textual labels for citation insets in the buffer view.

Thus citation styles are almost completely customizable by modules.
Modules for the basic, jurabib and natbib engines are implemented.

Layout format incremented to 37.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40820 a592a061-630c-0410-9148-cb99ea01b6c8
2012-03-01 00:41:30 +00:00
Julien Rioux
e3f65fd088 Buffer param \cite_engine_type (authoryear|numerical).
To avoid duplicity, remove natbib_authoryear and natbib_numerical
and replace them by natbib, and keep track of the engine `type'
in the new \cite_engine_type document setting. This will make it
easier to add more citation engines.

LyX format incremented to 424.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40592 a592a061-630c-0410-9148-cb99ea01b6c8
2012-01-09 13:16:38 +00:00
Georg Baum
bb0432d74a Beautify output of \usepckage statements (each statement is on its own line
now) and move more packages to the new exclude mechanism.
The remaining ones are not so easy.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40442 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-08 20:05:51 +00:00
Julien Rioux
467c955507 This is not limited to BibTeX. Missing citation keys can also happen for standard bibitem.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40378 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-05 13:17:55 +00:00
Julien Rioux
7aee04217d Give a visual feedback that the BibTeX key could not be found.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40349 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-03 22:24:44 +00:00
Julien Rioux
dfdcc56cba Remove extra whitespace.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40346 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-03 22:15:11 +00:00