From 49336ee6eeecc352e248d1262ea1b46070e00243 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Tue, 2 May 2017 10:48:57 +0200 Subject: Add basic \textcolor support to LaTeX reader --- test/command/textcolor.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/command/textcolor.md (limited to 'test/command') diff --git a/test/command/textcolor.md b/test/command/textcolor.md new file mode 100644 index 000000000..7719a1c6b --- /dev/null +++ b/test/command/textcolor.md @@ -0,0 +1,13 @@ +``` +% 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 +\textcolor{blue}{Hello \textbf{World}} +^D +[Para [Span ("",[],[("style","color: blue")]) [Str "Hello",Space,Strong [Str "World"]]]] +``` -- cgit v1.2.3 From d9439808f2fe226aad027c8c9d0a38217a1e8c34 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Wed, 3 May 2017 12:00:30 +0200 Subject: Add block version of \textcolor --- test/command/textcolor.md | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/command') diff --git a/test/command/textcolor.md b/test/command/textcolor.md index 7719a1c6b..013e55d67 100644 --- a/test/command/textcolor.md +++ b/test/command/textcolor.md @@ -11,3 +11,14 @@ ^D [Para [Span ("",[],[("style","color: blue")]) [Str "Hello",Space,Strong [Str "World"]]]] ``` + +``` +% pandoc -f latex -t native +\textcolor{orange}{ + \begin{itemize} + \item Test + \end{itemize} +} +^D + +``` -- cgit v1.2.3 From 1728d4e60983e050be4bfb5b8c2e6065b4dd198a Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Wed, 3 May 2017 13:39:38 +0200 Subject: \textcolor works as inline and block command --- test/command/textcolor.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'test/command') diff --git a/test/command/textcolor.md b/test/command/textcolor.md index 013e55d67..aa3593822 100644 --- a/test/command/textcolor.md +++ b/test/command/textcolor.md @@ -1,24 +1,28 @@ ``` % pandoc -f latex -t native -\textcolor{red}{Hello World} +Hello \textcolor{red}{World} ^D -[Para [Span ("",[],[("style","color: red")]) [Str "Hello",Space,Str "World"]]] +[Para [Str "Hello",Space,Span ("",[],[("style","color: red")]) [Str "World"]]] ``` ``` % pandoc -f latex -t native -\textcolor{blue}{Hello \textbf{World}} +Hello \textcolor{blue}{\textbf{World}} ^D -[Para [Span ("",[],[("style","color: blue")]) [Str "Hello",Space,Strong [Str "World"]]]] +[Para [Str "Hello",Space,Span ("",[],[("style","color: blue")]) [Strong [Str "World"]]]] ``` ``` % pandoc -f latex -t native \textcolor{orange}{ - \begin{itemize} - \item Test - \end{itemize} +\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"]]]]] ``` -- cgit v1.2.3 From 4ed6d9165672917cb9450578c8f7d84121ecfc24 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Thu, 4 May 2017 16:48:27 +0200 Subject: \textcolor will be parse as span at the beginning of a paragraph --- test/command/textcolor.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/command') diff --git a/test/command/textcolor.md b/test/command/textcolor.md index aa3593822..59b0f6a16 100644 --- a/test/command/textcolor.md +++ b/test/command/textcolor.md @@ -5,6 +5,13 @@ Hello \textcolor{red}{World} [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}} -- cgit v1.2.3 From 29a4bdc68131d3925a55e0428b35c6a4f75f86e0 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Tue, 23 May 2017 17:31:42 -0300 Subject: Add suggestions of @jgm: parse bracketed stuff as inlines --- test/command/textcolor.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/command') diff --git a/test/command/textcolor.md b/test/command/textcolor.md index 59b0f6a16..47c41e62d 100644 --- a/test/command/textcolor.md +++ b/test/command/textcolor.md @@ -33,3 +33,20 @@ Hello \textcolor{blue}{\textbf{World}} [[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"]] +``` + -- cgit v1.2.3 From b1d0c61f2dd5e89f4cbc8f4d868704bf681a7086 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Tue, 23 May 2017 17:36:27 -0300 Subject: Add another test to make sure that textcolor parsing is working in the inside of a paragraph --- test/command/textcolor.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/command') diff --git a/test/command/textcolor.md b/test/command/textcolor.md index 47c41e62d..51d05b9f1 100644 --- a/test/command/textcolor.md +++ b/test/command/textcolor.md @@ -19,6 +19,14 @@ Hello \textcolor{blue}{\textbf{World}} [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}{ -- cgit v1.2.3 From 181c56d4003aa83abed23b95a452c4890aa3797c Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Thu, 1 Jun 2017 09:09:27 +0200 Subject: Add \colorbox support --- test/command/latex-color.md | 127 ++++++++++++++++++++++++++++++++++++++++++++ test/command/textcolor.md | 60 --------------------- 2 files changed, 127 insertions(+), 60 deletions(-) create mode 100644 test/command/latex-color.md delete mode 100644 test/command/textcolor.md (limited to 'test/command') diff --git a/test/command/latex-color.md b/test/command/latex-color.md new file mode 100644 index 000000000..9fd2585a3 --- /dev/null +++ b/test/command/latex-color.md @@ -0,0 +1,127 @@ +# `\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"]] +``` diff --git a/test/command/textcolor.md b/test/command/textcolor.md deleted file mode 100644 index 51d05b9f1..000000000 --- a/test/command/textcolor.md +++ /dev/null @@ -1,60 +0,0 @@ -``` -% 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"]] -``` - -- cgit v1.2.3