mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
MINOR Fixed commenting
This commit is contained in:
parent
7516d31ce0
commit
1e7c8aefe4
@ -34,7 +34,7 @@ class DocumentationParser {
|
||||
$md = self::rewrite_image_links($md, $page);
|
||||
$md = self::rewrite_relative_links($md, $page, $baselink);
|
||||
$md = self::rewrite_api_links($md, $page);
|
||||
$md = self::rewrite_code_blocks($md, $page);
|
||||
// $md = self::rewrite_code_blocks($md, $page);
|
||||
|
||||
require_once('../sapphiredocs/thirdparty/markdown.php');
|
||||
$html = Markdown($md);
|
||||
@ -42,38 +42,40 @@ class DocumentationParser {
|
||||
return $html;
|
||||
}
|
||||
|
||||
// function rewrite_code_blocks($md) {
|
||||
// $tabwidth = (defined('MARKDOWN_TAB_WIDTH')) ? MARKDOWN_TAB_WIDTH : 4;
|
||||
// $md = preg_replace_callback('{
|
||||
// (?:\n\n|\A\n?)
|
||||
// [ ]*(\{[a-zA-Z]*\})? # lang
|
||||
// [ ]* \n # Whitespace and newline following marker.
|
||||
// ( # $1 = the code block -- one or more lines, starting with a space/tab
|
||||
// (?>
|
||||
// [ ]{'.$tabwidth.'} # Lines must start with a tab or a tab-width of spaces
|
||||
// .*\n+
|
||||
// )+
|
||||
// )
|
||||
// ((?=^[ ]{0,'.$tabwidth.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
|
||||
// }xm',
|
||||
// array('DocumentationParser', '_do_code_blocks'), $md);
|
||||
//
|
||||
// return $md;
|
||||
// }
|
||||
// static function _do_code_blocks($matches) {
|
||||
// $tabwidth = (defined('MARKDOWN_TAB_WIDTH')) ? MARKDOWN_TAB_WIDTH : 4;
|
||||
// $codeblock = $matches[2];
|
||||
//
|
||||
// // outdent
|
||||
// $codeblock = preg_replace('/^(\t|[ ]{1,'.$tabwidth.'})/m', '', $codeblock);
|
||||
// $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
|
||||
//
|
||||
// # trim leading newlines and trailing newlines
|
||||
// $codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
|
||||
//
|
||||
// $codeblock = "<pre><code>$codeblock\n</code></pre>";
|
||||
// return "\n\n".$this->hashBlock($codeblock)."\n\n";
|
||||
// }
|
||||
/*
|
||||
function rewrite_code_blocks($md) {
|
||||
$tabwidth = (defined('MARKDOWN_TAB_WIDTH')) ? MARKDOWN_TAB_WIDTH : 4;
|
||||
$md = preg_replace_callback('{
|
||||
(?:\n\n|\A\n?)
|
||||
[ ]*(\{[a-zA-Z]*\})? # lang
|
||||
[ ]* \n # Whitespace and newline following marker.
|
||||
( # $1 = the code block -- one or more lines, starting with a space/tab
|
||||
(?>
|
||||
[ ]{'.$tabwidth.'} # Lines must start with a tab or a tab-width of spaces
|
||||
.*\n+
|
||||
)+
|
||||
)
|
||||
((?=^[ ]{0,'.$tabwidth.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
|
||||
}xm',
|
||||
array('DocumentationParser', '_do_code_blocks'), $md);
|
||||
|
||||
return $md;
|
||||
}
|
||||
static function _do_code_blocks($matches) {
|
||||
$tabwidth = (defined('MARKDOWN_TAB_WIDTH')) ? MARKDOWN_TAB_WIDTH : 4;
|
||||
$codeblock = $matches[2];
|
||||
|
||||
// outdent
|
||||
$codeblock = preg_replace('/^(\t|[ ]{1,'.$tabwidth.'})/m', '', $codeblock);
|
||||
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
|
||||
|
||||
# trim leading newlines and trailing newlines
|
||||
$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
|
||||
|
||||
$codeblock = "<pre><code>$codeblock\n</code></pre>";
|
||||
return "\n\n".$this->hashBlock($codeblock)."\n\n";
|
||||
}
|
||||
*/
|
||||
|
||||
static function rewrite_image_links($md, $page) {
|
||||
// Links with titles
|
||||
|
Loading…
Reference in New Issue
Block a user