Skip to content

Commit

Permalink
Merge pull request #41 from ivoa-std/loumir-syntax-highlight-XML
Browse files Browse the repository at this point in the history
syntax highlighting for XML
  • Loading branch information
lmichel authored Mar 7, 2022
2 parents fa35235 + 0ac2861 commit 80e0a9e
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
37 changes: 37 additions & 0 deletions PhotDM.tex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
\usepackage{float}
\usepackage[titletoc]{appendix}
\usepackage{listings}
% define colors for syntax XML
% include listing settings
\include{syntaxXML}

% end define colors



\usepackage{booktabs,xcolor}
Expand Down Expand Up @@ -1695,6 +1701,37 @@ \subsection{Filter Profile Service Serialization} \label{serializationfilter}
The following serialization is an example of a response of a filter profile service making use of the Photometry Filter DM through utypes:
\par





----------begin test syntax highlight
\section{test listing in XML}
\lstset{
language=xml,
tabsize=3,
%frame=lines,
caption=Test,
label=code:sample,
frame=shadowbox,
rulesepcolor=\color{gray},
xleftmargin=20pt,
framexleftmargin=15pt,
keywordstyle=\color{black}\bf,
commentstyle=\color{OliveGreen},
stringstyle=\color{red},
numbers=left,
numberstyle=\tiny,
numbersep=2pt,
breaklines=true,
showstringspaces=false,
basicstyle=\footnotesize,
emph={dmid,dmtype,dmrole,value},emphstyle={\color{magenta}}}
\lstinputlisting{./serialisations/2MASS_PhotSys.xml}



-----------end test --------
\begin{verbatim}
<?xml version="1.0"?>
<VOTABLE version="1.1" xsi:schemaLocation="http://www.ivoa.net/xml/VOTable/v1.1"
Expand Down
49 changes: 49 additions & 0 deletions syntaxXML.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
\usepackage{listings}
\usepackage{color}

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{OliveGreen}{rgb}{0.1,0.6,0.1}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\definecolor{lightblue}{rgb}{0.0,0.0,0.9}
\definecolor{cyan}{rgb}{0.0,0.6,0.6}
\definecolor{darkred}{rgb}{0.6,0.0,0.0}


\lstset{
basicstyle=\ttfamily\footnotesize,
columns=fullflexible,
showstringspaces=false,
numbers=left, % where to put the line-numbers
numberstyle=\tiny\color{gray}, % the style that is used for the line-numbers
stepnumber=1,
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=none, % adds a frame around the code
rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
title=\lstname, % show the filename of files included with \lstinputlisting;
% also try caption instead of title
commentstyle=\color{gray}\upshape
}


\lstdefinelanguage{XML}
{
morestring=[s][\color{mauve}]{"}{"},
morestring=[s][\color{black}]{>}{<},
morecomment=[s]{<?}{?>},
morecomment=[s][\color{dkgreen}]{<!--}{-->},
stringstyle=\color{black},
identifierstyle=\color{lightblue},
keywordstyle=\color{red},
morekeywords={xmlns,xsi,noNamespaceSchemaLocation,type,id,source,target,version,tool,roleRef}
}

0 comments on commit 80e0a9e

Please sign in to comment.