Add soul module

This commit is contained in:
Juergen Spitzmueller 2019-03-22 18:29:50 +01:00
parent d52e04a9b3
commit aff2ee6058
6 changed files with 128 additions and 5 deletions

View 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>

View 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 \

88
lib/layouts/soul.module Normal file
View File

@ -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

View 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]],

View 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

View 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