summaryrefslogtreecommitdiff
path: root/doc/yelp-xsl/C/mal2html.ui.links.img.page
blob: 7c24c7ae2ecc3367ae75f8f2c02afbc95fbaf563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" style="xslt-template" id="mal2html.ui.links.img">
 <info>
  <link type="guide" xref="mal2html-ui" group="templates"/>
  <link type="guide" xref="templates" group="mal2html"/>
  <desc>Output an image for a link using UI thumbnails.</desc>
  <revision version="3.28" date="2017-08-11" status="final"/>
 </info>
 <title>mal2html.ui.links.img</title>
 <synopsis>
  <title>Parameters</title>
  <terms>
   <item>
    <title><code>$node</code></title>
    <p>A <sys>links</sys> element to link from.</p>
   </item>
   <item>
    <title><code>$thumbs</code></title>
    <p>A list of candidate <sys>uix:thumb</sys> elements.</p>
   </item>
   <item>
    <title><code>$role</code></title>
    <p>A link role, used to select the appropriate thumbnail.</p>
   </item>
   <item>
    <title><code>$width</code></title>
    <p>The width to fit thumbnails into.</p>
   </item>
   <item>
    <title><code>$height</code></title>
    <p>The height to fit thumbnails into.</p>
   </item>
  </terms>
 </synopsis>
 <p>This template selects the best-fit thumbnail from <code>$thumbs</code>, based on how well
 the aspect ratio and dimensions of each image matches the <code>$width</code> and <code>$height</code>
 parameters. It outputs an HTML <sys>img</sys> element for the best-fit thumbnail. It
 calls <code>$mal2thml.ui.links.img.src</code> to output the <sys>src</sys> attribute, and calls
 <code>$mal2html.ui.links.img.attrs</code> to output <sys>width</sys> and <sys>height</sys> attributes.</p>
 <p>Before checking for a best-fit thumbnail on dimensions, this template first
 looks for <sys>uix:thumb</sys> elements with the <sys>type</sys> attribute set to <sys>"links"</sys>.
 Within those, it looks for <sys>uix:thumb</sys> elements whose <sys>role</sys> attribute
 matches the <code>$role</code> parameter. This is similar to how link titles are
 selected.</p>
 <p>If the <code>$thumbs</code> parameter is empty, this template attempts to use a default
 thumbnail provided by a <sys>uix:thumb</sys> child element of <code>$node</code>.</p>
 <p>The <code>$width</code> and <code>$height</code> parameters can be computed automatically from the
 <code>$node</code> element.</p>
 <list style="compact">
  <title>Calls Parameters</title>
  <item>
   <p><link xref="mal.cache"/></p>
  </item>
 </list>
 <list style="compact">
  <title>Calls Templates</title>
  <item>
   <p><link xref="mal2html.ui.links.img.attrs"/></p>
  </item>
  <item>
   <p><link xref="mal2html.ui.links.img.src"/></p>
  </item>
 </list>
</page>