summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-12-04 22:24:18 +0000
committerKarl Berry <karl@freefriends.org>2020-12-04 22:24:18 +0000
commit3e5689b6ed2be14caa070207912451fadd1d3e99 (patch)
tree1f5522dbf2aacc0f7365c9724ced427e8de62165 /Master/texmf-dist/source
parent510e24ff93e1d12670e0eadcf5b46aa257c7d507 (diff)
rest-api (4dec20)
git-svn-id: svn://tug.org/texlive/trunk@57068 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/rest-api/rest-api.dtx210
-rw-r--r--Master/texmf-dist/source/latex/rest-api/rest-api.ins4
2 files changed, 194 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/rest-api/rest-api.dtx b/Master/texmf-dist/source/latex/rest-api/rest-api.dtx
index db450b183ba..955f744c7e1 100644
--- a/Master/texmf-dist/source/latex/rest-api/rest-api.dtx
+++ b/Master/texmf-dist/source/latex/rest-api/rest-api.dtx
@@ -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,7 +392,10 @@
% 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.
%
%
@@ -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,6 +807,15 @@
nobreak=true
}
% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\bodyFormat}
+% \begin{macrocode}
+\newcommand{\bodyFormat}{json}
+% \end{macrocode}
+% \end{macro}
+%
%
% \begin{macro}{\routeBreakValue}
% \begin{macrocode}
@@ -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
diff --git a/Master/texmf-dist/source/latex/rest-api/rest-api.ins b/Master/texmf-dist/source/latex/rest-api/rest-api.ins
index eba18ecd93b..92070c15728 100644
--- a/Master/texmf-dist/source/latex/rest-api/rest-api.ins
+++ b/Master/texmf-dist/source/latex/rest-api/rest-api.ins
@@ -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 @@ version 2008/05/04 or later.
\Msg{* *}
\Msg{*************************************************************}
-\endbatchfile \ No newline at end of file
+\endbatchfile