Tips and examples of the Writeup text processing language

Printing a variable only if it exisits

If a variable does not exist, then printing it produces an error. There are several methods of getting around this.

  • We will start by setting $hasval to Has a Value, and not setting $noval
  • Our test line will be: Testing ($noval) and ($hasval)

Version 2.51 Released

Writeup version 2.51 has just been released on

As well as a few minor bug fixes, there is a new option: -c --close which will silently close open tags at the end of a document.

This is important for the Drupal integration project since teasers are usually created by chopping off much of the document, and so possibly creating some unclosed structures.

Version 1.5 of the Drupal project integrates with Writeup vers

Writing a Factory Function

A factory function creates other functions.

  • Suppose we want a function that creates links to Drupal project pages. It will allow us to refer to the project writeup using $writeup by creating the definition:
    $writeup=[[https://www.drupal.org/project/writeup writeup]]

Exploring the different kind of assignments

  1. Whole-line assignments $x=value
    Note that any quotations will not be removed but included as part of the value
  2. Inline assigments using $set $set $x=value
  3. Inline assigments using $set $set $x="value" with value in quotations
  4. Inline assigments using $setval $setval $x=value with or without quotations
  • If the assigned value does not contain variables that can be evaluated, then all three methods produce identical answers.

A. the assigned value is a single variable

Syndicate content