jss.layout: changes as requested by the user in bug#9516

- added appendix style and lyx2lyx reversion
- add support for parsing \noindent
- update example file
This commit is contained in:
Uwe Stöhr 2015-05-26 01:15:29 +02:00
parent 806cfc5a8b
commit 30f2accf77
4 changed files with 52 additions and 5 deletions

View File

@ -48,7 +48,8 @@ Style Abstract
InTitle 1
InPreamble 1
Margin Dynamic
LeftMargin MMNMM
LeftMargin MM
NextNoIndent 1
ParSkip 0.4
BottomSep 1.5
TopSep 1.5
@ -67,7 +68,7 @@ End
Style Address
CopyStyle Abstract
LatexName Address
Labeltype Above
LabelType Above
LabelString "Affiliation:"
Margin Static
LeftMargin M
@ -152,6 +153,7 @@ End
InsetLayout "Flex:code"
CopyStyle "Flex:proglang"
Spellcheck 0
LabelString code
LatexName code
HTMLTag code
@ -168,6 +170,7 @@ Style "Code Chunk"
Category MainText
LatexType Environment
LatexName CodeChunk
Spellcheck 0
NextNoIndent 1
ParbreakIsNewline 1
FreeSpacing 1
@ -210,3 +213,22 @@ Style "Code Output"
LatexName CodeOutput
LabelString "Code Output"
End
Style Appendix
LatexType Environment
LatexName appendix
Category BackMatter
TopSep 0.6
BottomSep 0.6
Margin First_Dynamic
Align Block
NextNoIndent 1
LabelType Above
LabelString "Appendix"
LabelSep M
LabelFont
Series Bold
Shape Up
Size large
EndFont
End

View File

@ -206,6 +206,8 @@ def lyx2latex(document, lines):
line = "'"
elif line.startswith("\\begin_inset Newline newline"):
line = "\\\\ "
elif line.startswith("\\noindent"):
line = "\\noindent " # we need the space behind the command
elif line.startswith("\\begin_inset space"):
line = line[18:].strip()
if line.startswith("\\hspace"):

View File

@ -1375,7 +1375,8 @@ def revert_jss(document):
m = 0
j = 0
k = 0
while m != -1 or j != -1 or h != -1 or k != -1:
l = 0
while m != -1 or j != -1 or h != -1 or k != -1 or l != -1:
# \CodeChunk
if h != -1:
h = find_token(document.body, "\\begin_layout Code Chunk", h)
@ -1416,12 +1417,23 @@ def revert_jss(document):
k = find_token(document.body, "\\begin_layout Code Output", k)
if k != -1:
endk = find_end_of_layout(document.body, k)
document.body[endk : endj + 1] = ["\\end_layout", "", "\\begin_layout Standard"]
document.body[endk : endk + 1] = ["\\end_layout", "", "\\begin_layout Standard"]
document.body[endk + 3 : endk + 4] = put_cmd_in_ert("\\end{CodeOutput}")
document.body[endk + 13 : endk + 13] = ["\\end_layout", "", "\\begin_layout Standard"]
document.body[k + 1 : k] = ["\\end_layout", "", "\\begin_layout Standard"]
document.body[k : k + 1] = put_cmd_in_ert("\\begin{CodeOutput}")
k = k + 1
if l != -1:
l = find_token(document.body, "\\begin_layout Appendix", l)
if l != -1:
endl = find_end_of_layout(document.body, l)
document.body[endl : endl + 1] = ["\\end_layout", "", "\\begin_layout Standard"]
document.body[endl + 3 : endl + 4] = put_cmd_in_ert("\\end{appendix}")
document.body[endl + 13 : endl + 13] = ["\\end_layout", ""]
document.body[l + 1 : l] = ["\\end_layout", "", "\\begin_layout Standard"]
document.body[l : l + 1] = put_cmd_in_ert("\\begin{appendix}")
document.body[l -1 : l] = ["", "\\begin_layout Standard"]
l = l + 1
def convert_subref(document):

View File

@ -1,5 +1,5 @@
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 493
\lyxformat 495
\begin_document
\begin_header
\origin unavailable
@ -303,7 +303,14 @@ only if necessary
\end_layout
\begin_layout Abstract
\noindent
The abstract of the article.
The abstract of the article.The abstract of the article.The abstract of the
article.The abstract of the article.The abstract of the article.The abstract
of the article.The abstract of the article.The abstract of the article.The
abstract of the article.The abstract of the article.The abstract of the article.Th
e abstract of the article.The abstract of the article.The abstract of the
article.The abstract of the article.The abstract of the article.
\end_layout
\begin_layout Keywords
@ -645,5 +652,9 @@ Acknowledgments
Here you can write some acknowledgments.
\end_layout
\begin_layout Appendix
This is the appendix section
\end_layout
\end_body
\end_document