DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:keyboard

This is an old revision of the document!


keyboard Plugin

Compatible with DokuWiki

2006-03-09, 2006-11-06, 2009-12-25 "Lemming", 2010-11-07 "Anteater", 2011-05-25 "Rincewind", "Angua", 2014-09-29 "Hrun", "Detritus"

plugin Marks text as keyboard keys

Last updated on
2016-04-23
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with keyboard, odt, pdf

Should work as-is, no longer actively maintained by original author.

Works well with the dw2pdf plugin and the odt plugin.

Usage

Use the tag <key> to mark some text as keyboad keys. E.g.:

This displays the keys <key>ALT</key> + <key>H</key>.

This will create the following output:


Example screenshot


Alternatively the tag <kbd> can be used in accordance to the HTML element:

This displays the keys <kbd>ALT</kbd> + <kbd>H</kbd>.

Short form

The shorter form to write the key combination ALT+H is:

This displays the keys <kbd>ALT+H</kbd>.

Separator signs for the short form can be + or -. In both cases the rendered sign between the keys will be a +. So in general it does not make a difference if + or - is used. But it does make a difference if you want to include a + or - as a key and not as a separator. If you would like to render the key combination ALT++ then you should write:

<kbd>ALT-+</kbd>

If you would like to render the key combination ALT+- then you should write:

<kbd>ALT+-</kbd>

Development

Add LaTeX support

You can enhance this plugin to be used with different LaTeX export plugins. Otherwise the LaTeX export will (most likely) simply skip/ignore the keys.

dokutexit support

If you want to use this package with dokutexit, you can easily add latex-support: add the following after line 105 in “syntax.php”:

add-this-for-dokutexit-support.php
        if ($mode == 'latex') {
            list($state, $match) = $data;
            switch ($state) {
                case DOKU_LEXER_ENTER :
                    $renderer->doc .= '\framebox{';
                    break;
                case DOKU_LEXER_UNMATCHED :
                    foreach ($match as $key) {
                        if (substr($key, 0, 1) == "'" and
                          substr($key, -1, 1) == "'" and
                          strlen($key) > 1) {
                            $out[] = $renderer->_xmlEntities(substr($key,1,-1));
                        } else {
                            if (isset($lang[$key])) {
                                $out[] = $lang[$key];
                            } else {
                                $out[] = $renderer->_xmlEntities(ucfirst($key));
                            }
                        }
                    }
                    $renderer->doc .= implode('} + \framebox{', $out);
                    break;
                case DOKU_LEXER_EXIT :
                    $renderer->doc .= '}';
                    break;
            }
            return true;
        }

latexit support

If you want to use this package with latexit, add the following after line 105 in “syntax.php”:

add-this-for-latexit-support.php
        if ($mode == 'latex') {
            list($state, $match) = $data;
            switch ($state) {
                case DOKU_LEXER_ENTER :
                    $renderer->doc .= '\framebox{';
                    break;
                case DOKU_LEXER_UNMATCHED :
                    foreach ($match as $key) {
                        if (substr($key, 0, 1) == "'" and
                          substr($key, -1, 1) == "'" and
                          strlen($key) > 1) {
                            $out[] = $renderer->_latexSpecialChars(substr($key,1,-1));
                        } else {
                            if (isset($lang[$key])) {
                                $out[] = $lang[$key];
                            } else {
                                $out[] = $renderer->_latexSpecialChars(ucfirst($key));
                            }
                        }
                    }
                    $renderer->doc .= implode('} + \framebox{', $out);
                    break;
                case DOKU_LEXER_EXIT :
                    $renderer->doc .= '}';
                    break;
            }
            return true;
        }

Translations

The plugin is available in the languages german, english, french, korean and chinese.

Issues/Requests

Please report any issues or requests on the GitHub issue tracker.

plugin/keyboard.1461952832.txt.gz · Last modified: 2016-04-29 20:00 by LarsDW223

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki