-----------------------
+2016-04-05 Enrico Forestieri <forenr@lyx.org>
+ * Format incremented to 508
+ New kind of Separator inset (latexpar). The old parbreak separator
+ used specifically to introduce a LaTeX paragraph break in the output
+ (and thus not as a proper separator) is turned into a latexpar kind.
+ The only difference with the parbreak kind is the representation
+ on screen. The new latexpar kind is represented by the same symbol
+ used previously for the parbreak one, while the latter is now
+ represented as a double line.
+
2016-03-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Format incremented to 507
Convert caption subtype LongTableNoNumber to Unnumbered
("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
- ("2_2", list(range(475,508)), minor_versions("2.2" , 0))
+ ("2_2", list(range(475,509)), minor_versions("2.2" , 0))
]
####################################################################
i = i + 1
+def convert_parbreak(document):
+ """
+ Convert parbreak separators not specifically used to separate
+ environments to latexpar separators.
+ """
+ parbreakinset = "\\begin_inset Separator parbreak"
+ i = 0
+ while 1:
+ i = find_token(document.body, parbreakinset, i)
+ if i == -1:
+ return
+ lay = get_containing_layout(document.body, i)
+ if lay == False:
+ document.warning("Malformed LyX document: Can't convert separator inset at line " + str(i))
+ i += 1
+ continue
+ if lay[0] == "Standard":
+ # Convert only if not alone in the paragraph
+ k1 = find_nonempty_line(document.body, lay[1] + 1, i + 1)
+ k2 = find_nonempty_line(document.body, i + 1, lay[2])
+ if (k1 < i) or (k2 > i + 1) or not check_token(document.body[i], parbreakinset):
+ document.body[i] = document.body[i].replace("parbreak", "latexpar")
+ else:
+ document.body[i] = document.body[i].replace("parbreak", "latexpar")
+ i += 1
+
+
+def revert_parbreak(document):
+ """
+ Revert latexpar separators to parbreak separators.
+ """
+ i = 0
+ while 1:
+ i = find_token(document.body, "\\begin_inset Separator latexpar", i)
+ if i == -1:
+ return
+ document.body[i] = document.body[i].replace("latexpar", "parbreak")
+ i += 1
+
+
def revert_smash(document):
" Set amsmath to on if smash commands are used "
[504, [convert_save_props]],
[505, []],
[506, [convert_info_tabular_feature]],
- [507, [convert_longtable_label]]
+ [507, [convert_longtable_label]],
+ [508, [convert_parbreak]]
]
revert = [
+ [507, [revert_parbreak]],
[506, [revert_longtable_label]],
[505, [revert_info_tabular_feature]],
[504, []],
{ LFUN_NEWLINE_INSERT, "newline-insert", Noop, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_SEPARATOR_INSERT
- * \li Action: Inserts an environment separator or paragraph break.
+ * \li Action: Inserts an environment separator or latex paragraph break.
* \li Syntax: separator-insert [<ARG>]
- * \li Params: <ARG>: <plain|parbreak> default: plain
+ * \li Params: <ARG>: <plain|parbreak|latexpar> default: plain
* \li Origin: ef, 2 May 2014
* \endvar
*/
inp.kind = InsetSeparatorParams::PLAIN;
else if (name == "parbreak")
inp.kind = InsetSeparatorParams::PARBREAK;
+ else if (name == "latexpar")
+ inp.kind = InsetSeparatorParams::LATEXPAR;
else {
lyxerr << "Wrong argument for LyX function 'separator-insert'." << endl;
break;
case InsetSeparatorParams::PARBREAK:
os << "parbreak";
break;
+ case InsetSeparatorParams::LATEXPAR:
+ os << "latexpar";
+ break;
}
}
kind = InsetSeparatorParams::PLAIN;
else if (token == "parbreak")
kind = InsetSeparatorParams::PARBREAK;
+ else if (token == "latexpar")
+ kind = InsetSeparatorParams::LATEXPAR;
else
lex.printError("Unknown kind: `$$Token'");
}
os << breakln << "%\n";
break;
case InsetSeparatorParams::PARBREAK:
+ case InsetSeparatorParams::LATEXPAR:
os << breakln << "\n";
break;
default:
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.wid = fm.width('n');
- if (params_.kind == InsetSeparatorParams::PLAIN)
+ if (params_.kind != InsetSeparatorParams::LATEXPAR)
dim.wid *= 8;
}
int xp[7];
int yp[7];
- if (params_.kind == InsetSeparatorParams::PLAIN) {
+ if (params_.kind != InsetSeparatorParams::LATEXPAR) {
yp[0] = int(y - 0.500 * asc * 0.75);
yp[1] = yp[0];
xp[1] = int(x + wid * 8);
pi.pain.lines(xp, yp, 2, ColorName());
+
+ if (params_.kind == InsetSeparatorParams::PARBREAK) {
+ yp[0] += 0.25 * asc * 0.75;
+ yp[1] = yp[0];
+ pi.pain.lines(xp, yp, 2, ColorName());
+ }
} else {
yp[0] = int(y - 0.500 * asc * 0.5);
yp[1] = int(y - 0.250 * asc * 0.5);
string InsetSeparator::contextMenuName() const
{
+ if (params_.kind == InsetSeparatorParams::LATEXPAR)
+ return string();
+
return "context-separator";
}
public:
/// The different kinds of separators we support
enum Kind {
- ///
PLAIN,
- ///
- PARBREAK
+ PARBREAK,
+ LATEXPAR
};
///
InsetSeparatorParams() : kind(PLAIN) {}
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
#LyX file created by tex2lyx 2.2
-\lyxformat 507
+\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 507 // lasgouttes: rename LongTableNoNumber to Unnumbered
-#define LYX_FORMAT_TEX2LYX 507
+#define LYX_FORMAT_LYX 508 // forenr: convert parbreak to latexpar
+#define LYX_FORMAT_TEX2LYX 508
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER