rcc

rcc – RDFa content compiler

rcc [-d datatype]

The rcc command builds individual pieces of content. Input is file , formatted as RDFa Lite. Content is printed to stdout and is built using a selection of customizable mustache.5 templates.

All standard templates use properties from the schema.org types Thing , CreativeWork and SoftwareApplication . This makes rcc a great tool for publishing personal websites, blogs and software documentation in multiple formats. See rdfaprimer.7 for an introduction to RDFa Lite.

The options are as follows:

-d datatype
Data type that string literals should be formatted as. Valid arguments are html , man , md or empty which will render properties as plain strings. Default value is empty.
Localization

rcc is able to manage content translated to multiple languages if (i) your templates are translated and (ii) your content language is annotated correctly in RDFa Lite properties.

Templates are identified as name.language with a dot separating the template name and the intended language. A real example would be the blog.en template.

RDFa Lite content can make use of two important localization features (i) annotating its own language with the lang property and (ii) linking between translations using the two properties below. See schema.org for more information.

schema:workTranslation
Used on original work for linking to its translations.
schema:translationOfWork
Used on translations of original work for linking back.
Templates

rcc is using mustache.7 as its templating language. When an RDFa Lite document is processed, each individual property becomes available as a normal variable in any template its rendered with.

Given the following simple RDFa Lite document:

<article typeof="schema:webpage" resource="bonjour.html" lang="fr">
<h1 property="schema:headline">Bonjour monde</h1>
<p property="schema:abstract">Bienvenue sur mon site</p>
<p>Éteignez votre ordinateur!</p>
</article>

The following normal variables will be available:

{{schema.headline}}
With the value "Bonjour monde".
{{schema.abstract}}
With the value "Bienvenue sur mon site".

Additionally, three special variables will always be available:

{{schema.inLanguage}}
Derived from the lang attribute with the value "fr".
{{schema.webpage}}
Derived from the typeof attribute with the value "1".
{{_base}}
Populated with the value of the BASE environment variable.
{{_main}}
With the full HTML body as its value, even including HTML elements without RDFa Lite attributes.

There are two kinds of templates (i) those meant to build single piece of content (ii) those meant to build lists of content. List templates are used by rcclist.1 come in pairs of two, for example blog and blog.item . The former is the wrapping template and the latter is the template for each individual item in the list.

Below is the list of standard templates. Unless specified, all templates will render content with the schemas CreativeWork or Thing .

Single templates
html
Renders a basic HTML page.
man
Renders a Unix manual page formatted with mdoc.7 for a SoftwareApplication .
readme
Renders a README file formatted with markdown.7 for a SoftwareApplication .
xml
Renders the header for a XML page.
List templates
blog
Renders an HTML list of blog posts.
feed
Renders an Atom XML syndication feed.
index
Renders an unordered HTML item list.
sitemap
Renders an XML sitemap feed.
terms
Renders a plain HTML list of terms and descriptions.
Build system

rcc comes with a simple content build system based on make.1 . This system will build content automatically for a few common scenarios, without the user having to interact with rcc at all.

Website content

For a simple website, a Makefile like the sample below should be placed at the document root of the website:

DOMAIN= www.example.com
.include <rcc.html.mk>
.include <rcc.blog.mk>
.include <rcc.feed.mk>

The rcc.html.mk file provide the base functionality with all common make.1 targets for building HTML pages. Content is treated in two ways (i) posts authored as plain markdown.7 documents and (ii) pages authored as RDFa Lite documents. Posts are any file ending with *.md . Pages are any file ending with *.rdfa . In practice, the only difference between these two is that posts go through an extra build step for processing the markdown to RDFa Lite. From that point all files are equal.

Environment

The following environment variables affect the execution:

BASE
Sets the value of in the template variable {{_base}} . To be used for embedding the base URL of a website in templates.

Examples

Given doc.rdfa is a description of a CreativeWork , then the following command will produce a basic web page using the html.en template.

$ rcc -t html.en doc.rdfa

Given tool.rdfa is a description of a SoftwareApplication , then the following command will produce a suitable web page using the software.en template.

$ rcc -t software.en tool.rdfa

Create a pipeline converting post.md from markdown, to html, to RDFA Lite and render a simple web page using the default template. This example is using lowdown.1 to process markdown, and triple-rdfa.1 to enrich the plain HTML with RDFa Lite terms from the schema.org vocabulary.

$ lowdown post.md | triple-rdfa | rcc

Caveats

Due to a limitation in how triple-turtle.1 currently parses HTML, it's required to have at least one non-void element before a mustache.7 partial tag appear in the body.