[LyX/master] Support cyrillic dash babelshorthands

Juergen Spitzmueller spitz at lyx.org
Fri Feb 20 13:39:10 UTC 2026


commit 616fbfee1549eed9a8bc2edb80eef9f7134e4fd9
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Feb 20 14:38:31 2026 +0100

    Support cyrillic dash babelshorthands
    
    Now we have complete support for all shorthands supported
    both by babel and polyglossia
---
 lib/languages          | 195 +++++++++++++++++++++++++++++++++++++++++++++++++
 lib/lyx2lyx/lyx_2_6.py |  36 ++++++++-
 2 files changed, 230 insertions(+), 1 deletion(-)

diff --git a/lib/languages b/lib/languages
index 0be511c73e..3567063e3f 100644
--- a/lib/languages
+++ b/lib/languages
@@ -655,6 +655,45 @@ Language belarusian
 	      Color		textlabel2
 	    EndFont
 	End
+	SpecialChar cyrillicdash_normal
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Normal)|C"
+	    Tooltip     "Cyrillic dash for the use in normal text"
+	    LyXOutput	"0x2009 0x2014 0x2009"
+	    LatexOutput	" \"---"
+	    IsLetter	1
+	    PlaintextOutput "0x2009 0x2014 0x2009"
+	    XHTMLOutput	&#x2009;&#x2014;&#x2009;
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
+	SpecialChar cyrillicdash_compound
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Compound Name)|o"
+	    Tooltip     "Cyrillic dash for the use in compound names (surnames)"
+	    LyXOutput	0x2014
+	    LatexOutput	\"--~
+	    IsLetter	1
+	    PlaintextOutput 0x2014
+	    XHTMLOutput	&#x2014;
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
+	SpecialChar cyrillicdash_quotative
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Quotative)|u"
+	    Tooltip     "Cyrillic dash for denoting direct speech"
+	    LyXOutput	"0x2014 0x2002"
+	    LatexOutput	\"--*
+	    IsLetter	1
+	    PlaintextOutput "0x2014 0x2002"
+	    XHTMLOutput	&#x2014;&#x2002;
+	    Font
+	      Color		textlabel3
+	    EndFont
+	End
 End
 
 # supported by polyglossia but not babel:
@@ -1172,6 +1211,45 @@ Language georgian
 	      Color		textlabel2
 	    EndFont
 	End
+	SpecialChar cyrillicdash_normal
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Normal)|C"
+	    Tooltip     "Cyrillic dash for the use in normal text"
+	    LyXOutput	"0x2009 0x2014 0x2009"
+	    LatexOutput	" \"---"
+	    IsLetter	1
+	    PlaintextOutput "0x2009 0x2014 0x2009"
+	    XHTMLOutput	&#x2009;&#x2014;&#x2009;
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
+	SpecialChar cyrillicdash_compound
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Compound Name)|o"
+	    Tooltip     "Cyrillic dash for the use in compound names (surnames)"
+	    LyXOutput	0x2014
+	    LatexOutput	\"--~
+	    IsLetter	1
+	    PlaintextOutput 0x2014
+	    XHTMLOutput	&#x2014;
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
+	SpecialChar cyrillicdash_quotative
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Quotative)|u"
+	    Tooltip     "Cyrillic dash for denoting direct speech"
+	    LyXOutput	"0x2014 0x2002"
+	    LatexOutput	\"--*
+	    IsLetter	1
+	    PlaintextOutput "0x2014 0x2002"
+	    XHTMLOutput	&#x2014;&#x2002;
+	    Font
+	      Color		textlabel3
+	    EndFont
+	End
 End
 
 # german does not use a country code (due to the variety)
@@ -1968,6 +2046,45 @@ Language mongolian
 	      Color		textlabel2
 	    EndFont
 	End
+	SpecialChar cyrillicdash_normal
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Normal)|C"
+	    Tooltip     "Cyrillic dash for the use in normal text"
+	    LyXOutput	"0x2009 0x2014 0x2009"
+	    LatexOutput	" \"---"
+	    IsLetter	1
+	    PlaintextOutput "0x2009 0x2014 0x2009"
+	    XHTMLOutput	&#x2009;&#x2014;&#x2009;
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
+	SpecialChar cyrillicdash_compound
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Compound Name)|o"
+	    Tooltip     "Cyrillic dash for the use in compound names (surnames)"
+	    LyXOutput	0x2014
+	    LatexOutput	\"--~
+	    IsLetter	1
+	    PlaintextOutput 0x2014
+	    XHTMLOutput	&#x2014;
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
+	SpecialChar cyrillicdash_quotative
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Quotative)|u"
+	    Tooltip     "Cyrillic dash for denoting direct speech"
+	    LyXOutput	"0x2014 0x2002"
+	    LatexOutput	\"--*
+	    IsLetter	1
+	    PlaintextOutput "0x2014 0x2002"
+	    XHTMLOutput	&#x2014;&#x2002;
+	    Font
+	      Color		textlabel3
+	    EndFont
+	End
 End
 
 Language newzealand
