Help:Gadget-Easy LST

From Wikisource
Jump to navigation Jump to search
Easy LST gadget

Shortcut:
H:EASYLST

Easy LST is a Gadget which helps simplify the syntax for Labelled Section Transclusion (LST).

This gadget is enabled by default.

LST syntax[edit]

Natively (without this gadget), Labelled Section Transclusion looks like this in the Wikitext:

<section begin="s1" />
Section 1 Text
<section end="s1" />
<section begin="s2" />
Section 2 Text
<section end="s2" />

If the start and end tags do not match, the page may not transclude correctly. Easy Section Syntax handles the tag open and closing and changes the syntax to:

## s1 ##
Section 1 Text
## s2 ##
Section 2 Text

This makes it much less likely the tags are mis-matched, which can cause silent transclusion errors.

Configuration[edit]

By default, the Easy Section Syntax gadget is enabled. You can turn it of full in your gadget preferences, or you can selectively disable it though the configuration method.

You can configure the Easy Section Syntax gadget using the easy_section_syntax.config hook and passing a configuration object.

Example[edit]

{
  // Disable Easy Section Syntax on DNB pages
  var use_easy_ss_on_this_page = !mw.config.get("wgTitle").startsWith("Dictionary of National Biography");

  var easySectionSyntaxConfig = {
    enabled: use_easy_ss_on_this_page,
  };

  // send configuration
  mw.hook("easy_section_syntax.config").fire(easySectionSyntaxConfig);
}

There are the following options that you can pass into the configuration hook:

  • enabled: set to false to disable the gadget
  • debug: set to true to output some extra logging

Technical details[edit]