examples/sections.rkt
#lang racket/base
(require srfi/13)

;;; Laurent Orseau <laurent orseau gmail com> -- 2012-04-21

(define (surround-char str char [prefix ""] [suffix (string-reverse prefix)])
  (let ([line (string-append prefix (build-string (+ 4 (string-length str)) (λ(i) char)) suffix "\n")])
    (string-append 
     line
     prefix (string char) " " str " " (string char) suffix "\n"
     line)))

(provide title)
(define (title str)
  (surround-char 
   (string-append "  " (string-titlecase str) "  ")
   #\* ";    **")
  )

(provide section)
(define (section str)
  (surround-char str #\= ";==")
  )

(provide subsection)
(define (subsection str)
  (surround-char str #\: ";:")
  )

(provide subsubsection)
(define (subsubsection str)
  (surround-char str #\- ";")
  )

#|
(displayln (title "this is the title"))
(displayln (section "Section"))
(displayln (subsection "Subsection"))
(displayln (subsubsection "Subsubsection"))


;|#