pandoc/test/command/latex-color.md
John MacFarlane 0bdcf415e4 Switch from pretty-simple to pretty-show for native output.
Update tests.

Reason:  it turns out that the native output generated by
pretty-simple isn't always readable by the native reader.
According to https://github.com/cdepillabout/pretty-simple/issues/99
it is not a design goal of the library that the rendered values
be readable using 'read'.  This makes it unsuitable for our
purposes.

pretty-show is a bit slower and it uses 4-space indents
(non-configurable), but it doesn't have this serious drawback.
2021-09-28 21:17:53 -07:00

3.2 KiB

\textcolor{}{}

% pandoc -f latex -t native
Hello \textcolor{red}{World}
^D
[ Para
    [ Str "Hello"
    , Space
    , Span
        ( "" , [] , [ ( "style" , "color: red" ) ] ) [ Str "World" ]
    ]
]
% pandoc -f latex -t native
\textcolor{red}{Hello} World
^D
[ Para
    [ Span
        ( "" , [] , [ ( "style" , "color: red" ) ] ) [ Str "Hello" ]
    , Space
    , Str "World"
    ]
]
% pandoc -f latex -t native
Hello \textcolor{blue}{\textbf{World}}
^D
[ Para
    [ Str "Hello"
    , Space
    , Span
        ( "" , [] , [ ( "style" , "color: blue" ) ] )
        [ Strong [ Str "World" ] ]
    ]
]
% pandoc -f latex -t native
Hello \textcolor{blue}{\textbf{World}}.
^D
[ Para
    [ Str "Hello"
    , Space
    , Span
        ( "" , [] , [ ( "style" , "color: blue" ) ] )
        [ Strong [ Str "World" ] ]
    , Str "."
    ]
]
% pandoc -f latex -t native
\textcolor{orange}{
\begin{itemize}	
    \item Item 1
    \item Item 2
\end{itemize}
}
^D
[ Div
    ( "" , [] , [ ( "style" , "color: orange" ) ] )
    [ BulletList
        [ [ Para [ Str "Item" , Space , Str "1" ] ]
        , [ Para [ Str "Item" , Space , Str "2" ] ]
        ]
    ]
]
% pandoc -f latex -t native
\textcolor{blue}{
\begin{itemize}
    \item Item 1
    \item Item 2
\end{itemize}
} some more text
^D
[ Div
  ( "", [], [ ( "style", "color: blue" ) ] )
  [ BulletList
    [
      [ Para [ Str "Item", Space, Str "1" ] ]
    ,
      [ Para [ Str "Item", Space, Str "2" ] ]
    ]
  ]
, Para
  [ Str "some", Space, Str "more", Space, Str "text" ]
]

\colorbox{}{}

% pandoc -f latex -t native
Hello \colorbox{red}{World}
^D
[ Para
    [ Str "Hello"
    , Space
    , Span
        ( "" , [] , [ ( "style" , "background-color: red" ) ] )
        [ Str "World" ]
    ]
]
% pandoc -f latex -t native
\colorbox{red}{Hello} World
^D
[ Para
  [ Span
    ( "", [], [ ( "style", "background-color: red" ) ] )
    [ Str "Hello" ]
  , Space
  , Str "World"
  ]
]
% pandoc -f latex -t native
Hello \colorbox{blue}{\textbf{World}}
^D
[ Para
    [ Str "Hello"
    , Space
    , Span
        ( "" , [] , [ ( "style" , "background-color: blue" ) ] )
        [ Strong [ Str "World" ] ]
    ]
]
% pandoc -f latex -t native
Hello \colorbox{blue}{\textbf{World}}.
^D
[ Para
    [ Str "Hello"
    , Space
    , Span
        ( "" , [] , [ ( "style" , "background-color: blue" ) ] )
        [ Strong [ Str "World" ] ]
    , Str "."
    ]
]
% pandoc -f latex -t native
\colorbox{orange}{
\begin{minipage}{\textwidth}
\begin{itemize}	
    \item Item 1
    \item Item 2
\end{itemize}
\end{minipage}
}
^D
[ Div
    ( "" , [] , [ ( "style" , "background-color: orange" ) ] )
    [ BulletList
        [ [ Para [ Str "Item" , Space , Str "1" ] ]
        , [ Para [ Str "Item" , Space , Str "2" ] ]
        ]
    ]
]
% pandoc -f latex -t native
\colorbox{blue}{
\begin{minipage}{\textwidth}
\begin{itemize}
    \item Item 1
    \item Item 2
\end{itemize}
\end{minipage}
} some more text
^D
[ Div
    ( "" , [] , [ ( "style" , "background-color: blue" ) ] )
    [ BulletList
        [ [ Para [ Str "Item" , Space , Str "1" ] ]
        , [ Para [ Str "Item" , Space , Str "2" ] ]
        ]
    ]
, Para
    [ Str "some" , Space , Str "more" , Space , Str "text" ]
]