\begin_inset listings
lstparams "language={C++},keywordstyle={\color{green}}"
inline true
-status collapsed
+status open
\begin_layout Plain Layout
int a=5;
\begin_inset listings
lstparams "caption={Example Listing float},label={lst:Example-Listing},language=Python"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
# Example listing float
\begin_inset listings
lstparams "extendedchars=true,firstline=3,language=Python,lastline=8,numbers=left,showspaces=true,stepnumber=3"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
def func(param):
\begin_inset listings
lstparams "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"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
hello
\begin_inset listings
lstparams "language=TeX"
inline true
-status collapsed
+status open
\begin_layout Plain Layout
\begin_inset listings
lstparams "language={C++},keywordstyle={\color{green}}"
inline true
-status collapsed
+status open
\begin_layout Plain Layout
int a=5;
\begin_inset listings
lstparams "caption={Example Listing float},label={lst:Example-Listing},language=Python"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
# Example listing float
\begin_inset listings
lstparams "extendedchars=true,firstline=3,language=Python,lastline=8,numbers=left,showspaces=true,stepnumber=3"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
def func(param):
\begin_inset listings
lstparams "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"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
hello
\begin_inset listings
lstparams "language=TeX"
inline true
-status collapsed
+status open
\begin_layout Plain Layout
\begin_inset listings
lstparams "style=bw,language=C++"
inline true
-status collapsed
+status open
\begin_layout Plain Layout
int a=5;
\begin_inset listings
lstparams "language=Python,float=h"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
# Example listing float
\begin_inset listings
lstparams "firstline=4,numbers=left,showspaces=true,language=Python"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
def func(param):
\begin_inset listings
lstparams "fontfamily=tt,fontsize={\large},bgcolor=lightgray,language=ABAP,float=h"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
hello
\begin_inset listings
lstparams "language=TeX"
inline true
-status collapsed
+status open
\begin_layout Plain Layout
\end_inset
-):
+):
\begin_inset listings
lstparams "numbers=left,frame=lines,language=C"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
\begin_inset listings
lstparams "numbers=left,frame=lines,language=Fortran"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
subroutine incr(i)
\end_inset
-
-\end_layout
-
-\begin_layout Standard
A framed floating listing with a caption and a label (Listing
\begin_inset space ~
\begin_inset listings
lstparams "frame=single,language=Python,float=h"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
def boring(args = None):
): \begin_inset listings
lstparams "frame=single,language=Python,float=h"
inline false
-status collapsed
+status open
\begin_layout Plain Layout
def boring(args = None):
os << "inline true\n";
else
os << "inline false\n";
- os << "status collapsed\n";
+ os << "status open\n";
Context context(true, parent_context.textclass);
context.layout = &parent_context.textclass.plainLayout();
if (use_minted && prefixIs(minted_nonfloat_caption, "[t]")) {
parse_text_snippet(p, FLAG_ITEM,
false, parent_context);
minted_nonfloat_caption = "[b]" + caption;
+ eat_whitespace(p, os, parent_context, true);
}
}
p.popPosition();
// so simply skip it.
parse_text_snippet(p, FLAG_ITEM, false, context);
}
+ eat_whitespace(p, os, context, true);
continue;
}
if (t.cs() == "input" || t.cs() == "include"
|| t.cs() == "verbatiminput"
- || t.cs() == "lstinputlisting") {
+ || t.cs() == "lstinputlisting"
+ || t.cs() == "inputminted") {
string name = t.cs();
if (name == "verbatiminput"
&& p.next_token().asInput() == "*")
name += p.get_token().asInput();
context.check_layout(os);
string lstparams;
- bool literal = false;
if (name == "lstinputlisting" && p.hasOpt()) {
lstparams = p.getArg('[', ']');
- pair<bool, string> oa = convert_latexed_command_inset_arg(lstparams);
- literal = !oa.first;
- if (literal)
+ lstparams = subst(lstparams, "\n", " ");
+ } else if (name == "inputminted") {
+ name = "lstinputlisting";
+ string const lang = p.getArg('{', '}');
+ if (lang != "tex") {
+ string cmd = "\\inputminted{" + lang + "}{";
+ cmd += p.getArg('{', '}') + "}";
+ output_ert_inset(os, cmd, context);
+ continue;
+ }
+ if (prefixIs(minted_nonfloat_caption, "[t]")) {
+ minted_nonfloat_caption.erase(0,3);
+ // extract label and caption from the already produced LyX code
+ vector<string> nfc = getVectorFromString(minted_nonfloat_caption, "\n");
+ string const caption = nfc.front();
+ string label;
+ vector<string>::iterator it =
+ find(nfc.begin(), nfc.end(), "LatexCommand label");
+ if (it != nfc.end()) {
+ ++it;
+ if (it != nfc.end())
+ label = *it;
+ label = support::split(label, '"');
+ label.pop_back();
+ }
+ minted_nonfloat_caption.clear();
+ lstparams = "caption=" + caption;
+ if (!label.empty())
+ lstparams += ",label=" + label;
lstparams = subst(lstparams, "\n", " ");
+ }
}
- string lit = literal ? "\"true\"" : "\"false\"";
string filename(normalize_filename(p.getArg('{', '}')));
string const path = getMasterFilePath(true);
// We want to preserve relative / absolute filenames,
"filename \"" << outname << "\"\n";
if (!lstparams.empty())
os << "lstparams \"" << lstparams << "\"\n";
- os << "literal " << lit << "\n";
if (t.cs() == "verbatiminput")
preamble.registerAutomaticallyLoadedPackage("verbatim");
}
- Add support for URW Classico, MinionPro and the new Libertine fonts.
+- Add support for \lstinputlisting and \inputminted.
+
- Add support for the \t*{} (bottomtiebar) macro of TIPA.
- Implement better parsing of some command options (via "literate"