From 9a8ac0737a1b811c2ec62fab8c83ff880da3d9ff Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Wed, 24 Jan 2024 12:01:59 +0100 Subject: [PATCH] Add stylesheet. (#3409) * Add stylesheet. * Do not add specific tags. * Add use of styelsheet * Add vendor-style based on comments. Co-authored-by: Malte Lenz Co-authored-by: Henrik Tidefelt --- chapters/annotations.tex | 19 +++++++++++++++++++ mlsshared.sty | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/chapters/annotations.tex b/chapters/annotations.tex index ee157095d..5cb7a4f01 100644 --- a/chapters/annotations.tex +++ b/chapters/annotations.tex @@ -42,9 +42,12 @@ \section{Documentation}\label{annotations-for-documentation}\label{documentation String info = "" "Description of the class"; String revisions = "" "Revision history"; Figure[:] figures = {}; "Simulation result figures"; + String[:] styleSheets = {} "Style sheets for documentation"; end Documentation; \end{lstlisting} +The \lstinline!styleSheets! may also be given as a single string, see \cref{style-sheets}. + How the tool interprets the information in \lstinline!Documentation! is unspecified. \subsection{Class Description and Revision History}\label{annotation-info-revisions} @@ -72,6 +75,22 @@ \subsection{Class Description and Revision History}\label{annotation-info-revisi Revolute \end{lstlisting} +\subsubsection{Style Sheets}\label{style-sheets} + +Inside the \lstinline!Documentation! annotation, each element of the \lstinline!styleSheets! annotation array specifies a cascading style sheet. +The style sheets are used when displaying the \lstinline!info! and \lstinline!revisions! annotations found in the \lstinline!Documentation! annotations of the package. +The \lstinline!styleSheets! annotation is only considered for top-level packages, and applies to the entire package. +The style sheets will be cascaded in the given order. +Specifying just a string for \lstinline!styleSheets! has the same meaning as specifying a singleton array containing the string. +\begin{nonnormative} +It is recommended to use \lstinline[language=CSS]!class! and \lstinline[language=CSS]!id! selectors with a \lstinline[language=CSS]!$NameOfLibrary$-! prefix to avoid collisions when the content is included in a larger context. +\end{nonnormative} +The style sheet rules should not use type or universal selectors, due to possible interference with tool-specific styling. + +Vendors should use a \lstinline[language=CSS]!$NameOfVendor$-! prefix to style vendor generated HTML content surrounding the user provided documentation. +If tools want to give users (of that tool) the possibility to override the tool-specific CSS they can document that. +The prefix is used to avoid this happening by accident. + \subsection{Figures}\label{annotations-for-figures}\label{figures} Inside the \lstinline!Documentation! annotation, each element of the \lstinline!figures! annotation array has the following content: diff --git a/mlsshared.sty b/mlsshared.sty index 16dad2f7b..8320afc30 100644 --- a/mlsshared.sty +++ b/mlsshared.sty @@ -184,6 +184,17 @@ include,pragma,undef,warning} }[keywords,comments,strings,directives] +\lstdefinelanguage{CSS}{ + keywords={}, + sensitive=true, + morecomment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]", + alsoletter={:}, + alsodigit={-} +} + \lstset{% backgroundcolor=\color{white}, % choose the background color mathescape=true,