mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
InsetBibtex.cpp:
- fix #1881, fileformat change - fix #6470 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35590 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1e8059fcf2
commit
e8a1fed47c
@ -2180,6 +2180,7 @@ def revert_rule(document):
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
def revert_diagram(document):
|
||||
" Add the feyn package if \\Diagram is used in math "
|
||||
i = 0
|
||||
@ -2202,6 +2203,34 @@ def revert_diagram(document):
|
||||
return
|
||||
|
||||
|
||||
def convert_bibtexClearpage(document):
|
||||
" insert a clear(double)page bibliographystyle if bibtotoc option is used "
|
||||
while True:
|
||||
i = find_token(document.header, '\\papersides', 0)
|
||||
document.warning(str(i))
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Can't find papersides definition.")
|
||||
return
|
||||
else:
|
||||
sides = int(document.header[i][12])
|
||||
# only act of there is the option "bibtotoc"
|
||||
j = find_token(document.body, 'options "bibtotoc', 0)
|
||||
if j == -1:
|
||||
return
|
||||
subst1 = '\\begin_layout Standard\n' \
|
||||
+ '\\begin_inset Newpage clearpage\n' \
|
||||
+ '\end_inset\n\n\n' \
|
||||
+ '\end_layout\n'
|
||||
subst2 = '\\begin_layout Standard\n' \
|
||||
+ '\\begin_inset Newpage cleardoublepage\n' \
|
||||
+ '\end_inset\n\n\n' \
|
||||
+ '\end_layout\n'
|
||||
if sides == 1:
|
||||
document.body.insert(j -5, subst1)
|
||||
else:
|
||||
document.body.insert(j -5, subst2)
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
@ -2263,10 +2292,12 @@ convert = [[346, []],
|
||||
[398, []],
|
||||
[399, [convert_mathdots]],
|
||||
[400, [convert_rule]],
|
||||
[401, []]
|
||||
[401, []],
|
||||
[402, [convert_bibtexClearpage]]
|
||||
]
|
||||
|
||||
revert = [[400, [revert_diagram]],
|
||||
revert = [[401, []],
|
||||
[400, [revert_diagram]],
|
||||
[399, [revert_rule]],
|
||||
[398, [revert_mathdots]],
|
||||
[397, [revert_mathrsfs]],
|
||||
|
@ -127,7 +127,7 @@ namespace {
|
||||
|
||||
// Do not remove the comment below, so we get merge conflict in
|
||||
// independent branches. Instead add your own.
|
||||
int const LYX_FORMAT = 401; // Ronen: support for \Diagram
|
||||
int const LYX_FORMAT = 402; // uwestoehr: fix for bug 1881
|
||||
|
||||
typedef map<string, bool> DepClean;
|
||||
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "output_xhtml.h"
|
||||
#include "OutputParams.h"
|
||||
#include "PDFOptions.h"
|
||||
#include "TextClass.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
@ -379,16 +380,12 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
|
||||
|
||||
// bibtotoc-Option
|
||||
if (!bibtotoc.empty() && !buffer().params().use_bibtopic) {
|
||||
if (buffer().params().documentClass().hasLaTeXLayout("chapter")) {
|
||||
if (buffer().params().sides == OneSide) {
|
||||
// oneside
|
||||
os << "\\clearpage";
|
||||
} else {
|
||||
// twoside
|
||||
os << "\\cleardoublepage";
|
||||
}
|
||||
// set label for hyperref, see http://www.lyx.org/trac/ticket/6470
|
||||
if (buffer().params().pdfoptions().use_hyperref)
|
||||
os << "\\phantomsection";
|
||||
if (buffer().params().documentClass().hasLaTeXLayout("chapter"))
|
||||
os << "\\addcontentsline{toc}{chapter}{\\bibname}";
|
||||
} else if (buffer().params().documentClass().hasLaTeXLayout("section"))
|
||||
else if (buffer().params().documentClass().hasLaTeXLayout("section"))
|
||||
os << "\\addcontentsline{toc}{section}{\\refname}";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user