mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
#17873741 : added code highlighting for issuetracker
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5934 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cdfde41254
commit
2f791fd050
2 changed files with 40 additions and 3 deletions
|
|
@ -241,7 +241,44 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(!$file_type) $file_type = "code";
|
||||
if(!$file_type)
|
||||
{
|
||||
$file_type = "code";
|
||||
$extToLang = array(
|
||||
"h" => "Cpp",
|
||||
"cpp" => "Cpp",
|
||||
"csharp" => "CSharp",
|
||||
"css" => "Css",
|
||||
"html" => "Xml",
|
||||
"sql" => "Sql",
|
||||
"java" => "Java",
|
||||
"py" => "Python",
|
||||
"rb" => "Ruby",
|
||||
"js" => "JScript",
|
||||
"c" => "Cpp",
|
||||
"vb" => "Vb",
|
||||
"xml" => "Xml",
|
||||
"php" => "Php"
|
||||
);
|
||||
|
||||
$file_ext = strtolower($file_ext);
|
||||
if($extToLang[$file_ext])
|
||||
{
|
||||
$file_ext = $extToLang[$file_ext];
|
||||
}
|
||||
if(file_exists("./common/js/plugins/code_highlighter/script/shBrush".$file_ext.".js"))
|
||||
{
|
||||
Context::loadJavascriptPlugin("code_highlighter");
|
||||
Context::addJsFile('./common/js/plugins/code_highlighter/script/shBrush'.$file_ext.'.js', false);
|
||||
$js_code = <<<dpScript
|
||||
<script type="text/javascript">
|
||||
SyntaxHighlighter.config.clipboardSwf = './modules/editor/components/code_highlighter/script/clipboard.swf';
|
||||
SyntaxHighlighter.all();
|
||||
</script>
|
||||
dpScript;
|
||||
Context::addHtmlFooter($js_code);
|
||||
}
|
||||
}
|
||||
Context::set('file_type', $file_type);
|
||||
|
||||
$this->setTemplateFile('source_file_view');
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
<li>[<a href="{getUrl('type','diff','path',urlencode($path),'erev',$erev, 'brev', $brev)}">compare with previous</a>]</li>
|
||||
<!--@end-->
|
||||
</ol>
|
||||
|
||||
<pre>
|
||||
<br />
|
||||
<pre class="brush: cpp;">
|
||||
<!--@if($file_type == "code")-->
|
||||
{htmlspecialchars($content->content)}
|
||||
<!--@elseif($file_type == "document")-->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue