An extensible Haskell content management system

2006

I have added some functions for making dynamic page templates. This is the template used by this site. It omits the right sidebar on the image/* pages.

boxes :: Hope Box -> [Hope Box]
boxes m = [
           wrapBox "topBanner" [brandBox],
           wrapBox "leftBar" [navigationBox], 
           wrapBox "main" [m], 
           boxUnless (pathStartsWith ["image"]) $ 
                 wrapBox "rightBar" [latestEntriesShortBox 10], 
           wrapBox "bottomBanner" [infoBox]
          ]

Pages are now generated by a template function in Config.hs. This Hope setup uses this template:

boxes :: Hope Box -> [Hope Box]
boxes m = [
           wrapBox "topBanner" [brandBox],
           wrapBox "leftBar" [navigationBox], 
           wrapBox "main" [m], 
           wrapBox "rightBar" [latestEntriesShortBox 10], 
           wrapBox "bottomBanner" [infoBox]
          ]

The m parameter is the box with the main content of the page. The box names become class names in the HTML, and CSS is used to position them correctly.

In the future, more flexibility will be added, for example control over which pages certain boxes can appear on.


There is now a status page with lots of details. More stuff will be added over time. Modules can add stuff to the status page.


Lists of blog entries and images now contain 10 items by default. This can be changed in the settings for the blob2 and halbum2 modules. There are now links for the first, last, previous and next pages at the bottom of such lists.


When images are imported or uploaded, the halbum2 module now checks the EXIF orientation tag and rotates the thumbnail and view images accordingly. The original (full size) image is not modified.


There are now RSS feeds for all blog entries by a given user: blog entries by bjorn.

You can also get feeds for each tag: blog entries tagged with "feature".


To use a static page as the front page, go to Settings > front and set the front page path to the path of the static page that you want to use.

You can use the "menu pages" setting to add entries under "Home" in the menu. Just enter a space separated list of static page paths. Currently this only works for static pages.


Hope now supports static pages, with custom paths. The Hope about page is an example of such a page.


I've extended the markup syntax a bit, and added the ability for modules to add their own formatting rules. Here is a summary of the supported markup:

Paragraphs

Use one or more empty lines to separate paragraphs.

Headings

Headings are written with multiple equal signs:

=== Headings ===

Headings are written with multiple equal signs:

Emphasis

Use asterisks to emphasize text.

 Use asterisks to *emphasize text*. 

Links

Enclose URLs in square brackets to make links. The markup after the URL becomes the link text.

Enclose URLs in [http://en.wikipedia.org/wiki/Bracket 
*square* brackets] to make links. 
The markup after the URL becomes the link text.

Images

To include external inline images, use [image:url].

[image:http://hope.bringert.net/_theme/hope/logo.png]

Special characters

Backslash escapes

Put a \ before characters which have special meaning in Hope markup to include the literal characters. Some examples: [ ] & { }

Some examples: \[ \] \& \{ \}

XML entities

XHTML Named entities

All named entities in XHTML 1.0 are supported. My name is Björn Bringert.

My name is Björn Bringert.
Numerical entities

You can use XML-style numerical entities, both decimal and hexadecimal. To write a λ (lambda) you write "λ".

Preformatted text

Use the "pre" chunk format:

This is
   preformatted text.

{{{pre: This is preformatted text. }}}

Block quotes

Use the "quote" chunk format:

If you try and take a cat apart to see how it works, the first thing you have on your hands is a non-working cat.

{{{quote: If you try and take a cat apart to see how it works, the first thing you have on your hands is a non-working cat. }}}

Custom references

Modules can add their own markup for inline items: [name:x y z].

Halbum images

The "halbum" reference format lets you add thumbnails for halbum images using the image ID.

IMG_0704.JPG

[halbum:11]

Custom chunks

Modules can also add chunk formats:

{{{name: foo bar baz }}}

Haskell code

The "haskell" module adds a chunk format called "haskell" which highlights Haskell code using hscolour:

module_haskell :: Module
module_haskell = 
    emptyModule {
                 moduleName = "haskell",
                 moduleStyleSheets = ["modules/haskell/style/haskell.css"],
                 moduleMarkupFormats = formats
                }

formats :: [MarkupXHtmlFormat Hope]
formats = [haskellChunk]

haskellChunk :: MarkupXHtmlFormat Hope
haskellChunk = ChunkFormat "haskell" f
    where f pref s = do let h = CSS.hscolourFragment False s
                        return $ primHtml h

Missing features

Various kinds of lists.

BUGS

There is no way to include a literal }}} in a preformatted chunk (or any chunk for that matter).


I've finally gotten around to changing the RSS feed so that the markup is converted to HTML.


Page 1 of 2