]*?>!" => "", #we don't need to show this in html "!]*?)>(.*?)!" => "$2\n", #also used for psalm-book headings "!]*?)>(.*?)!" => "$2\n", "! virtual=\"virtual\"!" => "", #if begin- or end- tags were added programmatically to match, remove the attribute "!]*?)/>!" => "", "!!" => "
\n", "!]*?>!" => "

\n", "!
\s*?

!" => "

", #eliminate trailing brs, which can happen with virtual paragraph endings "!]*?>(.*?)!" => "$1", "!!" => "", "!!" => "", "!1!" => "$1:1", "!!" => " ", #the nbsp is to prevent a verse number from appearing at the end of a line "!]*?>!" => "
\n", "!]*?>!" => "
\n", "!!" => "", "!!" => "", "!]*?>!" => "", "!(.*?)!s" => "$1", "!!" => "\n", "!(.*?)!" => "$1", "!<(/?)i>!" => "<$1"."em>", "!<(?:begin|end)-[^>]+?/>!" => "", #everything we need to convert has already been done; -chapter, some -line ); $html = preg_replace(array_keys($regex), array_values($regex), $xml); $html = translate_entities($html); return $html; } function translate_entities($text) { #convert named entities to their html equivalents $regex = array( "/&ldblquot;/" => "“", "/&rdblquot;/" => "”", "/&lquot;/" => "‘", "/&rquot;/" => "’", "/'/" => "'", #so people using browser's find feature can enter a regular ' "/&emdash;/" => "—", "/&endash;/" => "–", "/&ellipsis;/" => " . . .", "/&ellipsis4;/" => ". . . .", ); return preg_replace(array_keys($regex), array_values($regex), $text); } function translate_entities_to_simple_xml($text) { $regex = array( "/&ldblquot;/" => """, "/&rdblquot;/" => """, "/&lquot;/" => "'", "/&rquot;/" => "'", # "/'/" => "'", #' always indicates a possessive quote "/&emdash;/" => "--", "/&endash;/" => "-", "/&ellipsis;/" => "...", "/&ellipsis4;/" => "....", ); return preg_replace(array_keys($regex), array_values($regex), $text); } ?>