From 7178f98b0fe8cb1e2fbe7e3e9771ae0afa4734f8 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 1 Feb 2015 14:03:58 +0100 Subject: [PATCH] Fix tex2lyx parsing of consecutive hyphens tex2lyx was already behaving as if bug #3647 was fixed, but currently -- and --- have the same special meaning in LyX as in LaTeX. --- src/tex2lyx/test/test-insets.lyx.lyx | 64 ++++++++++++++++++++++++++++ src/tex2lyx/test/test-insets.tex | 4 ++ src/tex2lyx/text.cpp | 6 +-- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/src/tex2lyx/test/test-insets.lyx.lyx b/src/tex2lyx/test/test-insets.lyx.lyx index fb0d556646..cfdb976a5c 100644 --- a/src/tex2lyx/test/test-insets.lyx.lyx +++ b/src/tex2lyx/test/test-insets.lyx.lyx @@ -6768,6 +6768,70 @@ and a spif\SpecialChar \textcompwordmark{} fy ligature break. \end_layout +\begin_layout Standard +There are dashes: endash in short form -- and long form –, emdash is alike: --- and —. If we really want several hyphens in a row, we need to separate them: - +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +-, - +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +- +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +-, - +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +- +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +- +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout +{} +\end_layout + +\end_inset + +- etc. +\end_layout + \begin_layout Standard \begin_inset ERT diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 162ebd843a..028b970510 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -656,6 +656,10 @@ And what about special characters like hyphe\-nation mark, ellipsis\ldots, and end-of-sentence\@. LyX also supports a menu separator\lyxarrow{}and a spif\textcompwordmark{}fy ligature break. +There are dashes: endash in short form -- and long form \textendash, +emdash is alike: --- and \textemdash. If we really want several hyphens +in a row, we need to separate them: -{}-, -{}-{}-, -{}-{}-{}- etc. + LyX translates the phrases LyX, TeX, LaTeX2e and LaTeX to the commands \LyX{}, \TeX{}, \LaTeXe{} and \LaTeX{}. If these phrases occur as part of other words (like 1LyX or aTeX or LaTeX3) diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 9d75d7de58..f2fe12def5 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -2420,10 +2420,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, // {} Token const prev = p.prev_token(); p.get_token(); - if (p.next_token().character() == '`' || - (prev.character() == '-' && - p.next_token().character() == '-')) - ; // ignore it in {}`` or -{}- + if (p.next_token().character() == '`') + ; // ignore it in {}`` else output_ert_inset(os, "{}", context); } else if (next.cat() == catEscape &&