File: code-prettify.rb

package info (click to toggle)
tdiary-contrib 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,772 kB
  • sloc: ruby: 17,305; javascript: 8,263; lisp: 562; xml: 451; php: 61; sql: 40; makefile: 18
file content (16 lines) | stat: -rw-r--r-- 375 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Source code embedded plugin for tDiary.
# Copyright (C) 2012 Koichiro Ohba <koichiro@meadowy.org>
# License under MIT.

add_header_proc do
  <<-EOS
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify/loader/run_prettify.js"></script>
EOS
end

def code(content, lang = nil)
  <<-EOS
<pre class="prettyprint#{lang ? ' lang-' + lang : ''}">
#{content}</pre>
EOS
end