texlive[57068] Master/texmf-dist: rest-api (4dec20)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 4 23:24:18 CET 2020


Revision: 57068
          http://tug.org/svn/texlive?view=revision&revision=57068
Author:   karl
Date:     2020-12-04 23:24:18 +0100 (Fri, 04 Dec 2020)
Log Message:
-----------
rest-api (4dec20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/rest-api/README.md
    trunk/Master/texmf-dist/doc/latex/rest-api/rest-api.pdf
    trunk/Master/texmf-dist/source/latex/rest-api/rest-api.dtx
    trunk/Master/texmf-dist/source/latex/rest-api/rest-api.ins
    trunk/Master/texmf-dist/tex/latex/rest-api/rest-api.sty

Modified: trunk/Master/texmf-dist/doc/latex/rest-api/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/rest-api/README.md	2020-12-04 22:24:00 UTC (rev 57067)
+++ trunk/Master/texmf-dist/doc/latex/rest-api/README.md	2020-12-04 22:24:18 UTC (rev 57068)
@@ -3,4 +3,4 @@
 
 Developed by Dennis Klein <dennis94.kl at gmail.com>
 
-This material is subject to the LATEX Project Public License 1.3c.
\ No newline at end of file
+This material is subject to the LATEX Project Public License 1.3c.

Modified: trunk/Master/texmf-dist/doc/latex/rest-api/rest-api.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/rest-api/rest-api.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/rest-api/rest-api.dtx	2020-12-04 22:24:00 UTC (rev 57067)
+++ trunk/Master/texmf-dist/source/latex/rest-api/rest-api.dtx	2020-12-04 22:24:18 UTC (rev 57068)
@@ -22,7 +22,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{rest-api}
 %<*package>
-    [2020/06/23 v1.3 rest-api package]
+    [2020/12/04 v1.4 rest-api package]
 %</package>
 %
 %<*driver>
@@ -40,7 +40,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{424}
+% \CheckSum{514}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -59,6 +59,7 @@
 %   Right brace   \}     Tilde         \~}
 %
 %
+% \changes{v1.4}{2020/12/04}{Add xml syntax highlighting support for request and response body}
 % \changes{v1.3}{2020/06/23}{Fix typo and table coloring after apiRoute block}
 % \changes{v1.2}{2020/03/22}{Corrections for CTAN, rename to rest-api}
 % \changes{v1.1}{2020/03/21}{Add documentation and usage}
@@ -270,6 +271,34 @@
 %</example>
 % \fi
 
+% \paragraph{DELETE Request xml} \
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[frame=single,breaklines=true]
+	\begin{apiRoute}{delete}{/api/storage/\{id\}}{remove a storage with id}
+		\begin{routeParameter}
+			\routeParamItem{id}{id of storage}
+		\end{routeParameter}
+		\begin{routeResponse}{application/xml}
+			\begin{routeResponseItem}{200}{ok}
+				
+			\end{routeResponseItem}
+			\begin{routeResponseItem}{404}{error: storage not found}
+				\begin{routeResponseItemBody}
+	<message>
+		storage with id '11' not found!
+	</message>
+				\end{routeResponseItemBody}
+			\end{routeResponseItem}
+		\end{routeResponse}
+	\end{apiRoute}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+
+
 %
 %
 %
@@ -363,8 +392,11 @@
 %	Return the border color of the current route.
 %
 % \DescribeMacro{\methodJson}
-%	Set the with \\lstset color scheme for the listings of the current route.
+%	Set the color scheme and language with \\lstset for the listings of the current route to json.
 %
+% \DescribeMacro{\methodXml}
+%	Set the color scheme and language with \\lstset for the listings of the current route to xml.
+%
 
 %
 % \StopEventually{}
@@ -504,6 +536,7 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{color definitions for json}
 %    \begin{macrocode}
 \colorlet{punct}{black}
 \definecolor{background}{HTML}{EEEEEE}
@@ -515,6 +548,11 @@
 \colorlet{numbPut}{delimPut}
 \colorlet{delimDelete}{\getDeleteColor}
 \colorlet{numbDelete}{delimDelete}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{json language defintions}
