commit 64ac1e59ede39450d04f2df1c5f7236dc30cb8ca
Author: Juergen Spitzmueller <[email protected]>
Date:   Mon Oct 19 09:46:56 2026 +0200

    Add support for the semiverbatim beamer environment
    
    This is basically the same than our Code (alltt) but some users might
    prefer this integrated version.
---
 lib/layouts/beamer.layout | 29 +++++++++++++++++++++++++++++
 lib/lyx2lyx/lyx_2_6.py    | 25 ++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index 22a0b49d7e..4ff6998b93 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -1468,6 +1468,35 @@ Style Code
 # FIXME: check this!
   DocBookAttr           language='lyx'
 End
+
+
+# This is basically the same as alltt
+# but defined by beamer itself
+Style SemiVerbatim
+  Category              MainText
+  Margin                Static
+  LatexType             Environment
+  LatexName             semiverbatim
+  NextNoIndent          1
+  TopSep                0.7
+  BottomSep             0.7
+  Align                 Left
+  AlignPossible         Block, Left, Right, Center
+  LabelType             No_Label
+  FreeSpacing           1
+  KeepEmpty             1
+  Newline               0
+  ParbreakIsNewline     1
+  PassThruChars         " ~$^_"
+  Font
+    Family              Typewriter
+  EndFont
+  DocBookTag            programlisting
+  DocBookTagType        paragraph
+# FIXME: check this!
+  DocBookAttr           language='lyx'
+End
+
  
 Style NoteItem
   Category         MainText
diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index 6310ff4159..80c980e94d 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -2062,6 +2062,28 @@ def revert_alltt(document):
         document.body[i] = "\\begin_layout LyX-Code"
 
 
+def revert_semiverbatim(document):
+    """Revert SemiVerbatim layout to LyX-Code"""
+
+    beamer = document.textclass in [
+        "beamer",
+        "scrarticle-beamer",
+        "beamerposter",
+        "article-beamer",
+    ]
+    if not beamer:
+        return
+
+    i = 0
+    while True:
+        i = find_token_exact(document.body, "\\begin_layout SemiVerbatim", i)
+        if i == -1:
+            return
+
+        # This is not ideal, but the closest we can get
+        document.body[i] = "\\begin_layout LyX-Code"
+
+
 def convert_uplatex(document):
     """Convert platex documents to uplatex ones"""
     # standard japanese text styles
@@ -2074,6 +2096,7 @@ def convert_uplatex(document):
     elif document.textclass in jsclasses:
         insert_document_option(document, "uplatex")
 
+
 def revert_uplatex(document):
     """Revert uplatex documents to platex ones"""
     standard_classes = [
@@ -2114,7 +2137,7 @@ convert = [
 
 revert = [
     [660, [revert_uplatex]],
-    [659, [revert_alltt, revert_lyxcode]],
+    [659, [revert_alltt, revert_semiverbatim, revert_lyxcode]],
     [658, [revert_mathjax]],
     [657, [revert_use_alignedoverset]],
     [656, [revert_matters]],
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to