|
From: Arno H. <aho...@us...> - 2000-10-23 16:52:08
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory slayer.i.sourceforge.net:/tmp/cvs-serv26582/lib Modified Files: transform.php Log Message: New: tabless definition lists (even nested): ;Term:definition And: ul,ol list types can be mixed - we only look at the last character. Changes e.g. from "**#*" to "###*" go unnoticed. and wouldn't make a difference to the HTML layout anyway. Index: transform.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/transform.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** transform.php 2000/10/11 14:08:56 1.2 --- transform.php 2000/10/23 16:52:05 1.3 *************** *** 200,204 **** } ! // HTML modes: pre, unordered/ordered lists, term/def if (preg_match("/(^\t+)(.*?)(:\t)(.*$)/", $tmpline, $matches)) { // this is a dictionary list item --- 200,204 ---- } ! // HTML modes: pre, unordered/ordered lists, term/def (using TAB) if (preg_match("/(^\t+)(.*?)(:\t)(.*$)/", $tmpline, $matches)) { // this is a dictionary list item *************** *** 210,214 **** $tmpline .= "<dd>" . $matches[4]; - // oops, the \d needed to be \d+, thanks al...@mi... } elseif (preg_match("/(^\t+)(\*|\d+|#)/", $tmpline, $matches)) { // this is part of a list --- 210,213 ---- *************** *** 224,249 **** // tabless markup for unordered and ordered lists ! // first, unordered lists: one or more astericks at the ! // start of a line indicate a <UL> block ! ! } elseif (preg_match("/^([*]+)/", $tmpline, $matches)) { // this is part of an unordered list $numtabs = strlen($matches[1]); $listtag = "ul"; ! $tmpline = preg_replace("/^([*]+)/", "", $tmpline); $html .= SetHTMLOutputMode($listtag, SINGLE_DEPTH, $numtabs); $html .= "<li>"; ! // second, ordered lists <OL> ! } elseif (preg_match("/^([#]+)/", $tmpline, $matches)) { // this is part of an ordered list $numtabs = strlen($matches[1]); $listtag = "ol"; ! $tmpline = preg_replace("/^([#]+)/", "", $tmpline); $html .= SetHTMLOutputMode($listtag, SINGLE_DEPTH, $numtabs); $html .= "<li>"; --- 223,259 ---- // tabless markup for unordered and ordered lists + // list types can be mixed, so we only look at the last + // character. Changes e.g. from "**#*" to "###*" go unnoticed. + // and wouldn't make a difference to the HTML layout anyway. ! // unordered lists <UL>: "*" ! } elseif (preg_match("/^([#*]*\*)[^#]/", $tmpline, $matches)) { // this is part of an unordered list $numtabs = strlen($matches[1]); $listtag = "ul"; ! $tmpline = preg_replace("/^([#*]*\*)/", "", $tmpline); $html .= SetHTMLOutputMode($listtag, SINGLE_DEPTH, $numtabs); $html .= "<li>"; ! // ordered lists <OL>: "#" ! } elseif (preg_match("/^([#*]*\#)/", $tmpline, $matches)) { // this is part of an ordered list $numtabs = strlen($matches[1]); $listtag = "ol"; ! $tmpline = preg_replace("/^([#*]*\#)/", "", $tmpline); $html .= SetHTMLOutputMode($listtag, SINGLE_DEPTH, $numtabs); $html .= "<li>"; + + // definition lists <DL>: ";text:text" + } elseif (preg_match("/(^;+)(.*?):(.*$)/", $tmpline, $matches)) { + // this is a dictionary list item + $numtabs = strlen($matches[1]); + $html .= SetHTMLOutputMode("dl", SINGLE_DEPTH, $numtabs); + $tmpline = ''; + if(trim($matches[2])) + $tmpline = "<dt>" . $matches[2]; + $tmpline .= "<dd>" . $matches[3]; |