Commit Graph

93 Commits

Author SHA1 Message Date
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
Vincent van Ravesteijn
3ec0733fce Remove unneeded includes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40057 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-29 11:22:17 +00:00
Julien Rioux
772325ff70 Allow \nocite again with the basic citation engine.
Fix a bug introduced in r26547. Also reorders the entries for
natbib-numerical into a more natural, visually pleasing order.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39777 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-27 17:13:07 +00:00
Richard Heck
f567dd2bc1 Fix problem with citation dialog. The code changes here missed the need
for this part.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38353 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-12 17:32:16 +00:00
Richard Heck
b5d2e9d285 Fix output of HTML tags in bibliography info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35388 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-15 13:50:17 +00:00
Peter Kümmel
615d42d357 TR1: use std::tr1 regex with msvc10
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34725 a592a061-630c-0410-9148-cb99ea01b6c8
2010-06-29 17:09:40 +00:00
Richard Heck
2a21c12eab There are other ways we can get in trouble, so let's impose the limit
slightly differently.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33927 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-29 20:52:07 +00:00
Richard Heck
bc6ee8d251 Do the translation the right way.
By the way, has anyone noticed that _() returns empty if you call it
on a string we don't know how to translate? Might it be better if it
returned the original string?



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33925 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-29 20:21:30 +00:00
Richard Heck
808ff6650c Introduce a simple macro facility for citation formats. Also introduce
simple, translatable units for use in such formats.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33924 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-29 20:01:28 +00:00
Richard Heck
f1912e1c33 Read the citation formats from a file, rather than hardcoding them. This
allows for layout- or module-level customization of the display in the
citation dialog and of the XHTML bibliography output.

There is more of this to come, by the way. The next step is to allow
macros. That will make it easier to deal with translation issues, which
ought to be the final step.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33920 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-29 18:37:25 +00:00
Vincent van Ravesteijn
e73c866edf Squash warning.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33900 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-28 22:22:24 +00:00
Richard Heck
8c115c7185 Whitespace and comments.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33886 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-28 02:18:22 +00:00
Richard Heck
9667514c86 Make a couple of important bibliographic phrases translatable.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33885 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-28 02:12:40 +00:00
Richard Heck
60434e6a00 These can just be strings, and will need to be so later.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33884 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-27 22:51:38 +00:00
Richard Heck
5696be2a66 Allow the use of rich text in citation formats. And use them in the
citaton dialog.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33880 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-27 13:54:14 +00:00
Richard Heck
206ca45751 This is the first step towards allowing customization of how BibTeX
entries are represented, both in LyX and in XHTML output. Try looking at
the InsetCitation dialog and, in particular, at entries that have
crossref fields and you will see the benefit there.

The next step is to allow this stuff to be read from a file.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33879 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-27 12:58:26 +00:00
Richard Heck
a56f7bff1c Fix other bit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33466 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-13 15:22:49 +00:00
Jürgen Spitzmüller
ce349ad806 Fix encoding issues in bibitems (bug #6534)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33452 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-12 16:08:30 +00:00
Richard Heck
9a327ccc51 Fix non-BibTeX detection of "author (year)" labels.
Jurgen, this one is actually for branch, too.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33142 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-21 19:48:53 +00:00
Richard Heck
782db81f77 Author-year citations for XHTML output.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32969 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-11 16:11:55 +00:00
Richard Heck
833e7085dd A little cleanup of some of the BibTeX info access.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32915 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-09 16:57:08 +00:00
Richard Heck
2098f1d8c2 Routines for calculating numerical labels for BibTeX citations.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32891 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-08 18:19:13 +00:00