summaryrefslogtreecommitdiff
path: root/doc/yelp-xsl/C/html.sidebar.page
blob: 19c2aacbe84869f16815b031895217de0f0b2947 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/" id="html.sidebar" type="topic" style="xslt-template"><info><link type="guide" xref="html" group="templates"/><link type="guide" xref="templates" group="html"/><revision version="3.30" date="2018-06-10" status="candidate"/><desc>Output stock sidebars.</desc></info><title>html.sidebar</title><p>Output stock sidebars.</p>
  
  
  <synopsis><title>Parameters</title><terms>
    <item>
      <title><code>node</code></title>
      <p>The node a sidebar is being created for.</p>
    </item>
  </terms></synopsis>
  <p>This templates outputs left and right sidebars according to the components listed in <code style="xslt-param" xref="html.sidebar.left">html.sidebar.left</code> and <code style="xslt-param" xref="html.sidebar.right">html.sidebar.right</code>. It only outputs each sidebar if the corresponding parameters is not empty or the string <code>none</code>.</p>
  <p>This template is called inside the <code>main</code> element, before the <code>div.page</code> element, and before <code style="xslt-template" xref="html.sidebar.custom">html.sidebar.custom</code>. Note that even the right sidebar is placed before the <code>div.page</code> element. It is placed on the right using flexbox item reordering.</p>
  <p>To actually output the sidebar components, this template splits each parameter on whitespace using the EXSTL <code>str:split</code> function. It then applies the mode <code style="xslt-mode" xref="html.sidebar.mode">html.sidebar.mode</code> to each token, passing <code style="xslt-param">node</code> and the sidebar side as parameters. Extension stylesheets can add their own sidebar components by implementing that mode and matching a pattern like <code>token[. = 'name-of-token']</code>. You will then be able to use <code>name-of-token</code> in <code style="xslt-param" xref="html.sidebar.left">html.sidebar.left</code> or <code style="xslt-param" xref="html.sidebar.right">html.sidebar.right</code>.</p>
  <p>This stylesheet recognizes four tokens: <code>contents</code> and <code>sections</code>, and the special tokens <code>none</code> and <code>blank</code>. The <code>contents</code> token provides a table of contents for the entire document. It is handled by the <code style="xslt-template" xref="html.sidebar.contents">html.sidebar.contents</code> template, which uses the <code style="xslt-mode" xref="html.sidebar.contents.mode">html.sidebar.contents.mode</code> mode to allow different input formats to implement it. The <code>sections</code> token lists sections on the current page. It is handled by the <code style="xslt-template" xref="html.sidebar.section">html.sidebar.section</code> template, which uses the <code style="xslt-mode" xref="html.sidebar.sections.mode">html.sidebar.sections.mode</code> mode to allow different input formats to implement it.</p>
  <p>You can use the <code>none</code> token on its own, instead of the empty string, to completely turn off either sidebar. Use the <code>blank</code> token to output a sidebar without adding any components to it. This is useful, for example, to keep consistent margins. If an empty sidebar is output from the <code>blank</code> token, it will also have the CSS class <code>sidebar-blank</code> so you can style it differently.</p>
<list style="compact"><title>Calls Templates</title><item><p><link xref="_html.sidebar.sidebar"/></p></item></list><list style="compact"><title>Calls Parameters</title><item><p><link xref="html.sidebar.left"/></p></item><item><p><link xref="html.sidebar.right"/></p></item></list></page>