Extension:ScratchBlocks
ScratchBlocks Release status: stable |
|
---|---|
File:ScratchBlocks4 Example.png | |
Implementation | Tag |
Description | A simple extension for rendering Scratch blocks. |
Author(s) |
|
MediaWiki | 1.17+ |
License | MIT License |
Download | GitHub:
<translate> Note:</translate> |
Example | https://scratchblocks.github.io - A sample page for experimenting with the Scratchblocks syntax. |
scratchblocks, sb |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
ScratchBlocks is an extension to display Scratch, a programming language created by MIT, in wiki blocks.
Installation
- <translate> <tvar name=1>Download</tvar> and place the file(s) in a directory called <tvar name=name>
ScratchBlocks
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'ScratchBlocks' );
- Configure languages if needed.
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Configuration
By default, only English Scratch blocks are rendered. Add more languages like so:
$wgScratchBlocks4Langs = ['ja', 'zh_TW'];
Note that the TW is preceded by an underscore, not a hyphen. This variable is accessible through JS mw.config.get("wgScratchBlocks4Langs")
Usage
There are two ways to create a snippet of Scratch blocks, 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!
Both tags take a version
attribute, whose default value is 3. If specified as 2, the tag will render its blocks in Scratch 2.0 style.
For information on how to write ScratchBlocks code, visit https://en.scratch-wiki.info/wiki/Block_Plugin/Syntax.
See also
File:OOjs UI icon information-progressive.svg | <translate> This extension is included in the following wiki farms/hosts and/or packages:</translate>
<translate> This is not an authoritative list.</translate> <translate> Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.</translate> <translate> Always check with your wiki farms/hosts or bundle to confirm.</translate> |
- Pages with script errors
- Pages with broken file links
- Stable extensions
- Tag extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- MIT licensed extensions
- Extensions in GitHub version control
- ParserFirstCallInit extensions
- ResourceLoaderGetConfigVars extensions
- All extensions
- Extensions not in ExtensionJson
- Syntax highlighting extensions