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