Details Formatter
%%(details title="summary" open=1)%%
<details open> <summary>System Requirements</summary> <p>Requires a computer running an operating system. The computer must have some memory and ideally some kind of long-term storage. An input device as well as some form of output device is recommended.</p> </details>
formatter/highlight/details.php[link1]
<?php /* % %(details [title="Title"] [open=0|1] ) content % % */ if (!isset($options['title'])) $options['title'] = null; if (!isset($options['open'])) $options['open'] = 0; $title = $options['title'] ?? $this->_t('ShowHideDetails'); $open = $options['open'] ? ' open' : ''; echo '<ignore><details' . $open . '>' . "\n"; echo ($title ? '<summary>' . Ut::html($title) . '</summary>' . "\n" : ''); include Ut::join_path(FORMATTER_DIR, 'wiki.php'); echo "</details></ignore>\n";
Summary
The HTML Details Element (<details>
) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary>
element.A disclosure widget is typically presented onscreen using a small triangle which rotates (or twists) to indicate open/closed status, with a label next to the triangle. If the first child of the
<details>
element is a <summary>
, the contents of the <summary>
element are used as the label for the disclosure widget.
Remarks
- The Formatter does not support nesting. A formatter cannot invoke another formatter by design.
- formatter + wrapper
- it can be done via inline HTML, but this is rather inconvenient because you can't nest wiki syntax in between the
<details>
tags, the HTML SAX parser would close your<details>
tag with</details>
in advance
Links
- The details and summary elements[link2]
- <details>: The Details disclosure element[link3]
- https://html.spec.whatwg.org/#the-details-element
- https://caniuse.com/#feat=details
- [link1] https://bitbucket.org/wackowiki/wackowiki/src/master/src/formatter/highlight/details.php
- [link2] http://html5doctor.com/the-details-and-summary-elements/
- [link3] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details