detail.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <link rel="stylesheet" href="{__GOUGU__}/gougu/module/prism/prism.css?v=1"/>
  4. <link rel="stylesheet" href="{__JS__}/viewer/viewer.min.css?v=1"/>
  5. <link rel="stylesheet" href="{__CSS__}/detail.css?v=1"/>
  6. {/block}
  7. {block name="title"}
  8. <title>{$detail.title}</title>
  9. {/block}
  10. {block name="keywords"}
  11. <meta name="keywords" content="{$detail.keyword_names}" />
  12. <meta name="description" content="{$detail.desc}" />
  13. {/block}
  14. <!-- 主体 -->
  15. {block name="body"}
  16. {include file="common/header" nav='index' /}
  17. <div class="detail">
  18. <h1 class="detail-title">
  19. {$detail.title}
  20. </h1>
  21. <div class="detial-ops">
  22. <span>发表于:{:date('Y-m-d H:i:s',$detail.create_time)}</span><span>浏览:{$detail.read}次</span><span class="color-tags">TAG:{foreach name='$detail.keyword_array' item='vo'}
  23. <a href="#" title="{$vo.title}">#{$vo.title}</a>
  24. {/foreach}</span>
  25. </div>
  26. <div id="Detail" class="detial-content">
  27. {$detail.content|raw}
  28. </div>
  29. </div>
  30. {/block}
  31. <!-- 脚本 -->
  32. {block name="script"}
  33. <script src="{__GOUGU__}/gougu/module/prism/prism.js?v=1"></script>
  34. <script src="{__JS__}/viewer/viewer.min.js?v=1"></script>
  35. <script>
  36. function unhtml(str, reg) {
  37. return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function (a, b) {
  38. if (b) {
  39. return a;
  40. } else {
  41. return {
  42. '<':'&lt;',
  43. '&':'&amp;',
  44. '"':'&quot;',
  45. '>':'&gt;',
  46. "'":'&#39;'
  47. }[a]
  48. }
  49. }) : '';
  50. }
  51. var $codepre = $("pre[class]");
  52. if($codepre.length>0){
  53. for(var i = 0;i<$codepre.length;i++){
  54. var item = $codepre.eq(i);
  55. var language = "";
  56. item.attr("class").replace(/brush:([^;]+)/,function(a,b){
  57. language = b;
  58. });
  59. if(language){
  60. var codehtml = item.html();
  61. var code = $("<code>");
  62. code.attr("class","language-"+language+" line-numbers");
  63. //codehtml= unhtml(codehtml);
  64. code.html(codehtml);
  65. item.html(code);
  66. Prism.highlightElement(code[0]);
  67. }
  68. }
  69. }
  70. var $code=$("code[class]");
  71. if($code.length>0){
  72. for(var i = 0;i<$code.length;i++){
  73. var item = $code.eq(i);
  74. item.addClass("line-numbers");
  75. //Prism.highlightElement(item);
  76. }
  77. }
  78. var viewer = new Viewer(document.getElementById('Detail'));
  79. </script>
  80. {/block}
  81. <!-- /脚本 -->