Yelp » Features »

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

The Yelp viewer automatically sets the following platform tokens:

  • platform:gnome-shell

    • Set if a D-Bus service named org.gnome.Shell is running and a D-Bus service named com.canonical.Unity is not running. Use this token for GNOME 3. This will also be set in classic mode. To check for GNOME 3 not in classic mode, use "platform:gnome-shell !platform:gnome-classic". This will also be set for GNOME-3-derivative environments like Cinnamon.

      Added in 3.4

    platform:gnome-classic

    • Set if the Mode property of the org.gnome.Shell service is "classic". Use this token for GNOME 3 in classic mode.

      Added in 3.8.1

    platform:unity

    • Set if a D-Bus service named com.canonical.Unity is running. Use this token for Ubuntu's Unity environment.

      Added in 3.10

    platform:xfce

    • Set if a D-Bus service named org.xfce.Panel is running. Use this token for Xfce.

      Added in 3.4

    platform:gnome-panel

    • Set if a D-Bus service named org.gnome.Panel is running and a D-Bus service named org.gnome.Shell is not running. This token is set for GNOME 2, fallback mode in early GNOME 3 versions, and GNOME-2-derivative environments like Mate. There is currently no way of distinguishing between these environments.

      Added in 3.4

Yelp also sets target tokens, feature tokens, and action tokens as appropriate, in both the viewer and in build utilities like yelp-build. The Yelp viewer converts to XHTML internally, so the tokens target:html and target:xhtml will be set. For all HTML conversions, the token target:mobile can be used to provide different content when viewed on mobile devices. This is currently implemented with conditionally-shown content toggled by the screen size of the browser window.

DocBook

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

  • gnome-shell

    • Set if a D-Bus service named org.gnome.Shell is running and a D-Bus service named com.canonical.Unity is not running. Use this value for GNOME 3. This will also be set in classic mode and GNOME-3-derivative environments like Cinnamon.

      Added in 3.10

    gnome-classic

    • Set if the Mode property of the org.gnome.Shell service is "classic". Use this value for GNOME 3 in classic mode.

      Added in 3.10

    unity

    • Set if a D-Bus service named com.canonical.Unity is running. Use this value for Ubuntu's Unity environment.

      Added in 3.10

    xfce

    • Set if a D-Bus service named org.xfce.Panel is running. Use this value for Xfce.

      Added in 3.10

    gnome-panel

    • Set if a D-Bus service named org.gnome.Panel is running and a D-Bus service named org.gnome.Shell is not running. This value is set for GNOME 2, fallback mode in early GNOME 3 versions, and GNOME-2-derivative environments like Mate. There is currently no way of distinguishing between these environments.

      Added in 3.10

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.

Apps/Yelp/Features/Conditional (last edited 2013-11-20 02:56:55 by ShaunMcCance)