Extension:Snapblocks

Category:Extensions without a compatibility policyCategory:MIT licensed extensions
MediaWiki extensions manual
Snapblocks
Release status: stableCategory:Stable extensions
Implementation Tag Category:Tag extensions
Description Create Snap! blocks from text.
Author(s) ego-lay-atman-bay and R4356th
Latest version 1.3.1
MediaWiki Category:Extensions without MediaWiki version
License MIT License
Download Category:Extensions in GitHub version control
snapblocks, scratchblocks, sb
Category:All extensionsCategory:Extensions not in ExtensionJson

Snapblocks is an extension to display blocks from the Snap! programming language created by Jens Mönig and Brian Harvey in wiki articles. It is also a fork of the ScratchBlocks extension.

$wgSnapBlocksLangs = ['ja', 'zh_TW'];

Installation

Configuration

By default, only English Snap! blocks are rendered. Add more languages like so:

Note: currently translations are somewhat broken, and only include Scratch primitives. Note that the TW is preceded by an underscore, not a hyphen. This variable is accessible through JS mw.config.get("wgSnapBlocksLangs")

Usage

There are three ways to create a snippet of Snap! blocks, which are nearly identical.

  • Use <snapblocks> before and after your code to create a block level element displaying Snap code.
  • Use <scratchblocks> before and after your code to create a block level element displaying Snap! code. This is kept from the ScratchBlocks extension, in order to make transitioning to Snapblocks easier.
  • To create an inline-block element (that will show in the middle of the paragraph), enclose the code in <sb> tags.
<snapblocks>
repeat (5) {
  move (10) steps
}
say [Done!]
</snapblocks>
You can map over a list in Snap! with the <sb>(map (() @addInput) over @list)</sb> block.

All three tags take a version attribute, whose default value is snap. If specified as 2 or 3, the tag will render its blocks in Scratch 2.0 or 3.0 style respectively. You can also specify hc-3 for the Scratch 3.0 high contrast style, and snap-flat for the Snap! flat design.

For information on how to write Snapblocks code, visit https://snap-blocks.github.io/docs/writing-snapblocks.

See also

Category:Syntax highlighting extensions
Category:All extensions Category:Extensions in GitHub version control Category:Extensions included in Miraheze Category:Extensions not in ExtensionJson Category:Extensions without MediaWiki version Category:Extensions without a compatibility policy Category:MIT licensed extensions Category:ParserFirstCallInit extensions Category:ResourceLoaderGetConfigVars extensions Category:Stable extensions Category:Syntax highlighting extensions Category:Tag extensions