@@ -2284,6 +2401,45 @@ Language russian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar cyrillicdash_normal
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Normal)|C"
+	    Tooltip     "Cyrillic dash for the use in normal text"
+	    LyXOutput	"0x2009 0x2014 0x2009"
+	    LatexOutput	" \"---"
+	    IsLetter	1
+	    PlaintextOutput "0x2009 0x2014 0x2009"
+	    XHTMLOutput	&#x2009;&#x2014;&#x2009;
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
+	SpecialChar cyrillicdash_compound
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Compound Name)|o"
+	    Tooltip     "Cyrillic dash for the use in compound names (surnames)"
+	    LyXOutput	0x2014
+	    LatexOutput	\"--~
+	    IsLetter	1
+	    PlaintextOutput 0x2014
+	    XHTMLOutput	&#x2014;
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
+	SpecialChar cyrillicdash_quotative
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Quotative)|u"
+	    Tooltip     "Cyrillic dash for denoting direct speech"
+	    LyXOutput	"0x2014 0x2002"
+	    LatexOutput	\"--*
+	    IsLetter	1
+	    PlaintextOutput "0x2014 0x2002"
+	    XHTMLOutput	&#x2014;&#x2002;
+	    Font
+	      Color		textlabel3
+	    EndFont
+	End
 End
 
 # FontEncoding: no hyphenation, but diacritics
@@ -2660,6 +2816,45 @@ Language ukrainian
 	    LaTeXOutput  \"|
 	    LaTeXOutputUTF8 \"|
 	End
+	SpecialChar cyrillicdash_normal
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Normal)|C"
+	    Tooltip     "Cyrillic dash for the use in normal text"
+	    LyXOutput	"0x2009 0x2014 0x2009"
+	    LatexOutput	" \"---"
+	    IsLetter	1
+	    PlaintextOutput "0x2009 0x2014 0x2009"
+	    XHTMLOutput	&#x2009;&#x2014;&#x2009;
+	    Font
+	      Color		textlabel1
+	    EndFont
+	End
+	SpecialChar cyrillicdash_compound
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Compound Name)|o"
+	    Tooltip     "Cyrillic dash for the use in compound names (surnames)"
+	    LyXOutput	0x2014
+	    LatexOutput	\"--~
+	    IsLetter	1
+	    PlaintextOutput 0x2014
+	    XHTMLOutput	&#x2014;
+	    Font
+	      Color		textlabel2
+	    EndFont
+	End
+	SpecialChar cyrillicdash_quotative
+	    Type	specialchar
+	    MenuString	"Cyrillic Dash (Quotative)|u"
+	    Tooltip     "Cyrillic dash for denoting direct speech"
+	    LyXOutput	"0x2014 0x2002"
+	    LatexOutput	\"--*
+	    IsLetter	1
+	    PlaintextOutput "0x2014 0x2002"
+	    XHTMLOutput	&#x2014;&#x2002;
+	    Font
+	      Color		textlabel3
+	    EndFont
+	End
 End
 
 Language uppersorbian
diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index 8f060f6230..99785454fc 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -745,13 +745,21 @@ def revert_hyphen_shorthands(document):
 
 
 def revert_shorthands2(document):
-    "Revert SpecialChar gendermark, thinspacebreakpoint and splithyphen to ERT"
+    "Revert SpecialChar cyrillicdash*, gendermark, thinspacebreakpoint and splithyphen to ERT"
 
     mainlang = get_value(document.header, "\\language")
     if mainlang == "":
         document.warning("Malformed LyX document! No \\language header found!")
         return
 
+    langs_cyrillicdash = [
+        "belarusian",
+        "georgian",
+        "mongolian",
+        "russian",
+        "ukrainian"
+    ]
+
     langs_gendermark = [
         "austrian",
         "naustrian",
@@ -827,6 +835,32 @@ def revert_shorthands2(document):
         i += 1
         continue
 
+    i = 0
+    while True:
+        i = find_substring(document.body, "\\SpecialChar cyrillicdash", i)
+        if i == -1:
+            break
+        repl = " \"---"
+        if "\\SpecialChar cyrillicdash_normal" in document.body[i]:
+            document.body[i] = document.body[i].replace("\\SpecialChar cyrillicdash_normal", "")
+        elif "\\SpecialChar cyrillicdash_compound" in document.body[i]:
+            document.body[i] = document.body[i].replace("\\SpecialChar cyrillicdash_compound", "")
+            repl = "\"--~"
+        elif "\\SpecialChar cyrillicdash_quotative" in document.body[i]:
+            document.body[i] = document.body[i].replace("\\SpecialChar cyrillicdash_quotative", "")
+            repl = "\"--*"
+        lang = mainlang
+        l = find_token_backwards(document.body, "\\lang", i) != -1
+        if l > 0:
+            line = document.body[l]
+            tokenend = len("\\lang ")
+            lang = line[tokenend:].strip()
+        if lang in langs_cyrillicdash:
+            cmd = put_cmd_in_ert(repl)
+            document.body[i + 1 : i + 1] = cmd
+        i += 1
+        continue
+
 ##
 # Conversion hub
 #


More information about the lyx-cvs mailing list