>mono<<
Use >>-<< for empty line with half height
*/
$RecipeInfo['LiteralWhiteSpace']['Version'] = '2024-04-24';
# set $EnableCodeWrap = 1; for wrapping code and pre lines
# use as is or copy css styles below to local custom css file
SDV($EnableCodeWrap,0);
# check if browser is IE
if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE")!=FALSE) $BrowserIE = 1;
# New whitespace and line spacing Markup rules
# honour linebreaks
$HTMLPNewline = '
';
# set line height (used in injected css)
SDV($LineHeight, 1.3);
$HalfLineHeight = 0.5 * (float)$LineHeight;
# spaces at beginning of lines, and continuing list elements
Markup('^ws', '<^img', '/^(\\s+)(.*?)/', "WSIndent2");
function WSIndent2($m) {
$i = $m[1];
global $MarkupFrame, $BrowserIE, $HTMLPNewline;
$icol = strlen($i);
for($depth = count(@$MarkupFrame[0]['cs']); $depth > 0; $depth--)
if (@$MarkupFrame[0]['is'][$depth] == $icol) {
$MarkupFrame[0]['idep'] = $depth;
$MarkupFrame[0]['icol'] = $icol;
return '';
}
$sp = ' ';
$brsp = '';
if($BrowserIE==1) {
$sp = ' ';
$brsp = ' ';
}
$sp = str_repeat($sp,$icol);
if (@empty($MarkupFrame[0]['cs']))
return "<:p,1>$brsp$sp";
else return "<:p,1>$HTMLPNewline$brsp$sp";
}
# convert spaces, but not in html tags
Markup('spacing', '>style', "/(\\s{2,7})(?![^<]*>)/", "WSReplace");
function WSReplace($m) {
$i = $m[1];
global $BrowserIE;
$icol = strlen($i);
if($BrowserIE==1) {
$icol = $icol-1;
return ' '.str_repeat(' ', $icol);
}
return str_repeat(' ', $icol);
}
# honour empty lines, height set with variable in injected css
Markup(':vspace', 'fulltext','/<:vspace>/',"
"); # half height empty line spacer >>-<< Markup('>>-<<','inline','/>>-<</',""); # tabs Markup('\t','inline',"/\\t/",''); # vertical spacing css rules for class='vspace' and class='halfline', and adjusting p and span $HTMLStylesFmt['vspace'] = " .halfvspace { height:".$HalfLineHeight."em; line-height:".$HalfLineHeight.";} .vspace { min-height:".$LineHeight."em; line-height:".$LineHeight."; margin-top:0; } p, span { line-height:".$LineHeight."; margin-top:0; padding:0; } "; # use mono style class for monospaced font (outside of @@...@@ and [@...@]) $HTMLStylesFmt['mono'] = ".mono { font-family: Lucida Console, monospace; } "; ##======== pre and code line wrap styles =====## # wrap lines of preformatted text and code # IE may not work with word-wrap, therefore special IE rule if($EnableCodeWrap==1) { # whitespace wrap (perhaps copy styles to css stylesheet) $HTMLStylesFmt['prewrap'] = " pre.escaped, code.escaped { white-space: pre-wrap; /* CSS-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ _white-space: pre; } * html pre.escaped, * html code.escaped { white-space: normal; } "; }