mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Implement layout format in insetinfo
The docs refer to the outdated layout formats. The inset prevents this.
This commit is contained in:
parent
4648f39a1e
commit
5e26a3a633
@ -8,6 +8,10 @@ changes happened in particular if possible. A good example would be
|
||||
-----------------------
|
||||
|
||||
|
||||
2018-09-20 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* format incremented to 564: New info-inset lyxinfo subtype layoutformat. This returns
|
||||
the current layout format.
|
||||
|
||||
2018-08-16 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* format incremented to 563: New inset argument type "listpreamble". The content will
|
||||
be inserted between environment begin and first \item of a list.
|
||||
|
@ -1330,6 +1330,34 @@ def revert_listpargs(document):
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_lformatinfo(document):
|
||||
" Revert layout format Info inset to text. "
|
||||
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, "\\begin_inset Info", i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_inset(document.body, i + 1)
|
||||
if j == -1:
|
||||
document.warning("Malformed LyX document: Could not find end of Info inset.")
|
||||
i = i + 1
|
||||
continue
|
||||
tp = find_token(document.body, 'type', i, j)
|
||||
tpv = get_quoted_value(document.body, "type", tp)
|
||||
if tpv != "lyxinfo":
|
||||
i = i + 1
|
||||
continue
|
||||
arg = find_token(document.body, 'arg', i, j)
|
||||
argv = get_quoted_value(document.body, "arg", arg)
|
||||
if argv != "layoutformat":
|
||||
i = i + 1
|
||||
continue
|
||||
# hardcoded for now
|
||||
document.body[i : j+1] = "69"
|
||||
i = i + 1
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -1354,10 +1382,12 @@ convert = [
|
||||
[560, []],
|
||||
[561, [convert_latexFonts]], # Handle dejavu, ibmplex fonts in GUI
|
||||
[562, []],
|
||||
[563, []]
|
||||
[563, []],
|
||||
[564, []]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[563, [revert_lformatinfo]],
|
||||
[562, [revert_listpargs]],
|
||||
[561, [revert_l7ninfo]],
|
||||
[560, [revert_latexFonts]], # Handle dejavu, ibmplex fonts in user preamble
|
||||
|
@ -281,6 +281,7 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
|
||||
|
||||
case LYX_INFO:
|
||||
result.push_back(make_pair("version", _("LyX version")));
|
||||
result.push_back(make_pair("layoutformat", _("LyX layout format")));
|
||||
break;
|
||||
|
||||
case FIXDATE_INFO:
|
||||
@ -384,7 +385,7 @@ bool InsetInfoParams::validateArgument(Buffer const * buf, docstring const & arg
|
||||
return false;
|
||||
|
||||
case LYX_INFO:
|
||||
return name == "version";
|
||||
return name == "version" || name == "layoutformat";
|
||||
|
||||
case FIXDATE_INFO: {
|
||||
string date;
|
||||
@ -532,7 +533,10 @@ docstring InsetInfo::toolTip(BufferView const &, int, int) const
|
||||
result = _("Version control time");
|
||||
break;
|
||||
case InsetInfoParams::LYX_INFO:
|
||||
result = _("The current LyX version");
|
||||
if (params_.name == "version")
|
||||
result = _("The current LyX version");
|
||||
else if (params_.name == "layoutformat")
|
||||
result = _("The current LyX layout format");
|
||||
break;
|
||||
case InsetInfoParams::DATE_INFO:
|
||||
result = _("The current date");
|
||||
@ -1084,6 +1088,8 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
|
||||
break;
|
||||
if (params_.name == "version")
|
||||
setText(from_ascii(lyx_version), params_.lang);
|
||||
else if (params_.name == "layoutformat")
|
||||
setText(convert<docstring>(LAYOUT_FORMAT), params_.lang);
|
||||
initialized_ = true;
|
||||
break;
|
||||
case InsetInfoParams::DATE_INFO:
|
||||
|
@ -98,8 +98,8 @@ icon: argument is the name of the LFUN such as "paste". The syntax is the same
|
||||
buffer: argument can be one of "name", "name-noext", "path", "class". This inset output the
|
||||
filename (with extension), filename (without extension), path, and textclass of this buffer.
|
||||
|
||||
lyxinfo: argument must (presently) be "version". This inset outputs information
|
||||
about the version of LyX currently in use.
|
||||
lyxinfo: argument must be "version" or "layoutformat". This outputs information
|
||||
about the version of LyX currently in use or the current LyX layout format, respectively.
|
||||
|
||||
vcs: argument can be one of "revision", "tree-revision", "author", "time", "date".
|
||||
This insets outputs revision control information, if available.
|
||||
|
@ -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 563 // spitz: listpreamble arguments
|
||||
#define LYX_FORMAT_TEX2LYX 563
|
||||
#define LYX_FORMAT_LYX 564 // spitz: layoutformat info inset
|
||||
#define LYX_FORMAT_TEX2LYX 564
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user