Sha256: d1c5db9d27fce7de3bd07e2d834a69267c20275a4cfcd243342ddd12efd0b046
Contents?: true
Size: 827 Bytes
Versions: 44
Compression:
Stored size: 827 Bytes
Contents
<?r case attributes[:rel] when "utopia" # Listing src will be relative to the base of utopia: base_path = Utopia::default_root("../") when "site" # Listing src is relative to setup/site in utopia: base_path = Utopia::default_root("../setup/site") else # Listing src will be relative to the path of the wiki page: base_path = current.node.local_path(controller[:page_path]) end if attributes[:src] path = File.join(base_path, attributes[:src]) code = File.read(path) else code = content end escaped_code = MarkupString.new(code) escaped_code = escaped_code.gsub(/%%([a-z]+)\{(.*?)\}/) do |match| "<span class=\"#{$1}\">#{$2}</span>" end if lang = (attributes[:lang] || attributes[:brush]) ?> <pre><code class="syntax brush-#{lang}">#{escaped_code}</code></pre> <?r else ?> <pre>#{escaped_code}</pre> <?r end ?>
Version data entries
44 entries across 44 versions & 1 rubygems