+%    \begin{macrocode}
 \lstdefinelanguage{jsonGet}{
 	basicstyle=\small\ttfamily\color{black},
 	numberstyle=\small\color{black},
@@ -655,6 +693,105 @@
 	{[}{{{\color{delimDelete}{[}}}}{1}
 	{]}{{{\color{delimDelete}{]}}}}{1},
 }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{xml language defintions}
+%    \begin{macrocode}
+\lstdefinelanguage{xmlGet}{
+	basicstyle=\small\ttfamily\color{black},
+	numberstyle=\small\color{numbGet},
+	keywordstyle=\color{black},
+	commentstyle=\color{black},
+	stringstyle=\color{black},
+	frame=L,
+	framesep=8pt,
+	framerule=2pt,
+	xleftmargin=50pt,
+	xrightmargin=0pt,
+	rulesep=0pt,
+	backgroundcolor=\color{white},
+	numbersep=8pt,
+	tabsize=4,
+	showstringspaces=false,
+	breaklines=false,
+	morestring=[b]",
+	morestring=[s]{>}{<},
+	morecomment=[s]{<?}{?>},
+	identifierstyle=\color{numbGet},
+}
+\lstdefinelanguage{xmlPost}{
+	basicstyle=\small\ttfamily\color{black},
+	numberstyle=\small\color{numbPost},
+	keywordstyle=\color{black},
+	commentstyle=\color{black},
+	stringstyle=\color{black},
+	frame=L,
+	framesep=8pt,
+	framerule=2pt,
+	xleftmargin=50pt,
+	xrightmargin=0pt,
+	rulesep=0pt,
+	backgroundcolor=\color{white},
+	numbersep=8pt,
+	tabsize=4,
+	showstringspaces=false,
+	breaklines=false,
+	morestring=[b]",
+	morestring=[s]{>}{<},
+	morecomment=[s]{<?}{?>},
+	identifierstyle=\color{numbPost},
+}
+\lstdefinelanguage{xmlPut}{
+	basicstyle=\small\ttfamily\color{black},
+	numberstyle=\small\color{numbPut},
+	keywordstyle=\color{black},
+	commentstyle=\color{black},
+	stringstyle=\color{black},
+	frame=L,
+	framesep=8pt,
+	framerule=2pt,
+	xleftmargin=50pt,
+	xrightmargin=0pt,
+	rulesep=0pt,
+	backgroundcolor=\color{white},
+	numbersep=8pt,
+	tabsize=4,
+	showstringspaces=false,
+	breaklines=false,
+	morestring=[b]",
+	morestring=[s]{>}{<},
+	morecomment=[s]{<?}{?>},
+	stringstyle=\color{black},
+	identifierstyle=\color{numbPut},
+}
+\lstdefinelanguage{xmlDelete}{
+	basicstyle=\small\ttfamily\color{black},
+	numberstyle=\small\color{numbDelete},
+	keywordstyle=\color{black},
+	commentstyle=\color{black},
+	stringstyle=\color{black},
+	frame=L,
+	framesep=8pt,
+	framerule=2pt,
+	xleftmargin=50pt,
+	xrightmargin=0pt,
+	rulesep=0pt,
+	backgroundcolor=\color{white},
+	numbersep=8pt,
+	tabsize=4,
+	showstringspaces=false,
+	breaklines=false,
+	morestring=[b]",
+	morestring=[s]{>}{<},
+	morecomment=[s]{<?}{?>},
+	identifierstyle=\color{numbDelete},
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{apiRoute frame style defintion}
+%    \begin{macrocode}
 \mdfdefinestyle{mystyle}{
 	linecolor=\methodBorderColor,
 	backgroundcolor=\methodLightColor,
@@ -670,7 +807,16 @@
 	nobreak=true
 }
 %    \end{macrocode}
+% \end{macro}
 %
+%
+% \begin{macro}{\bodyFormat}
+%    \begin{macrocode}
+\newcommand{\bodyFormat}{json}
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}{\routeBreakValue}
 %    \begin{macrocode}
 \newcommand{\routeBreakValue}{true}
@@ -733,21 +879,21 @@
 {
 	\lstset{language=jsonGet,rulecolor=\color{\methodColor}}
 }
