mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
stdlayouts.inc: support for verbatim*
fileformat change
This commit is contained in:
parent
c178c8ab32
commit
bfc749eb23
@ -11,6 +11,11 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
|
||||
|
||||
-----------------------
|
||||
|
||||
2015-11-24 Uwe Stöhr <uwestoehr@web.de>
|
||||
* Format incremented to 503
|
||||
No new parameters.
|
||||
Add environment "verbatim*" to stdlayouts.inc.
|
||||
|
||||
2015-11-18 Uwe Stöhr <uwestoehr@web.de>
|
||||
* Format incremented to 502
|
||||
No new parameters.
|
||||
|
@ -95,3 +95,8 @@ Style Verbatim
|
||||
HTMLItem p
|
||||
End
|
||||
|
||||
|
||||
Style Verbatim*
|
||||
CopyStyle Verbatim
|
||||
LatexName verbatim*
|
||||
End
|
||||
|
@ -85,7 +85,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
|
||||
("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
|
||||
("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
|
||||
("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
|
||||
("2_2", list(range(475,503)), minor_versions("2.2" , 0))
|
||||
("2_2", list(range(475,504)), minor_versions("2.2" , 0))
|
||||
]
|
||||
|
||||
####################################################################
|
||||
|
@ -814,8 +814,8 @@ def revert_cancel(document):
|
||||
revert_use_package(document, "cancel", cancel_commands, False)
|
||||
|
||||
|
||||
def revert_verbatim(document):
|
||||
" Revert verbatim einvironments completely to TeX-code. "
|
||||
def revert_verbatim(document, starred):
|
||||
" Revert verbatim environments completely to TeX-code. "
|
||||
i = 0
|
||||
consecutive = False
|
||||
subst_end = ['\end_layout', '', '\\begin_layout Plain Layout',
|
||||
@ -830,14 +830,32 @@ def revert_verbatim(document):
|
||||
'\\begin_layout Plain Layout', '', '', '\\backslash',
|
||||
'begin{verbatim}',
|
||||
'\\end_layout', '', '\\begin_layout Plain Layout', '']
|
||||
if starred:
|
||||
subst_end = ['\end_layout', '', '\\begin_layout Plain Layout',
|
||||
'\end_layout', '',
|
||||
'\\begin_layout Plain Layout', '', '',
|
||||
'\\backslash', '',
|
||||
'end{verbatim*}',
|
||||
'\\end_layout', '', '\\end_inset',
|
||||
'', '', '\\end_layout']
|
||||
subst_begin = ['\\begin_layout Standard', '\\noindent',
|
||||
'\\begin_inset ERT', 'status open', '',
|
||||
'\\begin_layout Plain Layout', '', '', '\\backslash',
|
||||
'begin{verbatim*}',
|
||||
'\\end_layout', '', '\\begin_layout Plain Layout', '']
|
||||
|
||||
layout_name = "Verbatim"
|
||||
if starred:
|
||||
layout_name = "Verbatim*"
|
||||
|
||||
while 1:
|
||||
i = find_token(document.body, "\\begin_layout Verbatim", i)
|
||||
i = find_token(document.body, "\\begin_layout %s" % (layout_name), i)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_end_of_layout(document.body, i)
|
||||
if j == -1:
|
||||
document.warning("Malformed LyX document: Can't find end of Verbatim layout")
|
||||
document.warning("Malformed LyX document: Can't find end of %s layout" \
|
||||
% (layout_name))
|
||||
i += 1
|
||||
continue
|
||||
# delete all line breaks insets (there are no other insets)
|
||||
|
@ -31,7 +31,7 @@ import sys, os
|
||||
# del_token, check_token, get_option_value
|
||||
|
||||
from lyx2lyx_tools import add_to_preamble, put_cmd_in_ert, lyx2latex, \
|
||||
length_in_bp#, \
|
||||
length_in_bp
|
||||
# insert_to_preamble, latex_length, revert_flex_inset, \
|
||||
# revert_font_attrs, hex2ratio, str2bool
|
||||
|
||||
@ -2156,6 +2156,11 @@ def revert_solution(document):
|
||||
i = j
|
||||
|
||||
|
||||
def revert_verbatim_star(document):
|
||||
from lyx_2_1 import revert_verbatim
|
||||
revert_verbatim(document, True)
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -2192,10 +2197,12 @@ convert = [
|
||||
[499, [convert_moderncv]],
|
||||
[500, []],
|
||||
[501, [convert_fontsettings]],
|
||||
[502, []]
|
||||
[502, []],
|
||||
[503, []]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[502, [revert_verbatim_star]],
|
||||
[501, [revert_solution]],
|
||||
[500, [revert_fontsettings]],
|
||||
[499, [revert_achemso]],
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.2
|
||||
\lyxformat 502
|
||||
\lyxformat 503
|
||||
\begin_document
|
||||
\begin_header
|
||||
\origin roundtrip
|
||||
|
@ -1555,15 +1555,25 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
preamble.registerAutomaticallyLoadedPackage("verbatim");
|
||||
}
|
||||
|
||||
else if (name == "verbatim") {
|
||||
else if (unstarred_name == "verbatim" || name == "verbatim*") {
|
||||
// FIXME: this should go in the generic code that
|
||||
// handles environments defined in layout file that
|
||||
// have "PassThru 1". However, the code over there is
|
||||
// already too complicated for my taste.
|
||||
string ascii_name;
|
||||
string env_name;
|
||||
if (unstarred_name == "verbatim") {
|
||||
ascii_name = "Verbatim";
|
||||
env_name = "verbatim";
|
||||
}
|
||||
if (name == "verbatim*") {
|
||||
ascii_name = "Verbatim*";
|
||||
env_name = name;
|
||||
}
|
||||
parent_context.new_paragraph(os);
|
||||
Context context(true, parent_context.textclass,
|
||||
&parent_context.textclass[from_ascii("Verbatim")]);
|
||||
string s = p.verbatimEnvironment("verbatim");
|
||||
&parent_context.textclass[from_ascii(ascii_name)]);
|
||||
string s = p.verbatimEnvironment(env_name);
|
||||
output_ert(os, s, context);
|
||||
p.skip_spaces();
|
||||
}
|
||||
|
@ -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 502 // uwestoehr: new environment "solution" in theorems
|
||||
#define LYX_FORMAT_TEX2LYX 502
|
||||
#define LYX_FORMAT_LYX 503 // uwestoehr: support for verbatim* environment
|
||||
#define LYX_FORMAT_TEX2LYX 503
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user