Skip to content

Commit

Permalink
html encoding fixed in comments + better layout for code display
Browse files Browse the repository at this point in the history
  • Loading branch information
KuiKui committed Jun 3, 2012
1 parent e9d778c commit 05c8ae8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/helper/MarkdownHelper.php
Expand Up @@ -76,7 +76,8 @@ function Markdown($text) {
$text = preg_replace($pattern, '[$1]($1)', $text);

# Generate line breaks (2 spaces are no more needed)
$text = preg_replace('/\s*\n/', "\n\r", $text);
$text = preg_replace('/\r/', '', $text);
$text = preg_replace('/\n/', " \n", $text);

# Transform text using parser.
return $parser->transform($text);
Expand Down Expand Up @@ -1125,7 +1126,6 @@ function _doCodeBlocks_callback($matches) {
$codeblock = $matches[1];

$codeblock = $this->outdent($codeblock);
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);

# trim leading newlines and trailing newlines
$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
Expand All @@ -1139,7 +1139,7 @@ function makeCodeSpan($code) {
#
# Create a code span markup for $code. Called from handleSpanToken.
#
$code = htmlspecialchars(trim($code), ENT_NOQUOTES);
$code = trim($code);
return $this->hashPart("<code>$code</code>");
}

Expand Down Expand Up @@ -2688,7 +2688,6 @@ function doFencedCodeBlocks($text) {
}
function _doFencedCodeBlocks_callback($matches) {
$codeblock = $matches[2];
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
$codeblock = preg_replace_callback('/^\n+/',
array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
$codeblock = "<pre><code>$codeblock</code></pre>";
Expand Down
10 changes: 9 additions & 1 deletion web/css/less/_comment.less
Expand Up @@ -94,11 +94,19 @@
list-style-type: decimal;
}
}
pre {
background-color: @lighterGrey;
.radius(5px);
color: @darkGrey;
font-family: monospace;
margin: 8px 5px;
padding: 8px;
}
code {
background-color: @lighterGrey;
color: @darkGrey;
font-family: monospace;
padding: 0 3px;
padding: 2px 3px;
}
em {
color: @grey;
Expand Down
12 changes: 11 additions & 1 deletion web/css/main.css
Expand Up @@ -388,11 +388,21 @@
list-style-position:inside;
list-style-type:decimal;
}
.comment_bloc .comment .comment_body pre, .comments_holder .comment .comment_body pre {
background-color:#eeeeee;
border-radius:5px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
color:#333333;
font-family:monospace;
margin:8px 5px;
padding:8px;
}
.comment_bloc .comment .comment_body code, .comments_holder .comment .comment_body code {
background-color:#eeeeee;
color:#333333;
font-family:monospace;
padding:0 3px;
padding:2px 3px;
}
.comment_bloc .comment .comment_body em, .comments_holder .comment .comment_body em {
color:#666666;
Expand Down

0 comments on commit 05c8ae8

Please sign in to comment.