(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: wikilib.ml,v 1.7 2004/09/25 16:05:03 rich Exp $
+ * $Id: wikilib.ml,v 1.8 2004/09/30 14:58:14 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
(* This matches any markup. *)
let markup_re =
let link = "\\[\\[\\s*(?:.+?)\\s*(?:\\|.+?\\s*)?\\]\\]" in
- let tag = "</?(?:b|i|strong|em|code|sup|sub|nowiki)>" in
+ let tag = "</?(?:b|i|strong|em|code|sup|sub|nowiki|br)>" in
Pcre.regexp ("(.*?)((?:" ^ link ^ ")|(?:" ^ tag ^ "))(.*)")
(* This matches links only, and should be compatible with the link contained
| FoundOpen (first, elem, rest) when elem = "nowiki" ->
(* handle <nowiki> specially ... *)
escape_html first :: loop (rest, elem :: [])
+ | FoundOpen (first, elem, rest) when elem = "br" ->
+ (* handle <br> specially ... *)
+ escape_html first :: "<br/>" :: loop (rest, [])
| FoundOpen (first, elem, rest) ->
(* open tag - push it onto the stack *)
escape_html first :: "<" :: elem :: ">" :: loop (rest, [elem])
| FoundOpen (first, elem, rest) when elem = "nowiki" ->
(* handle <nowiki> specially ... *)
escape_html first :: loop (rest, elem :: stack)
+ | FoundOpen (first, elem, rest) when elem = "br" ->
+ (* handle <br> specially ... *)
+ escape_html first :: "<br/>" :: loop (rest, stack)
| FoundOpen (first, elem, rest) ->
(* open tag - push it onto the stack *)
escape_html first :: "<" :: elem :: ">" ::