The docs refer to the outdated layout formats. The inset prevents this.
-----------------------
+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.
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
#
[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
case LYX_INFO:
result.push_back(make_pair("version", _("LyX version")));
+ result.push_back(make_pair("layoutformat", _("LyX layout format")));
break;
case FIXDATE_INFO:
return false;
case LYX_INFO:
- return name == "version";
+ return name == "version" || name == "layoutformat";
case FIXDATE_INFO: {
string date;
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");
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:
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.
// 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