This plugin allows to use external commands to modify documents during their computation

Usage:

$ stog --package stog.extern ...

Actions are defined in the .stog/config-extern configuration file. Each action has a name and associates a list of document types and a command. Here is an example of such a file:

{
  actions: [
    { name: "my-action", types: ["post", "page"], command: "cat" }
  ]
}

The dummy example above defines a new action my-action, with a command cat that will be applied on documents of type post or page. For each document matching the type condition, the command will be given on stdin the current XML content of the document and must output the result (valid XML) on stdout.

We also have to indicate when this action will take place. This is done in the .stog/config file, in variable levels:

{
  ...
  levels: [
    { module: "extern", levels: [("my-action", [1000])] }
  ]
}

Here, my-action will be applied at level 1000. The same action can be applied in various levels. And of course, several actions can be defined, with different commands and applied to different types of documents.