-\begin{comment}
-	\newcommand{\apiCorner}{notround}
-	
-	\newcommand{\apiCornerRound}
-	{
-	\renewcommand{\apiCorner}{round}
-	}
-	
-	\newcommand{\apiCornerNotRound}
-	{
-	\renewcommand{\apiCorner}{notround}
-	}
-\end{comment}
 %    \end{macrocode}
 %
+% \begin{macro}{\methodXml}
+%    \begin{macrocode}
+\newcommand{\methodXml}
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+{
+	\lstset{language=xmlGet,rulecolor=\color{\methodColor}}
+}
+%    \end{macrocode}
+%
+%
 % \begin{environment}{apiRoute}
 %    \begin{macrocode}
 \newenvironment{apiRoute}[3]
@@ -768,6 +914,12 @@
 			\colorlet{numbGet}{delimGet}
 			\lstset{language=jsonGet,rulecolor=\color{\methodColor}}
 		}
+		\renewcommand{\methodXml}
+		{
+			\colorlet{delimGet}{\methodColor}
+			\colorlet{numbGet}{delimGet}
+			\lstset{language=xmlGet,rulecolor=\color{\methodColor}}
+		}
 	}
 	{}
 	
@@ -782,6 +934,12 @@
 			\colorlet{numbPost}{delimPost}
 			\lstset{language=jsonPost,rulecolor=\color{\methodColor}}
 		}
+		\renewcommand{\methodXml}
+		{
+			\colorlet{delimPost}{\methodColor}
+			\colorlet{numbPost}{delimPost}
+			\lstset{language=xmlPost,rulecolor=\color{\methodColor}}
+		}
 	}
 	{}
 	
@@ -796,6 +954,12 @@
 			\colorlet{numbPut}{delimPut}
 			\lstset{language=jsonPut,rulecolor=\color{\methodColor}}
 		}
+		\renewcommand{\methodXml}
+		{
+			\colorlet{delimPut}{\methodColor}
+			\colorlet{numbPut}{delimPut}
+			\lstset{language=xmlPut,rulecolor=\color{\methodColor}}
+		}
 	}
 	{} 
 	\ifthenelse{\equal{\method}{delete}}
@@ -809,6 +973,12 @@
 			\colorlet{numbDelete}{delimDelete}
 			\lstset{language=jsonDelete,rulecolor=\color{\methodColor}}
 		}
+		\renewcommand{\methodXml}
+		{
+			\colorlet{delimDelete}{\methodColor}
+			\colorlet{numbDelete}{delimDelete}
+			\lstset{language=xmlDelete,rulecolor=\color{\methodColor}}
+		}
 	}
 	{}
 	
