<ulclass="crumbs"><li><ahref="../index.html">Home</a></li><li><ahref="../services.html">Services</a></li><li><ahref="index.html">html</a></li><li><ahref="index.html#P">Preliminaries</a></li><li><b>What This Module Does</b></li></ul></div>
<ulclass="toc"><li><ahref="P-wtmd.html#SP1">§1. Prerequisites</a></li><li><ahref="P-wtmd.html#SP2">§2. Purpose</a></li><li><ahref="P-wtmd.html#SP3">§3. Custom HTML link protocols</a></li><li><ahref="P-wtmd.html#SP5">§5. Localisation</a></li></ul><hrclass="tocbar">
<pclass="commentary firstcommentary"><aid="SP1"class="paragraph-anchor"></a><b>§1. Prerequisites. </b>The html module is a part of the Inform compiler toolset. It is
full details, but essentially: it's C without predeclarations or header files,
and where functions have names like <spanclass="extract"><spanclass="extract-syntax">Tags::add_by_name</span></span> rather than <spanclass="extract"><spanclass="extract-syntax">add_by_name</span></span>.
<pclass="commentary firstcommentary"><aid="SP2"class="paragraph-anchor"></a><b>§2. Purpose. </b>Many functions of the Inform toolset involve the generation of HTML in some
and such, see <ahref="../../../inweb/foundation-module/5-htm.html"class="internal">HTML (in foundation)</a> and <ahref="../../../inweb/foundation-module/5-ee.html"class="internal">Epub Ebooks (in foundation)</a>. All of that
<pclass="commentary firstcommentary"><aid="SP3"class="paragraph-anchor"></a><b>§3. Custom HTML link protocols. </b>This seems a useful place to document something which the Inform GUI apps
must provide. These render index, problem and extension mini-website pages
in embedded web browser views: for example, Inform on MacOS is essentially
running a copy of Safari (or rather, its underlying engine WebKit) under
the hood to display these. The material displayed consists of standard web
pages, except that there are two custom "transport protocols" or "URL schemas".
</p>
<pclass="commentary">Protocols like this go under a number of names, partly because there are many
subtly different ideas here which only experts can distinguish (see
<ahref="https://en.wikipedia.org/wiki/Application_layer"class="external">https://en.wikipedia.org/wiki/Application_layer</a> for the entrance to the
rabbit-hole). To us, anyway, protocols are the prefixes of URLs which end
with a colon — all browsers recognise a standard set of these, of which <spanclass="extract"><spanclass="extract-syntax">http:</span></span>
<spanclass="extract"><spanclass="extract-syntax">https:</span></span> and <spanclass="extract"><spanclass="extract-syntax">file:</span></span> are by far the most commonly used.
</p>
<pclass="commentary">Inform uses two non-standard ones in these internal pages, and so the GUI app
must implement them for its embedded web engine:
</p>
<ulclass="items"><li>(a) <spanclass="extract"><spanclass="extract-syntax">source:</span></span> is used in link <spanclass="extract"><spanclass="extract-syntax">href</span></span>s to make source text references — see <ahref="2-sl.html"class="internal">Source Links</a>;
</li><li>(b) <spanclass="extract"><spanclass="extract-syntax">inform:</span></span> is used both for links to internal or external pages generated
by Inform, and also for image <spanclass="extract"><spanclass="extract-syntax">src</span></span>s. It behaves just like <spanclass="extract"><spanclass="extract-syntax">http:</span></span>, except
that it derives the location of a file from the given URL in a different way.
<pclass="commentary firstcommentary"><aid="SP4"class="paragraph-anchor"></a><b>§4. </b>The reason <spanclass="extract"><spanclass="extract-syntax">inform:</span></span> is needed is that HTML files generated by Inform have
no way to know the relative URLs necessary to access e.g. icon images for
the World index, which will be in different places in the file system on
different Inform apps. More formally, the specification of <spanclass="extract"><spanclass="extract-syntax">inform:</span></span> is that —
</p>
<ulclass="items"><li>(a) <spanclass="extract"><spanclass="extract-syntax">inform://...</span></span> is interpreted as a reference to one of the built-in images,
i.e., to wherever the app has internally stashed the Inform distribution's
directory <spanclass="extract"><spanclass="extract-syntax">resources/Imagery</span></span>. Barring errors in Inform, or in the app, this
should never 404.
</li><li>(b) For any path <spanclass="extract"><spanclass="extract-syntax">*</span></span>, <spanclass="extract"><spanclass="extract-syntax">inform://Extensions/*</span></span> should be fetched as <spanclass="extract"><spanclass="extract-syntax">*</span></span> in the
external resources area — that is, the place to which the app is installing
new extensions. If no file was found, the link should simply do nothing:
the application is required not to produce a 404 error page, or to
<pclass="commentary firstcommentary"><aid="SP5"class="paragraph-anchor"></a><b>§5. Localisation. </b>This module also contains a very simple system for "localisation" of text,
that is, enabling the user to output text in multiple human languages. (Inform
makes heavy use of this in the Index.) This may not appear at first to have
anything to do with HTML, but in fact we will mainly use it when generating
web pages in the Index, so it has some conveniences for stylistic markup as well.
</p>
<pclass="commentary">See <ahref="2-lcl.html"class="internal">Localisation</a> for details.