Bride of Text 2.0

A command-line static web page generator written in Perl5.

Though there are counless other similar projects, this one exists because I didn't write any of the others. This is a tiny tool that is tailor-made to my preferences.


See syntax.txt and syntax.html for the source and generated output. The syntax is extremely compact and strict, making it easy to write and to parse.

In particular, look at the implementation of tables. They look good in the .txt source and yet are extremely easy to type since most of the beautification in raw text is optional.


Bride takes three arguments. Example:

./ syntax.txt syntax.html template.html

The first is the source text file, the second is the destination HTML filename (Bride will create it), and the third is a template HTML file.

Generating multiple files or whole websites can be easily solved with shell scripts or with a Makefile, such as this one I use myself:

SRC = $(wildcard txt/*.txt)
OUT = $(patsubst txt/%.txt,html/%.html,$(SRC))

.PHONY: all
all: $(OUT)

    # SRC: $(SRC)
    # OUT = $(OUT)

html/%.html: txt/%.txt
    bride $< $@ template.html

.PHONY: clean
    rm -f $(OUT)

The Makefile converts all .txt files in a txt/ directory to .html files in an html/ directory using the bride command (I have created a symlink to called /usr/local/bin/bride).

I've had good luck using this Makefile with additional rules for using different templates for particular pages, etc.

Or here's a Bash shell script I've saved as /usr/local/bin/brideit for generating stand-alone pages quickly from the commandline:

bride $1.txt $1.html /home/dave/projects/brideoftext2/template.html

(Obviously, you'll need to change the template path to the file of your choice.)

This lets you create an HTML document from foo.txt as easily as:

brideit foo

The different ways to accomplish this are endless and are specific to your operating system and needs.

Template syntax

The template contains the basic structure of the HTML document you wish to generate. It should include the <html> and <body> tags.

Currently, there are only two template variables which will be populated: $title and $body.

See the example template.html that comes with this project.