diff options
author | koray kavukcuoglu <koray@kavukcuoglu.org> | 2012-02-09 05:36:12 +0400 |
---|---|---|
committer | koray kavukcuoglu <koray@kavukcuoglu.org> | 2012-02-09 05:36:12 +0400 |
commit | 598592409abb522577d0a74db07c2543707cb2ec (patch) | |
tree | 0fa0bf6a1244d46da6f62df863623525e4af9342 | |
parent | 5d3ea7e32c7ee8706913291c86d41bb94a708cd7 (diff) |
added c/cpp syntax highlighting brush.
-rw-r--r-- | init.lua | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -218,6 +218,7 @@ function dok.dok2html(txt) local anch = {} local code = {} local file = {} + local lang = {} local pict = {} local foot = {} local issection = false; @@ -230,8 +231,9 @@ function dok.dok2html(txt) end) -- note: we do not support code-specific colorization yet - txt = txt:gsub('<file.->(.-)</file>', function(str) + txt = txt:gsub('<file%s-(%w-)>(.-)</file>', function(langstr,str) table.insert(file, str) + table.insert(lang,langstr) return '\019' .. #file .. '\019' end) @@ -501,7 +503,7 @@ function dok.dok2html(txt) end) txt = txt:gsub('\019(%d+)\019', function(id) id = tonumber(id) -- file - return '<pre class="brush: lua;">' .. file[id] .. '</pre>' + return '<pre class="brush: ' .. lang[id].. ';">' .. file[id] .. '</pre>' end) return txt |