Yelp

(The Help System)

Conditional Processing

Yelp supports conditional processing in both Mallard and DocBook. The Yelp viewer automatically determines information about the environment and sets test tokens or profiling values at run time. This allows a single document to be packaged for multiple systems and displayed correctly based on the reader's environment.

Mallard

Mallard conditional processing is handled by the Mallard Conditionals extension. Mallard Conditionals allows you to string together test tokens in a test expression. The Yelp stylesheets, tools, and viewer all set certain tokens, and you can set your own with the mal.if.custom parameter.

The Yelp viewer automatically sets the following platform tokens:

platform:gnome-3

Set for standard GNOME 3. Not set for GNOME 3 Classic or any known derivative environments of GNOME 3. Note that the platform:gnome-shell token will also be set if this token is set.

Added in 3.18

platform:gnome-shell

Set in any environment using GNOME Shell, including GNOME 3, GNOME 3 Classic, Cinnamon, Elementary Pantheon, and Endless.

Added in 3.4

platform:gnome-classic

Set for GNOME 3 Classic, an environment using GNOME 3 technologies but modified to look more like a traditional GNOME desktop. This is not the same as the fallback mode that shipped with early versions of GNOME 3. Note that the platform:gnome-shell token will also be set if this token is set.

Added in 3.8.1

platform:gnome-panel

Set in any environment that uses the GNOME 2 panel, including GNOME 2 and MATE, as well as the fallback mode shipped in early versions of GNOME 3.

Added in 3.4

platform:cinnamon

Set for the Cinnamon desktop environment, which is based off of GNOME 3. Note that the platform:gnome-shell token will also be set if this token is set.

Added in 3.18

platform:kde

Set for any version of the KDE desktop environment.

Added in 3.18

platform:mate

Set for the MATE desktop environment, which is based off of GNOME 2. Note that the platform:gnome-panel token will also be set if this token is set.

Added in 3.18

platform:pantheon

Set for the Pantheon desktop environment that is part of Elementary, which is based off of GNOME 3. Note that the platform:gnome-shell token will also be set if this token is set.

Added in 3.18

platform:unity

Set for the Unity desktop environment that is part of Ubuntu.

Added in 3.10

platform:xfce

Set for any version of the Xfce desktop environment.

Added in 3.4

platform:distro
platform:distro-version

Set based on the os-release file. The distro name is taken from the ID field. For example, on Fedora, the token platform:fedora is set. The version is taken from the VERSION_ID field. For example, on Fedora 21, the token platform:fedora-21 is set.

Added in 3.18

The Yelp stylesheets set feature tokens based on supported features. See Mallard Features in Yelp for more information.

The Yelp stylesheets set target tokens depending on the target format.

target:html

Set for all HTML targets, including XHTML.

target:xhtml

Set only for the XHTML serialization of HTML, in addition to the target:html token.

target:mobile

Set as a maybe value for all HTML transforms to allow responsive content. Any content marked with target:mobile will only be displayed on mobile platforms. Any content marked with !target:mobile will only be displayed on non-mobile platforms. Yelp uses CSS media queries on screen size to determine when to display content.

target:epub

Set for EPUB transformations when using yelp-build epub. EPUB contains XHTML files, so target:html and target:xhtml will also be set.

DocBook

The Yelp viewer automatically sets the following profiling values to match against with the os attribute:

gnome-3

Set for standard GNOME 3. Not set for GNOME 3 Classic or any known derivative environments of GNOME 3. Note that the gnome-shell value will also be set if this value is set.

Added in 3.18

gnome-shell

Set in any environment using GNOME Shell, including GNOME 3, GNOME 3 Classic, Cinnamon, Elementary Pantheon, and Endless.

Added in 3.4

gnome-classic

Set for GNOME 3 Classic, an environment using GNOME 3 technologies but modified to look more like a traditional GNOME desktop. This is not the same as the fallback mode that shipped with early versions of GNOME 3. Note that the gnome-shell value will also be set if this value is set.

Added in 3.8.1

gnome-panel

Set in any environment that uses the GNOME 2 panel, including GNOME 2 and MATE, as well as the fallback mode shipped in early versions of GNOME 3.

Added in 3.4

cinnamon

Set for the Cinnamon desktop environment, which is based off of GNOME 3. Note that the gnome-shell value will also be set if this value is set.

Added in 3.18

kde

Set for any version of the KDE desktop environment.

Added in 3.18

mate

Set for the MATE desktop environment, which is based off of GNOME 2. Note that the gnome-panel value will also be set if this value is set.

Added in 3.18

pantheon

Set for the Pantheon desktop environment that is part of Elementary, which is based off of GNOME 3. Note that the gnome-shell value will also be set if this value is set.

Added in 3.18

unity

Set for the Unity desktop environment that is part of Ubuntu.

Added in 3.10

xfce

Set for any version of the Xfce desktop environment.

Added in 3.4

distro
distro-version

Set based on the os-release file. The distro name is taken from the ID field. For example, on Fedora, the value fedora is set. The version is taken from the VERSION_ID field. For example, on Fedora 21, the value fedora-21 is set.

Added in 3.18

Yelp does not perform a pre-processing filter for conditional processing in DocBook. Rather, the profiling is done by the XSLT templates at transformation time. Consequently, Yelp only supports conditional processing on a subset of DocBook elements. Generally, conditional processing works on all block-level and inline elements.