How to publish Packages, LibApps, and Modules

LibX 2.0 packages, libapps, and, modules are published using the Atom publishing protocol specified in RFC 5023. This document describes how.

Each package, libapp, or module corresponds to an <atom:entry> element within an Atom feed. A feed may contain one or more entries.  Any mixture of packages, libapps, and modules can be served within one feed.

LibX 2.0 uses foreign markup elements from the http://libx.org/xml/libx2 namespace as described in Section 6, RFC 4287. These elements occur as children of a <atom:entry> element.

This document serves as external specification. The LibX client plugin will read Atom feeds as described in this specification.

Packages

LibX packages are collections of libapps and other packages. A package is denoted by a <libx:package> element, which may contain one or more <libx:entry> elements. Each <libx:entry> element must contain a ‘src’ attribute. This attribute is resolved relative to the URL contained in the <atom:id> of the entry.

For example:

{code src=http://libx.org/libx2/examples/package.xml lang=xml}

refers to http://libx.org/libx2/libapps/google, http://libx.org/libx2/libapps/amazon, and so on. 

Note that the package entry does not indicate whether its contained entries are themselves packages or libapps.

The <atom:content> element may contain a description that is displayed by other Atom processors, such as feed readers, but it is ignored by LibX.

LibApps

Libapps are a collection of modules. A libapp is denoted by a <libx:libapp> element, which may contain one or more <libx:entry> elements. Each <libx:entry> element must contain a ‘src’ attribute. This attribute is resolved relative to the URL contained in the <atom:id> of the entry. The referred entry must be a LibX module.

{code src=http://libx.org/libx2/examples/libapp.xml lang=xml}

This Libapp combines modules http://libx.org/libx2/libapps/findcoins and http://libx.org/libx2/libapps/linkcoinstoopenurl

In addition, Libapps may contain <libx:include> and <libx:exclude> clauses, as explained below.

Modules

A LibX module is the smallest unit. A <libx:module> may contain a number of clauses and a body.  For example,

{code src=http://libx.org/libx2/examples/module.xml lang=xml}

contains 2 modules, ‘findcoins’ and ‘linkcoinstoopenurl’, which contain <include>, <require>, and <guardedby> clauses, as well as a body.

The body of a module contains JavaScript code. For instance, the body of findcoins contains this code:

{code src=http://libx.org/libx2/examples/findcoins.js lang=js}

and linkcoinstoopenurl contains this body:

{code src=http://libx.org/libx2/examples/linkcoinstoopenurl.js lang=js}

Clauses

Clauses may occur as children of a <libx:module> or <libx:libapp> element. Each clause embeds character content. The following clauses are defined:

<libx:include> A JavaScript regular expression literal matching a URL or set of URLs. 

<libx:exclude> A JavaScript regular expression literal matching a URL or set of URLs.

<libx:require> Either a URL or a built-in alias.  Built-in aliases are translated by LibX.  For instance, ‘jquery’ may be translated to http://libx.org/libx2/libapps/scripts/jquery.js

<libx:guardedby> A template in JSON syntax.

By default, any clause may occur multiple times.  Depending on their meaning, their order may be significant.