Skip to content

Commit

Permalink
Replace modelica:// by modelica:/
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Sep 29, 2022
1 parent 0553160 commit 0769379
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions chapters/annotations.tex
Expand Up @@ -60,7 +60,7 @@ \subsection{Class Description and Revision History}\label{annotation-info-revisi
For external links, see \cref{external-resources}.
Links to Modelica classes may be defined with the HTML link command using scheme \lstinline!Modelica! (using its lower case form in the URI, see \cref{external-resources}), e.g.,
\begin{lstlisting}[language=modelica]
<a href="modelica://MultiBody.Tutorial">MultiBody.Tutorial</a>
<a href="modelica:/MultiBody.Tutorial">MultiBody.Tutorial</a>
\end{lstlisting}

Together with scheme \lstinline!Modelica! the (URI) fragment specifiers
Expand All @@ -69,7 +69,7 @@ \subsection{Class Description and Revision History}\label{annotation-info-revisi
when generating HTML (in particular to avoid collisions).
Example:
\begin{lstlisting}[language=modelica]
<a href="modelica://MultiBody.Joints.Revolute#info">Revolute</a>
<a href="modelica:/MultiBody.Joints.Revolute#info">Revolute</a>
\end{lstlisting}

\subsection{Figures}\label{annotations-for-figures}\label{figures}
Expand Down Expand Up @@ -285,7 +285,7 @@ \subsubsection{Text Markup in Captions}\label{text-markup-in-captions}
\item
% Use very short Modelica URI combined with carefully chosen wording below to deal with difficult line breaking.
A URI.
Well established schemes such as \lstinline[language={[nocomment]modelica}]!https://github.com/modelica! or \lstinline[language={[nocomment]modelica}]!modelica://Modelica!, as well as lesser known schemes may be used.
Well established schemes such as \lstinline[language={[nocomment]modelica}]!https://github.com/modelica! or \lstinline[language={[nocomment]modelica}]!modelica:/Modelica!, as well as lesser known schemes may be used.
(A tool that has no special recognition of a scheme can try sending the URI to the operating system for interpretation.)
\end{itemize}

Expand Down
8 changes: 4 additions & 4 deletions chapters/functions.tex
Expand Up @@ -2373,11 +2373,11 @@ \subsection{Annotations for External Functions}\label{annotations-for-external-l
\end{nonnormative}
\item
The
{\lstinline!annotation(IncludeDirectory="modelica://ModelicaLibraryName/Resources/Include")!}\annotationindex{IncludeDirectory}, used to specify a location for header files.
{\lstinline!annotation(IncludeDirectory="modelica:/ModelicaLibraryName/Resources/Include")!}\annotationindex{IncludeDirectory}, used to specify a location for header files.
The preceding one is the default and need not be specified; but another location could be specified by using an URI name for the include directory, see \cref{external-resources}.
\item
The
{\lstinline!annotation(LibraryDirectory="modelica://ModelicaLibraryName/Resources/Library")!}\annotationindex{LibraryDirectory}, used to specify a location for library files.
{\lstinline!annotation(LibraryDirectory="modelica:/ModelicaLibraryName/Resources/Library")!}\annotationindex{LibraryDirectory}, used to specify a location for library files.
The preceding one is the default and need not be specified; but another location could be specified by using an URI name for the library directory, see \cref{external-resources}.
Different versions of one object library can be provided (e.g.\ for Windows and for Linux) by providing a \emph{platform} directory below the {\lstinline!LibraryDirectory!}.
If no platform directory is present, the object library must be present in the {\lstinline!LibraryDirectory!}.
Expand All @@ -2394,7 +2394,7 @@ \subsection{Annotations for External Functions}\label{annotations-for-external-l
\end{itemize}
\item
The
{\lstinline!annotation(SourceDirectory="modelica://ModelicaLibraryName/Resources/Source")!}\annotationindex{SourceDirectory}, gives the location for source files.
{\lstinline!annotation(SourceDirectory="modelica:/ModelicaLibraryName/Resources/Source")!}\annotationindex{SourceDirectory}, gives the location for source files.
The preceding one is the default and need not be specified; but another location could be specified by using an URI name for the source directory, see \cref{external-resources}.
It is not specified how they are built.
\end{itemize}
Expand Down Expand Up @@ -2442,7 +2442,7 @@ \subsection{Annotations for External Functions}\label{annotations-for-external-l
annotation(Library = "ExternalLib1",
Include = "#include \"ExternalFunc1.h\"",
SourceDirectory =
"modelica://ExternalFunctions/Resources/Source");
"modelica:/ExternalFunctions/Resources/Source");
// The specified SourceDirectory is the default and thus redundant.
end ExternalFunc1;

Expand Down
27 changes: 14 additions & 13 deletions chapters/packages.tex
Expand Up @@ -278,34 +278,35 @@ \subsection{The within Clause}\label{the-within-clause}
\section{External Resources}\label{external-resources}

In order to reference external resources from documentation (such as links and images in html-text) and/or to reference images in the \lstinline!Bitmap! annotation (see \cref{bitmap}).
Absolute URIs should be used, for example \filename{file:///} and the URI scheme \filename{modelica://} which can be used to retrieve resources associated with a package.
According to the URI specification scheme names are case-insensitive, but the lower-case form should be used, that is \filename{Modelica://} is allowed but \filename{modelica://} is the recommended form.
Absolute URIs should be used, for example \filename{file:///} and the URI scheme \filename{modelica:/} which can be used to retrieve resources associated with a package.
According to the URI specification scheme names are case-insensitive, but the lower-case form should be used, that is \filename{Modelica:/} is allowed but \filename{modelica:/} is the recommended form.

The Modelica-scheme\index{Modelica!URI scheme}\index{URI!Modelica} has the ability to reference a hierarchical structure of resources associated with packages.
The same structure is used for all kind of resource references, independent of use (external file, image in documentation, bitmap in icon layer, and link to external file in the documentation), and regardless of the storage mechanism.

Any Modelica-scheme URI containing a slash after the package-name is
interpreted as a reference to a resource. The \emph{authority} portion of the
URI is interpreted as a fully qualified package name and the \emph{path}
portion of the URI is interpreted as the path (relative to the package)
interpreted as a reference to a resource. The first \emph{segment} of the
\emph{path} of the URI is interpreted as a fully qualified package name and the rest of the \emph{path}
of the URI is interpreted as the path (relative to the package)
of the resource. Each storage scheme can define its own interpretation
of the path (but care should be taken when converting from one storage
scheme or when restructuring packages that resource references resolve
to the same resource). Any storage scheme should be constrained such
that a resource with a given path should be unique for any package name
that precedes it. The first part of the path shall not be the name of a
class in the package given by the authority.
that precedes it.
As a deprecated feature the URI may start with \filename{modelica://} and use the authority as the fully qualified package name.
That feature is widely used, but deprecated since authorities are generally case-insensitive.

When Modelica packages are stored hierarchically in a file-system (i.e.\ package \lstinline!A! in a directory \filename{A} containing \filename{package.mo}) the resource
\filename{modelica://A/Resources/C.jpg} should be stored in the file \filename{A/Resources/C.jpg}, it is not recommend to use \filename{modelica://A.B/C.jpg} for referencing
\filename{modelica:/A/Resources/C.jpg} should be stored in the file \filename{A/Resources/C.jpg}, it is not recommend to use \filename{modelica:/A.B/C.jpg} for referencing
resources; it could be stored in the file \filename{A/B/C.jpg} -- which is counter-intuitive if \lstinline!A.B! is stored together with \lstinline!A!. When Modelica packages
are stored in other formats a similar mapping should be defined, such that a resource with a given path should be unique for any package name that precedes it. The first
part of the path shall not be the name of a class in the package given by the authority. As above for \filename{Modelica 3.2.1/package.mo} i.e.\ resources starting from
\filename{Modelica 3.2.1}, and \filename{modelica://Modelica.Mechanics/C.jpg} is \filename{Modelica 3.2.1/Mechanics/C.jpg} -- regardless of whether \lstinline!Modelica.Mechanics!
\filename{Modelica 3.2.1}, and \filename{modelica:/Modelica.Mechanics/C.jpg} is \filename{Modelica 3.2.1/Mechanics/C.jpg} -- regardless of whether \lstinline!Modelica.Mechanics!
is stored in \filename{Modelica 3.2.1/package.mo}, \filename{Modelica 3.2.1/Mechanics.mo}, or \filename{Modelica 3.2.1/Mechanics/package.mo}.

For a Modelica-package stored as a single file, \filename{A.mo}, the resource
\filename{modelica://A/C.jpg} refers to a file \filename{C.jpg} stored in the same
\filename{modelica:/A/C.jpg} refers to a file \filename{C.jpg} stored in the same
directory as \filename{A.mo}, but using resources in this variant is not
recommended since multiple packages will share resources.

Expand All @@ -317,7 +318,7 @@ \section{External Resources}\label{external-resources}
\begin{example}
Consider a top-level package \lstinline!Modelica! and a class
\lstinline!Mechanics! inside it, a reference such as
\filename{modelica://Modelica.Mechanics/C.jpg} is legal, while
\filename{modelica://Modelica/Mechanics/C.jpg} is illegal.
The references \filename{modelica://Modelica.Mechanics/C.jpg} and \filename{modelica://Modelica/C.jpg} must also refer to two distinct resources.
\filename{modelica:/Modelica.Mechanics/C.jpg} is legal, while
\filename{modelica:/Modelica/Mechanics/C.jpg} is illegal.
The references \filename{modelica:/Modelica.Mechanics/C.jpg} and \filename{modelica:/Modelica/C.jpg} must also refer to two distinct resources.
\end{example}

0 comments on commit 0769379

Please sign in to comment.