Subsection 4.28.2 Data URLs
A
<dataurl>
element is very similar to the <url>
element just described. The purpose is to point to an actual file that will be of use to your readers. What actual happens when a reader clicks on it is dependent on the format of the PreTeXt output and that reader’s environment. Maybe the file will be downloaded, or maybe a particular application will open the file. That part is out of our hands. Use an @href
attribute in the same way as for <url>
, and the content and the @visual
attribute also behave similarly.The one key differerence is that you can also use a
@source
attribute in place of @href
and point to a file that you provide as part of your project (not unlike providing a photographic image via the <image>
element). Place the file in your collection of external files (see Section 5.6) and provide the path to your file from below the directory of external files in the @source
attribute. For HTML output, PreTeXt will do the rest. For more static formats, you can set a base URL (see Subsection 44.4.2) and you will get a complete URL that points to the instance of your file hosted with the rest of your HTML output.Notice that this element provides limited functionality, at best just a hyperlink to a file. For data files that you want a reader’s in-browser computer program to process, read about the
<datafile>
element at Section 4.16.