Can a block ever be empty?


I created a duplicate issue about this (#578)

I understand that it may be a good idea to remove extra whitespace in many use cases, but I really would prefer there be an option to load the extra whitespace accurately, especially when there's nothing in the documentation that refers to this behavior. My use case: I'm using DraftJS as an email composer, and I have a snippet menu that allows me to insert snippets into the editor.

When I initially create my snippets (with Draft), the HTML in the editor itself as well as the HTML I export from the editor (to save as the snippets in my database) includes
, which gets rendered as a blank line in the email.

When I try to insert then these snippets into the email composer, I'm using convertFromHTML and then inserting the result as a fragment. The problem is that the convertFromHTML function strips out these blank lines.

My current solution is to instead create fragments line by line, insert then, then split...

0 0

Horizontal reuse is an advanced Twig feature that is hardly ever needed in regular templates. It is mainly used by projects that need to make template blocks reusable without using inheritance.

Template inheritance is one of the most powerful features of Twig but it is limited to single inheritance; a template can only extend one other template. This limitation makes template inheritance simple to understand and easy to debug:

Horizontal reuse is a way to achieve the same goal as multiple inheritance, but without the associated complexity:

The use statement tells Twig to import the blocks defined in blocks.html into the current template (it's like macros, but for blocks):

In this example, the use statement imports the sidebar block into the main template. The code is mostly equivalent to the following one (the imported blocks are not outputted automatically):

The use tag only imports a template if it does not extend another template, if it does...

0 0

Active Stone Blocks and Inactive Stone Blocks are blocks that act as mechanisms, such that when they are wired, their presence can be switched on or off.

When triggered, an Active Stone Block becomes an Inactive Stone Block, and vice-versa. Wires must pass through all Active/Inactive blocks that are to be triggered, and the wires must connect to a trigger, such as a Pressure Plate, Switch, or Timer. These blocks are useful for creating traps, floodgates, hidden passages, drawbridges (eg. over water, lava, or empty space), skybridges, and much more.

While in their Active state, these blocks look and behave as ordinary Stone Blocks, inhibiting movement, allowing entities to stand or walk on them, blocking light, and containing liquids. When in their Inactive state, they are still visible, but look and behave instead as background Stone Wall tiles. They are essentially empty space, allowing the passage of players, items, liquids, light, etc.

Both the Active and...

0 0

This document, intended for advanced language designers, should give you the answers to the most common questions related to the MPS editor. You may also like to read the Editor documentation, which contains exhaustive information on the subject.


The RobotKaja sample project, which comes bundled with MPS, can serve you as a good example of how to build a fluent text-like projectional editor.

You may also like to check out a couple of screen-casts that focus on defining smooth editors:

How to properly indent a block of code

Nested blocks of code are typically represented using indented collections of vertically organized statements. In MPS you almost exclusively use indented layout for such collections, if you aim at making the experience as text-like as possible. Vertical and horizontal layouts should be only considered for positional or more graphical-like layouts.

So for properly indented code blocks you need to create an Indented...

0 0

Have you ever tried to explode a block, but it failed to explode? Starting in AutoCAD 2006, AutoCAD includes an option to prevent blocks from being exploded, as shown here.

If you try to explode a block that has been defined this way, you will receive the message “….could not be exploded”. But don’t fear, there is a way to fix this problem. Follow these steps.

Run the BLOCK command. You will get the same dialog as above except the drop-down list will be empty. Select the block in question from the drop down list Check ON the toggle labeled “Allow exploding” Press OK. You will get the following dialog box. Choose “Redefine block”.

Now you’ll be able to explode any block insertions of this particular block...

0 0