mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Merge branch 'master' into biblatex2
This commit is contained in:
commit
ecbd047cff
53
development/tools/alpha_lfuns.pl
Normal file
53
development/tools/alpha_lfuns.pl
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
@lines;
|
||||
|
||||
while (<>) { push @lines, $_; }
|
||||
|
||||
$l = 0;
|
||||
$found = 0;
|
||||
while (1) {
|
||||
if ($lines[$l] =~ m{^/\*!}) {
|
||||
last if $found == 2;
|
||||
$found++;
|
||||
}
|
||||
print $lines[$l];
|
||||
$l++;
|
||||
}
|
||||
|
||||
$cmdlines = [$line];
|
||||
%cmds;
|
||||
$cmdname = "";
|
||||
|
||||
while (1) {
|
||||
$line = $lines[$l];
|
||||
if ($line =~ /{ LFUN_NOACTION, "", Noop, Hidden }/) {
|
||||
push @$cmdlines, "\n";
|
||||
$cmds{$cmdname} = $cmdlines;
|
||||
$cmdlines = [$line];
|
||||
last;
|
||||
}
|
||||
if ($line =~ m/^\s*{\s*LFUN_([^,]+)/) {
|
||||
$cmdname = $1;
|
||||
push @$cmdlines, $line;
|
||||
}
|
||||
elsif ($line =~ m{^/\*!}) {
|
||||
push @$cmdlines, "\n";
|
||||
$cmds{$cmdname} = $cmdlines;
|
||||
$cmdlines = [$line];
|
||||
}
|
||||
else {
|
||||
push @$cmdlines, $line;
|
||||
}
|
||||
$l++;
|
||||
}
|
||||
|
||||
# Now output those, in order
|
||||
|
||||
foreach $c (sort keys %cmds) {
|
||||
print @{$cmds{$c}};
|
||||
}
|
||||
|
||||
while ($l < scalar @lines) {
|
||||
print $lines[$l]; $l++;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#LyX 2.3 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 526
|
||||
\lyxformat 527
|
||||
\begin_document
|
||||
\begin_header
|
||||
\save_transient_properties true
|
||||
@ -26327,7 +26327,7 @@ reference "fig:Two-distorted-images"
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted 424524441 1483414742
|
||||
\change_inserted 424524441 1483817911
|
||||
Label
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
@ -26335,7 +26335,34 @@ Label
|
||||
only: prints only the \SpecialChar LaTeX
|
||||
label for the reference.
|
||||
This allows for customization, using ERT, if you want to issue a command
|
||||
that LyX does not support.z
|
||||
that LyX does not support.
|
||||
If you are using
|
||||
\series bold
|
||||
refstyle
|
||||
\series default
|
||||
, then you may want to use the
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
No prefix
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
option, which will output only the part of the reference following the
|
||||
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
:
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
separator.
|
||||
This is the form needed for, e.g.,
|
||||
\series bold
|
||||
refstyle
|
||||
\series default
|
||||
's range commands.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX 2.3 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 526
|
||||
\lyxformat 527
|
||||
\begin_document
|
||||
\begin_header
|
||||
\save_transient_properties true
|
||||
@ -8320,14 +8320,12 @@ Verbatim
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim
|
||||
|
||||
This is Verbatim.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim
|
||||
\noindent
|
||||
\align block
|
||||
|
||||
The following 2 lines are empty:
|
||||
\end_layout
|
||||
|
||||
@ -8340,7 +8338,6 @@ The following 2 lines are empty:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim
|
||||
|
||||
Almost everything is allowed in Verbatim:"%&$§#~'`
|
||||
\backslash
|
||||
}][{|
|
||||
@ -8364,7 +8361,6 @@ Verbatim
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim*
|
||||
|
||||
This is Verbatim*.
|
||||
\end_layout
|
||||
|
||||
@ -27590,7 +27586,7 @@ reference "fig:Two-distorted-images"
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted 424524441 1483414501
|
||||
\change_inserted 424524441 1483817846
|
||||
Label
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
@ -27599,6 +27595,33 @@ only: prints only the \SpecialChar LaTeX
|
||||
label for the reference.
|
||||
This allows for customization, using ERT, if you want to issue a command
|
||||
that LyX does not support.
|
||||
If you are using
|
||||
\series bold
|
||||
refstyle
|
||||
\series default
|
||||
, then you may want to use the
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
No prefix
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
option, which will output only the part of the reference following the
|
||||
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
:
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
separator.
|
||||
This is the form needed for, e.g.,
|
||||
\series bold
|
||||
refstyle
|
||||
\series default
|
||||
's range commands.
|
||||
\change_deleted 424524441 1483414539
|
||||
|
||||
\end_layout
|
||||
|
@ -1082,7 +1082,7 @@ def revert_labelonly(document):
|
||||
i = j + 1
|
||||
continue
|
||||
document.body[i:j+1] = put_cmd_in_ert([label])
|
||||
i = j + 1
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_plural_refs(document):
|
||||
@ -1131,8 +1131,46 @@ def revert_plural_refs(document):
|
||||
cmd += "[s]"
|
||||
cmd += "{" + suffix + "}"
|
||||
document.body[i:j+1] = put_cmd_in_ert([cmd])
|
||||
i = j + 1
|
||||
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_noprefix(document):
|
||||
" Revert labelonly tags with 'noprefix' set "
|
||||
i = 0
|
||||
while (True):
|
||||
i = find_token(document.body, "\\begin_inset CommandInset ref", i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_inset(document.body, i)
|
||||
if j == -1:
|
||||
document.warning("Can't find end of reference inset at line %d!!" %(i))
|
||||
i += 1
|
||||
continue
|
||||
k = find_token(document.body, "LatexCommand labelonly", i, j)
|
||||
if k == -1:
|
||||
i = j
|
||||
continue
|
||||
noprefix = get_bool_value(document.body, "noprefix", i, j)
|
||||
if not noprefix:
|
||||
del_token(document.body, "noprefix", i, j)
|
||||
i = j
|
||||
continue
|
||||
label = get_quoted_value(document.body, "reference", i, j)
|
||||
if not label:
|
||||
document.warning("Can't find label for reference at line %d!" %(i))
|
||||
i = j + 1
|
||||
continue
|
||||
try:
|
||||
(prefix, suffix) = label.split(":", 1)
|
||||
except:
|
||||
document.warning("No `:' separator in formatted reference at line %d!" % (i))
|
||||
# we'll leave this as an ordinary labelonly reference
|
||||
del_token(document.body, "noprefix", i, j)
|
||||
i = j
|
||||
continue
|
||||
document.body[i:j+1] = put_cmd_in_ert([suffix])
|
||||
i += 1
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
@ -1157,10 +1195,12 @@ convert = [
|
||||
[523, []],
|
||||
[524, []],
|
||||
[525, []],
|
||||
[526, []]
|
||||
[526, []],
|
||||
[527, []]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[526, [revert_noprefix]],
|
||||
[525, [revert_plural_refs]],
|
||||
[524, [revert_labelonly]],
|
||||
[523, [revert_crimson, revert_cochinealmath]],
|
||||
|
6708
src/LyXAction.cpp
6708
src/LyXAction.cpp
File diff suppressed because it is too large
Load Diff
@ -3123,7 +3123,7 @@ void GuiDocument::paramsToDialog()
|
||||
updateQuoteStyles();
|
||||
|
||||
langModule->quoteStyleCO->setCurrentIndex(
|
||||
bp_.quotes_style);
|
||||
langModule->quoteStyleCO->findData(bp_.quotes_style));
|
||||
langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
|
||||
|
||||
bool default_enc = true;
|
||||
|
@ -110,6 +110,8 @@ GuiRef::GuiRef(GuiView & lv)
|
||||
this, SLOT(changed_adaptor()));
|
||||
connect(capsCB, SIGNAL(clicked()),
|
||||
this, SLOT(changed_adaptor()));
|
||||
connect(noprefixCB, SIGNAL(clicked()),
|
||||
this, SLOT(changed_adaptor()));
|
||||
|
||||
enableBoxes();
|
||||
|
||||
@ -137,9 +139,12 @@ void GuiRef::enableBoxes()
|
||||
{
|
||||
bool const isFormatted =
|
||||
(InsetRef::getName(typeCO->currentIndex()) == "formatted");
|
||||
bool const isLabelOnly =
|
||||
(InsetRef::getName(typeCO->currentIndex()) == "labelonly");
|
||||
bool const usingRefStyle = buffer().params().use_refstyle;
|
||||
pluralCB->setEnabled(isFormatted && usingRefStyle);
|
||||
capsCB->setEnabled (isFormatted && usingRefStyle);
|
||||
capsCB->setEnabled(isFormatted && usingRefStyle);
|
||||
noprefixCB->setEnabled(isLabelOnly);
|
||||
}
|
||||
|
||||
|
||||
@ -301,6 +306,7 @@ void GuiRef::updateContents()
|
||||
|
||||
pluralCB->setChecked(params_["plural"] == "true");
|
||||
capsCB->setChecked(params_["caps"] == "true");
|
||||
noprefixCB->setChecked(params_["noprefix"] == "true");
|
||||
|
||||
// insert buffer list
|
||||
bufferCO->clear();
|
||||
@ -342,6 +348,8 @@ void GuiRef::applyView()
|
||||
from_ascii("true") : from_ascii("false");
|
||||
params_["caps"] = capsCB->isChecked() ?
|
||||
from_ascii("true") : from_ascii("false");
|
||||
params_["noprefix"] = noprefixCB->isChecked() ?
|
||||
from_ascii("true") : from_ascii("false");
|
||||
restored_buffer_ = bufferCO->currentIndex();
|
||||
}
|
||||
|
||||
|
@ -403,6 +403,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="noprefixCB">
|
||||
<property name="toolTip">
|
||||
<string>Do not output part of label before ":"</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No Prefix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -71,6 +71,7 @@ ParamInfo const & InsetRef::findInfo(string const & /* cmdName */)
|
||||
ParamInfo::HANDLING_ESCAPE);
|
||||
param_info_.add("plural", ParamInfo::LYX_INTERNAL);
|
||||
param_info_.add("caps", ParamInfo::LYX_INTERNAL);
|
||||
param_info_.add("noprefix", ParamInfo::LYX_INTERNAL);
|
||||
}
|
||||
return param_info_;
|
||||
}
|
||||
@ -110,7 +111,7 @@ docstring InsetRef::getFormattedCmd(docstring const & ref,
|
||||
|
||||
// we have to have xxx:xxxxx...
|
||||
if (label.empty()) {
|
||||
LYXERR0("Label `" << ref << "' contains no prefix.");
|
||||
LYXERR0("Label `" << ref << "' contains no `:' separator.");
|
||||
label = ref;
|
||||
prefix = from_ascii("");
|
||||
return defcmd;
|
||||
@ -181,7 +182,19 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
|
||||
os << '{' << label << '}';
|
||||
}
|
||||
else if (cmd == "labelonly") {
|
||||
os << getParam("reference");
|
||||
docstring const & ref = getParam("reference");
|
||||
if (getParam("noprefix") != "true")
|
||||
os << ref;
|
||||
else {
|
||||
docstring prefix;
|
||||
docstring suffix = split(ref, prefix, ':');
|
||||
if (suffix.empty()) {
|
||||
LYXERR0("Label `" << ref << "' contains no `:' separator.");
|
||||
os << ref;
|
||||
} else {
|
||||
os << suffix;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We don't want to output p_["name"], since that is only used
|
||||
@ -303,13 +316,29 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType)
|
||||
buffer().addReference(ref, this, it);
|
||||
|
||||
docstring label;
|
||||
string const & cmd = getCmdName();
|
||||
for (int i = 0; !types[i].latex_name.empty(); ++i) {
|
||||
if (getCmdName() == types[i].latex_name) {
|
||||
if (cmd == types[i].latex_name) {
|
||||
label = _(types[i].short_gui_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
label += ref;
|
||||
|
||||
if (cmd != "labelonly")
|
||||
label += ref;
|
||||
else {
|
||||
if (getParam("noprefix") != "true")
|
||||
label += ref;
|
||||
else {
|
||||
docstring prefix;
|
||||
docstring suffix = split(ref, prefix, ':');
|
||||
if (suffix.empty()) {
|
||||
label += ref;
|
||||
} else {
|
||||
label += suffix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!buffer().params().isLatex() && !getParam("name").empty()) {
|
||||
label += "||";
|
||||
|
@ -840,7 +840,7 @@ MathClass MathMacro::mathClass() const
|
||||
if (MacroData const * m = macroBackup()) {
|
||||
// If it is a global macro and is defined explicitly
|
||||
if (m->symbol()) {
|
||||
MathClass mc = string_to_class(d->macroBackup_.symbol()->extra);
|
||||
MathClass mc = string_to_class(m->symbol()->extra);
|
||||
if (mc != MC_UNKNOWN)
|
||||
return mc;
|
||||
}
|
||||
|
@ -3498,6 +3498,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
<< "\"\n";
|
||||
os << "plural \"false\"\n";
|
||||
os << "caps \"false\"\n";
|
||||
os << "noprefix \"false\"\n";
|
||||
end_inset(os);
|
||||
preamble.registerAutomaticallyLoadedPackage("refstyle");
|
||||
}
|
||||
@ -3516,6 +3517,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
<< "\"\n";
|
||||
os << "plural \"false\"\n";
|
||||
os << "caps \"false\"\n";
|
||||
os << "noprefix \"false\"\n";
|
||||
end_inset(os);
|
||||
if (t.cs() == "vref" || t.cs() == "vpageref")
|
||||
preamble.registerAutomaticallyLoadedPackage("varioref");
|
||||
|
@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
|
||||
|
||||
// Do not remove the comment below, so we get merge conflict in
|
||||
// independent branches. Instead add your own.
|
||||
#define LYX_FORMAT_LYX 526 // rgh: labelonly for references
|
||||
#define LYX_FORMAT_TEX2LYX 526
|
||||
#define LYX_FORMAT_LYX 527 // rgh: labelonly for references
|
||||
#define LYX_FORMAT_TEX2LYX 527
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user