Newer
Older
labs / tiddlers / system / macros / $__ou_macros_MenuKeys.tid
created: 20211210082237977
modified: 20211210082511034
tags: $:/tags/Macro
title: $:/ou/macros/MenuKeys
type: text/vnd.tiddlywiki

\define keys(path)
<$list filter="[[$path$]split[>]trim[]first[]]"><kbd><<currentTiddler>></kbd></$list>
<$list filter="[[$path$]split[>]trim[]rest[]]"> +&nbsp;<kbd><<currentTiddler>></kbd></$list>
\end

\define menu(path)
<$list filter="[[$path$]split[>]trim[]first[]]"><kbd><<currentTiddler>></kbd></$list>
<$list filter="[[$path$]split[>]trim[]rest[]]"> &#x276D;&nbsp;<kbd><<currentTiddler>></kbd></$list>
\end

\define path(path)
<kbd>{{$:/core/images/folder}} $path$</kbd>
\end

\define folder(path)
<kbd>{{$:/core/images/folder}} $path$</kbd>
\end


\define file(path)
<kbd>{{$:/core/images/file}} $path$</kbd>
\end

!Usage:

!!UI navigation
```
<<menu "File > New File > Blob">>
```
<<menu "File > New File > Blob">>

!!! Using the right angle bracket

Since the right angle bracket is used as a separator, you can't use it for display purposes.  The Unicode "full width" variant can be used instead.  It is identical except for a little bit of extra padding around the edges:

<span style="font-size:20pt">></span>

https://www.compart.com/en/unicode/U+FF1E

Example:  Click the <<menu "Next >">> button.

!! Keyboard shortcuts
```
<<keys "Ctrl > Alt > 7">>
```
<<keys "Ctrl > Alt > 7">>

!! Paths/Folders

Note that the `path` and `folder` macro are identical.

```
<<path "Documents/Projects">>

or

<<folder "Documents/Projects">>
```
<<path "Documents/Projects">>


You can use both forward and back slashes, and colons in the path, so can represent file paths in all operating systems:

<<path "~/Documents">>
<<path "H:\Documents">>

!! Files

```
<<file "Documents/Lab1/lab1.pdf">>
```
<<file "Documents/Lab1/lab1.pdf">>

You can use both forward and back slashes, and colons in the path, so can represent file paths in all operating systems:

<<file "~/Documents/Lab01/file.txt">>
<<file "H:\Documents\Lab01\file.txt">>


! NOTE

Be careful with spaces after the string parameter when using Markdown (the markdown parser in use is a bit fragile).  The following will render correctly using Wikitext tiddlers:

```
<<menu "A > B > C" >>
```

but will fail with Markdown tiddlers.

To be safe, don't use a trailing space:

```
<<menu "A > B > C" >> # BAD
<<menu "A > B > C">>  # OK
```