@@ -857,6 +1027,8 @@
 %    \begin{macrocode}
 \newenvironment{routeRequest}[1]
 {
+	\renewcommand{\bodyFormat}{#1}
+
 	\arrayrulecolor{\methodColor}
 	
 	\begin{tabularx}{\textwidth}{X l}
@@ -874,7 +1046,7 @@
 }
 \lstnewenvironment{routeRequestBody}
 {
-	\methodJson
+	\IfSubStr{\bodyFormat}{xml}{\methodXml}{\methodJson}
 }
 {}
 %    \end{macrocode}
@@ -915,6 +1087,8 @@
 %    \begin{macrocode}
 \newenvironment{routeResponse}[1]
 {
+	\renewcommand{\bodyFormat}{#1}
+
 	\newcommand{\noRouteResponse}[1]
 	{
 		\begin{tabularx}{\textwidth}{X}
@@ -954,7 +1128,7 @@
 \lstnewenvironment{routeResponseItemBody}
 {
 	\vspace{-1.4em}
-	\methodJson
+	\IfSubStr{\bodyFormat}{xml}{\methodXml}{\methodJson}
 }
 {}
 \endinput

Modified: trunk/Master/texmf-dist/source/latex/rest-api/rest-api.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/rest-api/rest-api.ins	2020-12-04 22:24:00 UTC (rev 57067)
+++ trunk/Master/texmf-dist/source/latex/rest-api/rest-api.ins	2020-12-04 22:24:18 UTC (rev 57068)
@@ -16,7 +16,7 @@
 
 \Msg{************************************************************************}
 \Msg{* Installation *}
-\Msg{* Package: rest-api 2020/03/22 v1.2 *}
+\Msg{* Package: rest-api 2020/12/04 v1.4 *}
 \Msg{************************************************************************}
 
 \keepsilent
@@ -58,4 +58,4 @@
 \Msg{* *}
 \Msg{*************************************************************}
 
-\endbatchfile
\ No newline at end of file
+\endbatchfile

Modified: trunk/Master/texmf-dist/tex/latex/rest-api/rest-api.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/rest-api/rest-api.sty	2020-12-04 22:24:00 UTC (rev 57067)
+++ trunk/Master/texmf-dist/tex/latex/rest-api/rest-api.sty	2020-12-04 22:24:18 UTC (rev 57068)
@@ -22,7 +22,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{rest-api}
-    [2020/06/23 v1.3 rest-api package]
+    [2020/12/04 v1.4 rest-api package]
 
 
 
@@ -30,6 +30,7 @@
 
 
 
+
 %% This program can be redistributed and/or modified under the terms
 %% of the LaTeX Project Public License Distributed from CTAN archives
 %% in directory macros/latex/base/lppl.txt.
@@ -220,6 +221,95 @@
 {[}{{{\color{delimDelete}{[}}}}{1}
 {]}{{{\color{delimDelete}{]}}}}{1},
 }
+\lstdefinelanguage{xmlGet}{
+basicstyle=\small\ttfamily\color{black},
+numberstyle=\small\color{numbGet},
+keywordstyle=\color{black},
+commentstyle=\color{black},
+stringstyle=\color{black},
+frame=L,
+framesep=8pt,
+framerule=2pt,
+xleftmargin=50pt,
+xrightmargin=0pt,
+rulesep=0pt,
+backgroundcolor=\color{white},
+numbersep=8pt,
+tabsize=4,
+showstringspaces=false,
+breaklines=false,
+morestring=[b]",
+morestring=[s]{>}{<},
+morecomment=[s]{<?}{?>},
+identifierstyle=\color{numbGet},
+}
+\lstdefinelanguage{xmlPost}{
+basicstyle=\small\ttfamily\color{black},
+numberstyle=\small\color{numbPost},
+keywordstyle=\color{black},
+commentstyle=\color{black},
+stringstyle=\color{black},
+frame=L,
+framesep=8pt,
+framerule=2pt,
+xleftmargin=50pt,
+xrightmargin=0pt,
+rulesep=0pt,
+backgroundcolor=\color{white},
+numbersep=8pt,
+tabsize=4,
+showstringspaces=false,
+breaklines=false,
+morestring=[b]",
+morestring=[s]{>}{<},
+morecomment=[s]{<?}{?>},
+identifierstyle=\color{numbPost},
+}
+\lstdefinelanguage{xmlPut}{
+basicstyle=\small\ttfamily\color{black},
+numberstyle=\small\color{numbPut},
+keywordstyle=\color{black},
+commentstyle=\color{black},
+stringstyle=\color{black},
+frame=L,
+framesep=8pt,
+framerule=2pt,
+xleftmargin=50pt,
+xrightmargin=0pt,
+rulesep=0pt,
+backgroundcolor=\color{white},
+numbersep=8pt,
+tabsize=4,
+showstringspaces=false,
+breaklines=false,
+morestring=[b]",
+morestring=[s]{>}{<},
+morecomment=[s]{<?}{?>},
+stringstyle=\color{black},
+identifierstyle=\color{numbPut},
+}
+\lstdefinelanguage{xmlDelete}{
+basicstyle=\small\ttfamily\color{black},
+numberstyle=\small\color{numbDelete},
+keywordstyle=\color{black},
+commentstyle=\color{black},
+stringstyle=\color{black},
+frame=L,
+framesep=8pt,
+framerule=2pt,
+xleftmargin=50pt,
+xrightmargin=0pt,
+rulesep=0pt,
+backgroundcolor=\color{white},
+numbersep=8pt,
+tabsize=4,
+showstringspaces=false,
+breaklines=false,
+morestring=[b]",
+morestring=[s]{>}{<},
+morecomment=[s]{<?}{?>},
+identifierstyle=\color{numbDelete},
+}
 \mdfdefinestyle{mystyle}{
 linecolor=\methodBorderColor,
 backgroundcolor=\methodLightColor,
@@ -234,6 +324,7 @@
 rightmargin=0pt,
 nobreak=true
 }
+\newcommand{\bodyFormat}{json}
 \newcommand{\routeBreakValue}{true}
 \newcommand{\noBreakRoute}
 {
@@ -250,19 +341,10 @@
 {
 \lstset{language=jsonGet,rulecolor=\color{\methodColor}}
 }
-\begin{comment}
-\newcommand{\apiCorner}{notround}
-
-\newcommand{\apiCornerRound}
+\newcommand{\methodXml}
 {
-\renewcommand{\apiCorner}{round}
+\lstset{language=xmlGet,rulecolor=\color{\methodColor}}
 }
-
-\newcommand{\apiCornerNotRound}
-{
-\renewcommand{\apiCorner}{notround}
-}
-\end{comment}
 \newenvironment{apiRoute}[3]
 {
 \global\let\saved at CT@arc@\CT at arc@
@@ -281,7 +363,13 @@
 \colorlet{numbGet}{delimGet}
 \lstset{language=jsonGet,rulecolor=\color{\methodColor}}
 }
+\renewcommand{\methodXml}
+{
+\colorlet{delimGet}{\methodColor}
+\colorlet{numbGet}{delimGet}
+\lstset{language=xmlGet,rulecolor=\color{\methodColor}}
 }
+}
 {}
 
 \ifthenelse{\equal{\method}{post}}
@@ -295,7 +383,13 @@
 \colorlet{numbPost}{delimPost}
 \lstset{language=jsonPost,rulecolor=\color{\methodColor}}
 }
+\renewcommand{\methodXml}
+{
+\colorlet{delimPost}{\methodColor}
+\colorlet{numbPost}{delimPost}
+\lstset{language=xmlPost,rulecolor=\color{\methodColor}}
 }
+}
 {}
 
 \ifthenelse{\equal{\method}{put}}
@@ -309,7 +403,13 @@
 \colorlet{numbPut}{delimPut}
 \lstset{language=jsonPut,rulecolor=\color{\methodColor}}
 }
