Gillou58 / asciidoc

Automatically exported from code.google.com/p/asciidoc
GNU General Public License v2.0
0 stars 0 forks source link

Use latex lstlisting #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using certain verbatim latex environment lead to problems as these environments 
expect a newline. 

The dovetail function strips all newlines for the verbatim blocks.
The proposed patch adds a asciidoc tag to indicate the newline must not be 
removed.

Element for latex.conf

[listingblock]
\\minisec\{{caption=Listing: }{title}\}
\label\{{id}\}\hypertarget\{{id}\}\{\}
\begin\{lstlisting\}[breaklines]
!..newline..!
|\end\{lstlisting\}

Patched function

def dovetail(lines1, lines2):
    """
    Append list or tuple of strings 'lines2' to list 'lines1'.  Join the last
    non-blank item in 'lines1' with the first non-blank item in 'lines2' into a
    single string.
    """
    assert is_array(lines1)
    assert is_array(lines2)
    lines1 = strip_list(lines1)
    lines2 = strip_list(lines2)
    if not lines1 or not lines2:
        return list(lines1) + list(lines2)
    if (lines1[-1]=="!..newline..!"):
            return list(lines1[:-1]) + list(lines2)
    if (lines2[0]=="!..newline..!"):
            return list(lines1) + list(lines2[1:])
    result = list(lines1[:-1])
    result.append(lines1[-1] + lines2[0])
    result += list(lines2[1:])
    return result

Original issue reported on code.google.com by streetde...@gmail.com on 5 Sep 2013 at 11:40