Skip to content

Commit

Permalink
Add stylesheet. (modelica#3409)
Browse files Browse the repository at this point in the history
* Add stylesheet.
* Do not add specific tags.
* Add use of styelsheet
* Add vendor-style based on comments.

Co-authored-by: Malte Lenz <malte.lenz@gmail.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
  • Loading branch information
3 people committed Jan 24, 2024
1 parent 7da16b4 commit 9a8ac07
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions chapters/annotations.tex
Expand Up @@ -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}
Expand Down Expand Up @@ -72,6 +75,22 @@ \subsection{Class Description and Revision History}\label{annotation-info-revisi
<a href="modelica:/MultiBody.Joints.Revolute#info">Revolute</a>
\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:
Expand Down
11 changes: 11 additions & 0 deletions mlsshared.sty
Expand Up @@ -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,
Expand Down

0 comments on commit 9a8ac07

Please sign in to comment.