+\renewcommand{\methodXml}
+{
+\colorlet{delimPut}{\methodColor}
+\colorlet{numbPut}{delimPut}
+\lstset{language=xmlPut,rulecolor=\color{\methodColor}}
 }
+}
 {}
 \ifthenelse{\equal{\method}{delete}}
 {
@@ -322,7 +422,13 @@
 \colorlet{numbDelete}{delimDelete}
 \lstset{language=jsonDelete,rulecolor=\color{\methodColor}}
 }
+\renewcommand{\methodXml}
+{
+\colorlet{delimDelete}{\methodColor}
+\colorlet{numbDelete}{delimDelete}
+\lstset{language=xmlDelete,rulecolor=\color{\methodColor}}
 }
+}
 {}
 
 \ifthenelse{\equal{\routeDescription}{}}
@@ -361,6 +467,8 @@
 }
 \newenvironment{routeRequest}[1]
 {
+\renewcommand{\bodyFormat}{#1}
+
 \arrayrulecolor{\methodColor}
 
 \begin{tabularx}{\textwidth}{X l}
@@ -374,7 +482,7 @@
 }
 \lstnewenvironment{routeRequestBody}
 {
-\methodJson
+\IfSubStr{\bodyFormat}{xml}{\methodXml}{\methodJson}
 }
 {}
 \newenvironment{routeParameter}
@@ -402,6 +510,8 @@
 }
 \newenvironment{routeResponse}[1]
 {
+\renewcommand{\bodyFormat}{#1}
+
 \newcommand{\noRouteResponse}[1]
 {
 \begin{tabularx}{\textwidth}{X}
@@ -429,7 +539,7 @@
 \lstnewenvironment{routeResponseItemBody}
 {
 \vspace{-1.4em}
-\methodJson
+\IfSubStr{\bodyFormat}{xml}{\methodXml}{\methodJson}
 }
 {}
 \endinput



More information about the tex-live-commits mailing list.