Extension:ScratchBlocks

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
ScratchBlocks
Release status: stable
ScratchblocksExtension.png
Implementation Parser function
Description A simple mediawiki extension for rendering Scratchblocks.
Author(s) Choco31415 and blob8108
Latest version 3.0
MediaWiki 1.10+
License MIT License
Download Github link
Example [1] - A sample page for experimenting with the Scratchblocks syntax.
scratchblocks, sb
Translate the ScratchBlocks extension if it is available at translatewiki.net
Check usage and version matrix.

ScratchBlocks is an extension to display Scratch, a programming language created by MIT, in wiki blocks.

Installation[edit]

If you clone from the repository, note that it uses Git submodules. When you git clone, make sure to include the --recursive option.

$ cd mediawiki/extensions
$ git clone --recursive http://github.com/tjvr/wiki-scratchblocks ScratchBlocks
  • Download and place the file(s) in a directory called ScratchBlocks in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'ScratchBlocks' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension(). If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'ScratchBlocks' );, you need to use:

require_once "$IP/extensions/ScratchBlocks/ScratchBlocks.php";

Configuration[edit]

None -- every language is enabled by default.

Usage[edit]

There are two ways to create snippet of Scratchblocks code, which are nearly identical.

  • Use <scratchblocks> before and after your code to create a block level element displaying Scratch code.
  • To create an inline-block element (that will show in the middle of the paragraph), enclose the code in <sb> tags.
 <scratchblocks>
 repeat (5)
 move (10) steps
 
 end
 say [Done!]
 </scratchblocks>
 You can repeat Scratch code in a <sb>forever</sb> loop!

For information on how to write Scratchblocks code, visit this link. (Warning, the page is outdated!)