mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
- text.cpp: full tex2lyx support for lstlisting (support for \lstinline will follow soon)
- test/test-insets.tex: add a more advanced examples git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40856 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d43406f035
commit
80d0710422
@ -108,7 +108,7 @@ From bug 7306:
|
||||
\citet{gur+04} have demonstrated that authors should not have umlauts
|
||||
in their names. It's OK to use them in the man\"{u}script, though.
|
||||
\begin{thebibliography}{References}
|
||||
\bibitem[{{G\"{u}rkan et~al.}(2004)}]{gur+04} Gürkan, M.~A., Freitag,
|
||||
\bibitem[{{G\"{u}rkan et~al.}(2004)}]{gur+04} Gürkan, M.~A., Freitag,
|
||||
M., \& Rasio, F.~A. 2004, ApJ, 604, 632\end{thebibliography}
|
||||
|
||||
|
||||
@ -168,7 +168,6 @@ def func(param):
|
||||
pass
|
||||
\end{lstlisting}
|
||||
|
||||
|
||||
Here is an example listing with left line numbering, step ``3'',
|
||||
language ``Python'', options ``Extended character table'' and
|
||||
``Space~as~symbol'', range lines 3\,-\,8:
|
||||
@ -178,7 +177,7 @@ def func(param):
|
||||
'this is a python function'
|
||||
pass
|
||||
def func(param):
|
||||
'This is a German word: Tschüß'
|
||||
'This is a German word: Tschüß'
|
||||
pass
|
||||
def func(param):
|
||||
'this is a python function'
|
||||
@ -186,10 +185,10 @@ pass
|
||||
\end{lstlisting}
|
||||
|
||||
Special cases:
|
||||
\begin{lstlisting}
|
||||
\begin{centering}
|
||||
\begin{lstlisting}[abovecaptionskip=2em,basicstyle={\large\ttfamily},breaklines=true,extendedchars=true,firstline=2,float=h,language={[R/3 3.1]ABAP},lastline=5,numbers=left,numberstyle={\scriptsize},showspaces=true,showstringspaces=false,stepnumber=3,tabsize=4]
|
||||
hello
|
||||
\end{lstlisting}
|
||||
|
||||
\lstinline[language=TeX]!\begin{centering} hello!
|
||||
|
||||
|
||||
|
@ -1122,12 +1122,22 @@ void parse_listings(Parser & p, ostream & os, Context & parent_context)
|
||||
{
|
||||
parent_context.check_layout(os);
|
||||
begin_inset(os, "listings\n");
|
||||
if (p.hasOpt()) {
|
||||
// there can be a [] pair inside the argument for the language
|
||||
string arg = p.getArg('[', ']');
|
||||
if (arg.find("language={[") != string::npos) {
|
||||
char start = p.next_token().character();
|
||||
arg += ']';
|
||||
arg += start;
|
||||
arg += p.getArg(start, ']');
|
||||
}
|
||||
os << "lstparams " << '"' << arg << '"' << '\n';
|
||||
}
|
||||
os << "inline false\n"
|
||||
<< "status collapsed\n";
|
||||
Context context(true, parent_context.textclass);
|
||||
context.layout = &parent_context.textclass.plainLayout();
|
||||
context.check_layout(os);
|
||||
string const s = p.verbatimEnvironment("lstlisting");
|
||||
string const s = p.plainEnvironment("lstlisting");
|
||||
for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
|
||||
if (*it == '\\')
|
||||
os << "\n\\backslash\n";
|
||||
@ -1390,11 +1400,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
// FIXME handle listings with parameters
|
||||
// If this is added, don't forgot to handle the
|
||||
// automatic color package loading
|
||||
if (p.hasOpt())
|
||||
parse_unknown_environment(p, name, os, FLAG_END,
|
||||
outer, parent_context);
|
||||
else
|
||||
parse_listings(p, os, parent_context);
|
||||
parse_listings(p, os, parent_context);
|
||||
p.skip_spaces();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user