4. before-save
| Chapter 3. Commands which are specific to w2x |

## 4. before-save

    before-save(allow-flow?)

Command `before-save` is invoked in `xed/before-save.xed` at the very end of the edit step. It performs the following low-level operations:

1. If argument `allow-flow` is `false()` (defaults to `true()`), text and inline elements contained in flow elements are wrapped into a `<p class="role-inline-wrapper">` wrapper element. For example:

       <li>Hello <em>world</em>!</li>

   becomes:

       <li>
         <p class="role-inline-wrapper">Hello <em>world</em>!</p>
       </li>

   This operation greatly eases the generation of certain types of semantic XML (e.g. DocBook) during the transform step.

2. Adjacent inline elements having the same element type and the same attributes are merged. For example:

       <span class="role-mark">first, </span><span
       class="role-mark">second, </span><span
       class="role-mark">third</span>

   becomes:

       <span class="role-mark">first, second, third</span>

    before-save();

    before-save(false());

3. add-script |  | 5. parse-styles