Documentation

Please check out the manpage.

Installation

First, you need to install the schreib command, running git clone git://git.gpcf.eu/schreib.git && cd schreib && make install. To create a web site, cd into the directory where you want to have your website and run schreib i.

Adding pages

To add a page to the site, run schreib a page, where page is the path where the page should be created. For example, if I want to create a page about the GNU operating system, I would run schreib a gnu. This command creates a directory called gnu and then creates a file called index.in.md inside it. It then calls your favorite editor (the one stored in your $EDITOR variable) to edit the page. If you want to edit the page later, simply call schreib a page again.

Building a website

Simply call schreib b from somewhere inside your website directory.

Deploying (publishing) a website

First, you need a script called schreibdeploy.sh in your website's root directory that copies the output/ directory to your server. Then simply run schreib d and your website gets uploaded to your server.

Multilingual files

Schreibblockade includes a system called dislines, implemented in python based on the original implementation in perl. Dislines separates a file into several files, depending on how the lines are tagged, for example if a line is in English you should write

@en This line is in English

to write This line is in English to the file that contains English text.

The @ has to be the first character in a line, otherwise it will not be recognized as a language tag. If you have several lines in the same language, you can mark blocks. Blocks start with @[tag]{ and end with @}. Blocks cannot be nested. For example, you could also write:

@en{
This line is in English.
This line is also in English.
@}

You can also say that a line or a block is in several languages, separating the tags with a comma:

@en,de{
This strange paragraph is in English and German
@}
@en,de This line is also strange.

You may not separate the tags with spaces or include spaces before the bracket. For example,

@en, de {
foo
@}
@ en This line is a test
@en,de {
another line
@ }

all do not produce the desired effect.

Lines without a tag are common to all languages, but the file must contain at least one tag. Here is an example:

@en{
Run the following command to see a cow:
@}
@de Führen Sie folgenden Befehl aus, um eine Kuh zu sehen:
     apt-get moo

This would create two files: one for English, one for German. The English file would contain:

Run the following command to see a cow:
    apt-get moo

The contents of the german file would be:

Führen Sie folgenden Befehl aus, um eine Kuh zu sehen:
    apt-get moo

You can use markdown to format the page.

You can use @" (with any number of "s) to repeat a tag. For example the code

@en Emacs is a great editor
@" it is used to edit this site

it is equivalent to

@en Emacs is a great editor
@en it is used to edit this site

The repetition syntax cannot be used for blocks.

A line starting with @- that is not inside a block will be discarded. You can use any number of @s or -s.

If you want to write a @ at the beginning of a line, you should either put a space in front of it or if you are not inside a block, you can put a @ followed by a space. For example,

@ @en English

becomes

@en English

If there are any spaces before the @, you do not have to do anything.

In all the commands listed above, you can write any number of @s. Of course, you can edit the source code of the dislines.awk script to make it fit your purposes.

Web server configuration

The script generates several files from every index.md file it found. If, for instance, a website is in German, English, Esperanto and Spanish (like this one), a index.in.md file that contains text in every one of these languages, is transformed into index.de.html, index.es.html, index.eo.html and index.en.html. You need to set the index pages in your webserver to display the right language. In lighttpd, which powers this website, if you add something like this to /etc/lighttpd/lighttpd.conf,

server.document-root = "/path/to/your/website"
$HTTP["host"] == "en.$YOURDOMAIN" {
    index-file.names = ( "index.en.html" )
}
$HTTP["host"] == "es.$YOURDOMAIN" {
    index-file.names = ( "index.es.html" )
}

if you access en.$YOURDOMAIN, you see the English version of your site, and if you access es.$YOURDOMAIN you should see the Spanish version. Note that you always access the same directory, so it is very easy to include common content (e.g. images, stylesheets) without wasting disk space on redundant files.

Emacs integration

The git repo contains an emacs mode, please edit the Makefile to make sure it lands in the right directory. It is a fork of an old version of markdown-mode (the one that came with Debian 8). It provides several commands:

C-c h
Hide all languages except the languages you specify. The command prompts you for the languages.
C-c s
Show all languages.
C-c d
Run schreib deploy to deploy the website on the server.