]> git.lyx.org Git - features.git/commitdiff
Add soul module
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 22 Mar 2019 17:29:50 +0000 (18:29 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:19 +0000 (15:48 +0200)
development/FORMAT
lib/Makefile.am
lib/layouts/soul.module [new file with mode: 0644]
lib/lyx2lyx/lyx_2_4.py
src/tex2lyx/TODO.txt
src/version.h

index a568b44bc56fc445dea7883cc1ea1a4133752378..2bbab73ed93c324230e8ee608ef3d6a016b9b557 100644 (file)
@@ -7,8 +7,12 @@ changes happened in particular if possible. A good example would be
 
 -----------------------
 
+2019-03-22  Jürgen Spitzmüller <spitz@lyx.org>
+       * format incremented to 568: Support for the soul module:
+         \so, \hl, \st, \ul, \caps
+
 2019-02-21 Joice Joseph <josukutty@outlook.com>
-    * Format incremented to 567: Support for Malayalam:
+       * Format incremented to 567: Support for Malayalam:
         \lang malayalam
 
 2018-10-29  Guy Rutenberg <guyrutenberg@gmail.com>
index 94aa898d2c60304572befb264bddc3cec2dc1171..5dd2d902bf3669c5c0cfc4e5bb9c55c11f0d2ec9 100644 (file)
@@ -2409,6 +2409,7 @@ dist_layouts_DATA =\
        layouts/singlecol.layout \
        layouts/singlecol-new.layout \
        layouts/slides.layout \
+       layouts/soul.module \
        layouts/spie.layout \
        layouts/stdciteformats.inc \
        layouts/stdclass.inc \
diff --git a/lib/layouts/soul.module b/lib/layouts/soul.module
new file mode 100644 (file)
index 0000000..252dd5e
--- /dev/null
@@ -0,0 +1,88 @@
+#\DeclareLyXModule[soul.sty]{Soul Text Markup}
+#DescriptionBegin
+#Defines text styles to highlight, space-out, strike-through
+#underline and capitalize text by means of the soul package.
+#DescriptionEnd
+#Requires      
+#Excludes
+
+#Author: Stephen [original implementation],
+#        Juergen Spitzmueller <spitz@lyx.org> [fixes]
+
+Format 71
+
+InsetLayout Flex:Spaceletters
+       LyxType         charstyle
+       LabelString     spaced
+       Decoration      conglomerate
+       LatexType       command
+       LatexName       so
+       LabelFont
+           Size        Small
+       EndFont
+       NeedMBoxProtect true
+       MultiPar        true
+       Requires        soul
+End
+
+InsetLayout Flex:Strikethrough
+       CopyStyle       Flex:Spaceletters
+       LabelString     strike
+       LatexName       st
+       Font
+           Misc        strikeout
+       EndFont
+End
+
+InsetLayout Flex:Underline
+       CopyStyle       Flex:Spaceletters
+       LabelString     ul
+       LatexName       ul
+       Font
+           Misc        underbar
+       EndFont
+End
+
+InsetLayout Flex:Highlight
+       CopyStyle       Flex:Spaceletters
+       LabelString     hl
+       LatexName       hl
+       BgColor         yellow
+       Requires        soul,color
+End
+
+InsetLayout Flex:Capitalize
+       CopyStyle       Flex:Spaceletters
+       LabelString     caps
+       LatexName       caps
+       Font
+           Shape       smallcaps
+       EndFont
+End
+
+
+# Obsolete older forms used on wiki.lyx.org
+
+InsetLayout Flex:spaceletters
+       ObsoletedBy     Flex:Spaceletters
+End
+
+InsetLayout Flex:strikethrough
+       ObsoletedBy     Flex:Strikethrough
+End
+
+InsetLayout Flex:underline
+       ObsoletedBy     Flex:Underline
+End
+
+InsetLayout Flex:highlight
+       ObsoletedBy     Flex:Highlight
+End
+
+InsetLayout Flex:capitalise
+       ObsoletedBy     Flex:Capitalize
+End
+
+InsetLayout Flex:Capitalise
+       ObsoletedBy     Flex:Capitalize
+End
index cf68d70a3470f8e0d645a8f37baa2465e2ec3d9f..6b3858e6a8a72a3591198beba57795353b3b1384 100644 (file)
@@ -36,7 +36,7 @@ from parser_tools import (count_pars_in_inset, find_end_of_inset, find_end_of_la
 #    is_in_inset, set_bool_value
 #    find_tokens, find_token_exact, check_token
 
-from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble, revert_language)
+from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble, revert_language, revert_flex_inset)
 #  revert_font_attrs, insert_to_preamble, latex_length
 #  get_ert, lyx2latex, lyx2verbatim, length_in_bp, convert_info_insets
 #  revert_flex_inset, hex2ratio, str2bool
@@ -1413,6 +1413,28 @@ def revert_malayalam(document):
     revert_language(document, "malayalam", "", "malayalam")
 
 
+def revert_soul(document):
+    " Revert soul module flex insets to ERT "
+
+    flexes = ["Spaceletters", "Strikethrough", "Underline", "Highlight", "Capitalize"]
+
+    for flex in flexes:
+        i = find_token(document.body, "\\begin_inset Flex %s" % flex, 0)
+        if i != -1:
+            add_to_preamble(document, ["\\usepackage{soul}"])
+            break
+    i = find_token(document.body, "\\begin_inset Flex Highlight", 0)
+    if i != -1:
+        add_to_preamble(document, ["\\usepackage{color}"])
+    
+    revert_flex_inset(document.body, "Spaceletters", "\\so")
+    revert_flex_inset(document.body, "Strikethrough", "\\st")
+    revert_flex_inset(document.body, "Underline", "\\ul")
+    revert_flex_inset(document.body, "Highlight", "\\hl")
+    revert_flex_inset(document.body, "Capitalize", "\\caps")
+
+
+
 ##
 # Conversion hub
 #
@@ -1442,9 +1464,11 @@ convert = [
            [565, [convert_AdobeFonts]], # Handle adobe fonts in GUI
            [566, [convert_hebrew_parentheses]],
            [567, []],
+           [568, []]
           ]
 
 revert =  [
+           [567, [revert_soul]],
            [566, [revert_malayalam]],
            [565, [revert_hebrew_parentheses]],
            [564, [revert_AdobeFonts]],
index 365e7915dbac314000015a6ab2d2bf3eaa6ecbf8..d813c064fea8f7e167b88a57e3c7eecdfc1797b0 100644 (file)
@@ -34,7 +34,13 @@ Format LaTeX feature                        LyX feature
 443    unicode-math.sty                     InsetMath*
 453    automatic stmaryrd loading           \use_package stmaryrd
 457    automatic stackrel loading           \use_package stackrel
-563    InsetArgument listpreamble:1         All content between \begin{env} and first \item of a list 
+563    InsetArgument listpreamble:1         All content between \begin{env} and first \item of a list
+568    Soul package                         soul.module
+       \caps{...}                           \begin_inset Flex Capitalize
+       \hl{...}                             \begin_inset Flex Highlight
+       \so{...}                             \begin_inset Flex Spaceletters
+       \st{...}                             \begin_inset Flex Strikethrough
+       \ul{...}                             \begin_inset Flex Underline
 
 
 
index 885b13fa403630f1edde0d5bbda7382b8615a541..cc24a614d82761e67d687a58232af2c37f6b3585 100644 (file)
@@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 567 // Joice : Added support for malayalam.
-#define LYX_FORMAT_TEX2LYX 567
+#define LYX_FORMAT_LYX 568 // spitz :soul.module
+#define LYX_FORMAT_TEX2LYX 568
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER