]> git.lyx.org Git - features.git/commitdiff
tex2lyx: import straight quotation marks as ERT
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 4 Mar 2018 11:08:08 +0000 (12:08 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 6 Mar 2018 07:17:18 +0000 (08:17 +0100)
This assures that they are output as straight quotations marks (e.g.,
babel shorthands).

Fixes: #75 [sic!]
(cherry picked from commit ccb9ae96709ea32cf983d6e5fb5d655b28a817e1)

src/tex2lyx/text.cpp
status.23x

index 56931ddc5594c9502cc995f0e4e0449f2954e7b0..36316edc72ce98f37386168c3d5d49d636f99ccd 100644 (file)
@@ -2626,6 +2626,32 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                else if (t.cat() == catSpace || (t.cat() == catNewline && ! p.isParagraph()))
                        check_space(p, os, context);
 
+               // babel shorthands (also used by polyglossia)
+               // Since these can have different meanings for different languages
+               // we import them as ERT (but they must be put in ERT to get output
+               // verbatim).
+               else if (t.asInput() == "\"") {
+                       string s = "\"";
+                       // These are known pairs. We put them together in
+                       // one ERT inset. In other cases (such as "a), only
+                       // the quotation mark is ERTed.
+                       if (p.next_token().asInput() == "\""
+                           || p.next_token().asInput() == "|"
+                           || p.next_token().asInput() == "-"
+                           || p.next_token().asInput() == "~"
+                           || p.next_token().asInput() == "="
+                           || p.next_token().asInput() == "/"
+                           || p.next_token().asInput() == "~"
+                           || p.next_token().asInput() == "'"
+                           || p.next_token().asInput() == "`"
+                           || p.next_token().asInput() == "<"
+                           || p.next_token().asInput() == ">") {
+                               s += p.next_token().asInput();
+                               p.get_token();
+                       }
+                       output_ert_inset(os, s, context);
+               }
+
                else if (t.character() == '[' && noweb_mode &&
                         p.next_token().character() == '[') {
                        // These can contain underscores
index e7e9ce5e9f4ad12ef899678637e18680e6eead0c..cff2cb475514db2c21e137bb575ff44a16ead13b 100644 (file)
@@ -97,6 +97,7 @@ What's new
 
 * TEX2LYX
 
+- Import straight quotations marks (e.g. babel shorthands) as ERT (bug 75).
 
 
 * ADVANCED FIND AND REPLACE