On Sat, Jun 17, 2017 at 11:11:18AM +0200, Kornel Benko wrote:

> Am Samstag, 17. Juni 2017 um 02:39:03, schrieb Enrico Forestieri 
> <for...@lyx.org>
> > commit 7a9bb851840fe7211cac05cbd898b27143f73559
> > Author: Enrico Forestieri <for...@lyx.org>
> > Date:   Sat Jun 17 02:23:00 2017 +0200
> > 
> >     tex2lyx: import minted listings
> >     
> >     This commit updates tex2lyx in order to also import minted listings.
> 
> Do also exist test files? Something like
>       src/tex2lyx/test/test-minted.lyx.lyx    // expected result
>       src/tex2lyx/test/test-minted.tex                // source
> ?

Please, find attached a latex source and the expected result from
importing it. I am not familiar with the testing framework, so I
would be grateful if you can integrate these test files.

-- 
Enrico
#LyX file created by tex2lyx 2.3
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin roundtrip
\textclass article
\begin_preamble
%% Do not edit unless you really know what you are doing.



\end_preamble
\use_default_options false
\maintain_unincluded_children false
\language english
\language_package none
\inputencoding iso8859-15
\fontencoding T1
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing single
\use_hyperref false
\papersize a4paper
\use_geometry false
\use_package amsmath 1
\use_package amssymb 0
\use_package cancel 0
\use_package esint 1
\use_package mathdots 0
\use_package mathtools 0
\use_package mhchem 0
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\use_minted 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard

\begin_inset CommandInset toc
LatexCommand lstlistoflistings

\end_inset


\end_layout

\begin_layout Section
Minted Listings
\end_layout

\begin_layout Standard
Inline: 
\begin_inset listings
lstparams "style=bw,language=C++"
inline true
status collapsed

\begin_layout Plain Layout
int a=5;
\end_layout

\end_inset


\begin_inset Newline newline
\end_inset

 Float (Listing
\begin_inset space ~

\end_inset


\begin_inset CommandInset ref
LatexCommand ref
reference "Example-Listing"
plural "false"
caps "false"
noprefix "false"

\end_inset

):
\end_layout

\begin_layout Standard

\begin_inset listings
lstparams "language=Python,float=h"
inline false
status collapsed

\begin_layout Plain Layout
# Example listing float
\end_layout

\begin_layout Plain Layout
def func(param):
\end_layout

\begin_layout Plain Layout
    'this is a python function'
\end_layout

\begin_layout Plain Layout
    pass
\end_layout

\begin_layout Plain Layout

\begin_inset Caption Standard

\begin_layout Plain Layout
Example Listing float
\begin_inset CommandInset label
LatexCommand label
name "Example-Listing"

\end_inset

 

\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
Here is an example listing with left line numbering, language 
\begin_inset Quotes eld
\end_inset

Python
\begin_inset Quotes erd
\end_inset

 and 
\begin_inset Quotes eld
\end_inset

Space
\begin_inset space ~

\end_inset

as
\begin_inset space ~

\end_inset

symbol
\begin_inset Quotes erd
\end_inset

, range lines from 4 to end:
\end_layout

\begin_layout Standard

\begin_inset listings
lstparams "firstline=4,numbers=left,showspaces=true,language=Python"
inline false
status collapsed

\begin_layout Plain Layout
def func(param):
\end_layout

\begin_layout Plain Layout
    'this is a python function'
\end_layout

\begin_layout Plain Layout
    pass
\end_layout

\begin_layout Plain Layout
def func(param):
\end_layout

\begin_layout Plain Layout
    'This is a German word: Tschüß'
\end_layout

\begin_layout Plain Layout
    pass
\end_layout

\end_inset


\end_layout

\begin_layout Standard
A floating one-liner with [h] placement and without caption: 
\begin_inset listings
lstparams 
"fontfamily=tt,fontsize={\large},bgcolor=lightgray,language=ABAP,float=h"
inline false
status collapsed

\begin_layout Plain Layout
hello
\end_layout


\end_inset


\end_layout

\begin_layout Standard
Another inline listing: 
\begin_inset listings
lstparams "language=TeX"
inline true
status collapsed

\begin_layout Plain Layout

\backslash
begin{centering} hello
\end_layout

\end_inset


\end_layout

\begin_layout Standard
A non-floating listing with line frames and a top caption (Listing
\begin_inset space ~

\end_inset


\begin_inset CommandInset ref
LatexCommand ref
reference "hello-world"
plural "false"
caps "false"
noprefix "false"

\end_inset

):  
\begin_inset listings
lstparams "numbers=left,frame=lines,language=C"
inline false
status collapsed

\begin_layout Plain Layout

\begin_inset Caption Standard

\begin_layout Plain Layout
An example C program
\begin_inset CommandInset label
LatexCommand label
name "hello-world"

\end_inset



\end_layout

\end_inset


\end_layout

\begin_layout Plain Layout
int main()
\end_layout

\begin_layout Plain Layout
{
\end_layout

\begin_layout Plain Layout
    printf("Hello world!
\backslash
n");
\end_layout

\begin_layout Plain Layout
    return 0;
\end_layout

\begin_layout Plain Layout
}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
A non-floating listing with line frames and a bottom caption (Listing
\begin_inset space ~

\end_inset


\begin_inset CommandInset ref
LatexCommand ref
reference "func"
plural "false"
caps "false"
noprefix "false"

\end_inset

): 
\begin_inset listings
lstparams "numbers=left,frame=lines,language=Fortran"
inline false
status collapsed

\begin_layout Plain Layout
subroutine incr(i)
\end_layout

\begin_layout Plain Layout
  integer :: i
\end_layout

\begin_layout Plain Layout
  i = i + 1 
\end_layout

\begin_layout Plain Layout
  return 
\end_layout

\begin_layout Plain Layout
end subroutine function
\end_layout

\begin_layout Plain Layout

\begin_inset Caption Standard

\begin_layout Plain Layout

\begin_inset CommandInset label
LatexCommand label
name "func"

\end_inset

A Fortran subroutine

\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
A framed floating listing with a caption and a label (Listing
\begin_inset space ~

\end_inset


\begin_inset CommandInset ref
LatexCommand ref
reference "python1"
plural "false"
caps "false"
noprefix "false"

\end_inset

): 
\begin_inset listings
lstparams "frame=single,language=Python,float=h"
inline false
status collapsed

\begin_layout Plain Layout
def boring(args = None):
\end_layout

\begin_layout Plain Layout
    pass
\end_layout

\begin_layout Plain Layout

\begin_inset Caption Standard

\begin_layout Plain Layout
A Python function.
\begin_inset CommandInset label
LatexCommand label
name "python1"

\end_inset

 

\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
The same framed floating listing with a caption, a label and a stray math 
equation (Listing
\begin_inset space ~

\end_inset


\begin_inset CommandInset ref
LatexCommand ref
reference "python2"
plural "false"
caps "false"
noprefix "false"

\end_inset

): \begin_inset listings
lstparams "frame=single,language=Python,float=h"
inline false
status collapsed

\begin_layout Plain Layout
def boring(args = None):
\end_layout

\begin_layout Plain Layout
    pass
\end_layout

\begin_layout Plain Layout

\begin_inset Caption Standard

\begin_layout Plain Layout
The previous Python function.
\begin_inset CommandInset label
LatexCommand label
name "python2"

\end_inset

 

\begin_inset Formula $y=f(x)$
\end_inset

 


\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_body
\end_document

Attachment: test-minted.tex
Description: TeX document

Reply via email to