The hscolour package

[ Tags: language, lgpl, library, program ] [ Propose Tags ]

hscolour is a small Haskell script to colourise Haskell code. It currently has six output formats: ANSI terminal codes, HTML 3.2 with font tags, HTML 4.01 with CSS, XHTML 1.0 with inline CSS styling, LaTeX, and mIRC chat codes.


[Skip to Readme]

Properties

Versions 1.6, 1.9, 1.10, 1.10.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.21, 1.22, 1.23, 1.24, 1.24.1
Dependencies base (<4.4), haskell98 [details]
License GPL
Copyright 2003-2009 Malcolm Wallace, University of York; 2006 Bjorn Bringert
Author Malcolm Wallace
Maintainer Malcolm Wallace
Category Language
Home page http://www.cs.york.ac.uk/fp/darcs/hscolour/
Uploaded Fri Aug 21 09:54:52 UTC 2009 by MalcolmWallace
Updated Fri Jan 2 22:37:44 UTC 2015 by HerbertValerioRiedel to revision 1
Distributions Arch:1.24.1, Debian:1.23, Fedora:1.24.1, FreeBSD:1.23, LTSHaskell:1.24.1, NixOS:1.24.1, Stackage:1.24.1, Tumbleweed:1.24.1
Executables HsColour
Downloads 81353 total (2530 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hscolour-1.14

[back to package description]
HsColour: A Haskell source-code colouriser.
-------------------------------------------
Copyright:  2003-2009, Malcolm Wallace, University of York
Licence:    GPL

Building:
    hmake HsColour
or
    ghc --make HsColour

Usage:
    HsColour [-Ofile]
             [ -tty | -html | -css | -icss | -latex | -mirc ]
             [ -lit | -lit-tex | -anchor  | -partial ]
             [ -nolit          | -noanchor| -nopartial ]
             [file.hs]

The program can colourise a Haskell source file for either terminal
output (option -tty), or HTML 3.2 output with font tags (option -html),
or HTML 4.01 output with CSS (option -css), or XHTML 1.0 output with
inline styling (option -icss) or LaTeX output (option -latex), or IRC
chat client (option -mirc).  The default is for terminal output, which
uses standard ANSI screen codes for the colours.

If no file argument is given, it reads standard input.  Output is
written to the file specified by the -O option, or by default, stdout.

HsColour can add named anchors in HTML or CSS or ICSS (option -anchor) to
top-level definitions in the source file (functions, datatypes,
classes).  This enables you to make links to a specific location in the
generated file with the standard "file.html#anchor" notation.

If you want to embed several individually colourised fragments into a
larger document, then use the <tt>-partial</tt> option , to omit the
HTML DOCTYPE header, CSS stylesheet link, or LaTeX prologue.

Alternatively, if you have a literate input source (e.g. .lhs file),
then the -lit option passes the literate parts untouched,
and colourises only the code fragments as if each was called
individually with -partial.  The option -lit-tex is identical: it is
retained for backwards-compatibility only.

You can configure the colours for different lexical entities by
editing a configuration file called .hscolour in the current directory.
(An example is included in the distribution.)  The file format is as
a simple Haskell value of type ColourPrefs, constructed using named
fields, as follows:

  data ColourPrefs = ColourPrefs
    { keyword, keyglyph, layout, comment
    , conid, varid, conop, varop
    , string, char, number, cpp
    , selection, variantselection :: [Highlight]
    }

  data Colour = Black | Red | Green | Yellow | Blue | Magenta | Cyan | White

  data Highlight =
      Normal
    | Bold
    | Dim
    | Underscore
    | Blink
    | ReverseVideo
    | Concealed
    | Foreground Colour
    | Background Colour
    | Italic

For CSS output, it is sufficient to edit the hscolour.css file, also in
the distribution.